GithubHelp home page GithubHelp logo

whiter001 / httpinterface Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jelinyao/httpinterface

0.0 1.0 0.0 143 KB

Windows上C++封装的HTTP库,包含三种实现模式(WinInet、WinHttp、socket)

C++ 51.07% C 48.66% Batchfile 0.27%

httpinterface's Introduction

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:[email protected]

httpinterface's People

Contributors

jelinyao avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.