HTTP协议库有两个版本,一个是基于WININET,一个则是使用socket实现的。
可以支持POST 、GET请求,断点下载、重定向下载、下载进度回调,不支持HTTPS。
接口头文件声明如下:
#pragma once
#include <string>
using std::string;
using std::wstring;
#include <stdio.h>
#include <tchar.h>
enum REQUEST_TYPE
{
post,
get,
};
////////////////////////////////////////////////////////////////////////////////////
//HTTP请求接口类
class IHttpInterface
{
public:
//HTTP请求功能
virtual string Request(const string& strUrl, REQUEST_TYPE type, const string& strPostData="", string strHeader="")=0;
virtual string Request(const wstring& strUrl, REQUEST_TYPE type, const wstring& strPostData=L"", wstring strHeader=L"")=0;
virtual bool Download(const wstring& strUrl, const wstring& strSavePath)=0;
virtual bool Download(const string& strUrl, const string& strSavePath)=0;
// 下载消息设置
virtual void SetWnd(HWND hWnd)=0;
virtual void SetMsg(const UINT msg)=0;
//出错信息获取
virtua