• 大小: 345KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-08-01
  • 语言: 其他
  • 标签: HttpHe  

资源简介

基于 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;

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using CsharpHttpHelper.baseBll;
using System.Drawing;
using CsharpHttpHelper.Helper;
using CsharpHttpHelper.Item;
using System.Collections.Specialized;
using System.Runtime.Remoting.Messaging;

namespace CsharpHttpHelper
{
    /// 
    /// gethtml方法异步调用的委托
    /// 

    /// 
    /// 
    public delegate void ResultHandler(HttpResult item);

    /// 
    /// Http帮助类  Copyright:http://www.httphelper.com/
    /// 版本:2.2.0
    /// 作者:苏飞
    /// 更新时间:2018-7-2
    /// 

    public class HttpHelper
    {
        #region Private Obj

        /// 
        /// HttpHelperBLL
        /// 

        private HttpHelperBll bll = new HttpHelperBll();
        /// 
        /// gethtml方法异步调用的委托
        /// 

        /// 
        /// 
        private delegate HttpResult GethtmlHandler(HttpItem item);
        /// 
        /// 异步调用方法委托
        /// 

        private ResultHandler resultheadler;
        #endregion

        #region HttpHelper
        /// 
        /// 根据相传入的数据,得到相应页面数据
        /// 

        /// 参数类对象
        /// 返回HttpResult类型
        public HttpResult GetHtml(HttpItem item)
        {
            return bll.GetHtml(item);
        }
        /// 
        /// GetHtml方法的异步调用方式,根据相传入的数据,得到相应页面数据
        /// 

        /// 参数类对象
        /// 回调的方法名
        public void BeginInvokeGetHtml(HttpItem item ResultHandler resultMainName)
        {
            resultheadler = resultMainName;
            GethtmlHandler handler = new GethtmlHandler(GetHtml);
            handler.BeginInvoke(item new AsyncCallback(CallbackFunc) “AsycState:OK“);
        }
        /// 
        /// 内部回调方法
        /// 

        /// 返回值
        private void CallbackFunc(IAsyncResult resultType)
        {
            //result 是“加法类.Add()方法”的返回值             
            //AsyncResult 是IAsyncResult接口的一个实现类,引用空间:System.Runtime.Remoting.Messaging             
            //AsyncDelegate 属性可以强制转换为用户定义的委托的实际类。
            GethtmlHandler handler = (GethtmlHandler)((AsyncResult)resultType).AsyncDelegate;
            HttpResult result = handler.EndInvoke(resultType);
            //回调方法传回执行结果
            resultheadler.Invoke(result);
        }
        /// 
        /// 根据Url获取图片
        /// 

        /// HttpItem参数
        /// 返回图片,错误为NULL
        public Image GetImage(HttpItem item)
        {
            return bll.GetImage(item);
        }
        /// 

        /// 快速请求方

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      85618  2019-01-15 14:22  HttpHelper万能框架V2.2\.vs\config\applicationhost.config

    ..A..H.     50688  2019-03-26 11:13  HttpHelper万能框架V2.2\.vs\CsharpHttpHelper\v15\.suo

     文件          0  2019-01-15 14:22  HttpHelper万能框架V2.2\.vs\CsharpHttpHelper\v15\Server\sqlite3\db.lock

     文件       4096  2019-01-15 14:22  HttpHelper万能框架V2.2\.vs\CsharpHttpHelper\v15\Server\sqlite3\storage.ide

     文件      32768  2019-03-26 11:08  HttpHelper万能框架V2.2\.vs\CsharpHttpHelper\v15\Server\sqlite3\storage.ide-shm

     文件    3287792  2019-03-25 21:48  HttpHelper万能框架V2.2\.vs\CsharpHttpHelper\v15\Server\sqlite3\storage.ide-wal

     文件      21372  2019-03-25 21:49  HttpHelper万能框架V2.2\CsharpHttpHelper\base\Httphelperbase.cs

    .......      2731  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\baseBll\HttpHelperBll.cs

     文件      33280  2019-03-26 11:08  HttpHelper万能框架V2.2\CsharpHttpHelper\bin\Debug\HttpHelper.dll

     文件     103936  2019-03-26 11:08  HttpHelper万能框架V2.2\CsharpHttpHelper\bin\Debug\HttpHelper.pdb

     文件      46662  2019-03-26 11:08  HttpHelper万能框架V2.2\CsharpHttpHelper\bin\Debug\HttpHelper.xml

     文件       3857  2019-01-15 14:42  HttpHelper万能框架V2.2\CsharpHttpHelper\CsharpHttpHelper.csproj

    .......       458  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Enum\AType.cs

    .......       747  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Enum\PostDataType.cs

    .......       678  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Enum\ResultCookieType.cs

    .......       703  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Enum\ResultType.cs

    .......      1516  2018-04-08 17:23  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\base64Helper.cs

    .......      1179  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\EncodingHelper.cs

    .......      2081  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\ExecJsHelper.cs

    .......      5678  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\HtmlHelper.cs

     文件       5966  2019-01-15 15:53  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\HttpCookieHelper.cs

    .......      4147  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\HttpUrlHelper.cs

    .......       723  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\ImageHelper.cs

    .......      1470  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\Jsonhelper.cs

    .......      1340  2018-04-28 17:10  HttpHelper万能框架V2.2\CsharpHttpHelper\Helper\MD5Helper.cs

     文件      14026  2019-01-15 15:55  HttpHelper万能框架V2.2\CsharpHttpHelper\HttpHelper.cs

    .......     11759  2018-03-12 13:45  HttpHelper万能框架V2.2\CsharpHttpHelper\HttpItem.cs

    .......      2877  2018-07-02 14:10  HttpHelper万能框架V2.2\CsharpHttpHelper\HttpResult.cs

    .......       923  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Item\AItem.cs

    .......       499  2017-07-04 11:14  HttpHelper万能框架V2.2\CsharpHttpHelper\Item\ImgItem.cs

............此处省略94个文件信息

评论

共有 条评论