httpinterface

时间:2022-02-11 10:00:18
【文件属性】:
文件名称:httpinterface
文件大小:129KB
文件格式:ZIP
更新时间:2022-02-11 10:00:18
http # HttpInterface Windows上C++封装的HTTP库,包含三种实现模式(WinInet、WinHttp、socket) 主要实现了HTTP的get\post方法,下载到内存、下载到本地文件,回调下载进度等接口 测试程序中展现了常用的几个方法。 接口类声明: class IHttpBase { public: virtual void SetDownloadCallback(IHttpCallback* pCallback, void* pParam)= 0; virtual bool DownloadFile(LPCWSTR lpUrl, LPCWSTR lpFilePath)= 0; virtual bool DownloadToMem(LPCWSTR lpUrl, OUT void** ppBuffer, OUT int* nSize)= 0; virtual void FreeInstance()= 0; virtual HttpInterfaceError GetErrorCode()= 0; }; //////////////////////////////////////////////////////////////////////////////////// //HTTP请求接口类 class IWininetHttp :public IHttpBase { public: //HTTP请求功能 virtual string Request(LPCSTR lpUrl, HttpRequest type, LPCSTR lpPostData = NULL, LPCSTR lpHeader = NULL)= 0; virtual string Request(LPCWSTR lpUrl, HttpRequest type, LPCSTR lpPostData = NULL, LPCWSTR lpHeader = NULL)= 0; }; /////////////////////////////////////////////////////////////////////////////////////// //HTTP socket类 class ISocketHttp :public IHttpBase { public: virtual LPCWSTR GetIpAddr()const= 0; }; /////////////////////////////////////////////////////////////////////////////////////// //WinHttp类 class IWinHttp : public IWininetHttp { public: //设置超时时间,单位:毫秒 virtual void SetTimeOut(int dwConnectTime, int dwSendTime, int dwRecvTime)= 0; }; 能力有限,有bug欢迎指正 email:jelinyao@163.com
【文件预览】:
HttpInterface-master
----IHttp()
--------IHttp.sln(3KB)
--------clear.bat(264B)
--------IHttp.suo(77KB)
--------IHttp90.sln(3KB)
--------IHttp()
--------IHttp90.suo(82KB)
--------bin()
--------UseHttp()
----README.md(2KB)

网友评论