基于 HttpHelper万能框架V2.2 源码基础 上,修复了cookie 合并的问题,以及 ssl 基础连接已关闭的问题。作者你为什么要举报我?
1, cookie 修复
internal static string GetMergeCookie(string oldCookie, string newCookie)
{
if (!string.IsNullOrEmpty(oldCookie) && !string.IsNullOrEmpty(newCookie))
{
if (oldCookie == newCookie)
return oldCookie;
else
{
List Old = new List(oldCookie.Split(';'));
List New = new List(newCookie.Split(';'));
foreach (string n in New)
{
foreach (string o in Old)
{
if (o == n || o.Split('=')[0] == n.Split('=')[0])
{
Old.Remove(o);
break;
}
}
}
List list = new List(Old);
list.AddRange(New);
StringBuilder sb = new StringBuilder();
foreach (var s in list)
{
if (s != "")
{
sb.Append(s).Append(";");
}
}
return sb.ToString();
}
}
else if (!string.IsNullOrEmpty(oldCookie))
{
return oldCookie;
}
else if (!string.IsNullOrEmpty(newCookie))
{
return newCookie;
}
else
{
return "";
}
}
2,ssl 修复
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Ssl3 | (SecurityProtocolType)3072 | (SecurityProtocolType)192 | (SecurityProtocolType)768;
2019-12-21 21:16:36
345KB
HttpHe
1