2019-07-28 10:31:56 +08:00
|
|
|
|
#pragma once
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include "lib_acl.h"
|
2019-07-28 10:31:56 +08:00
|
|
|
|
#include "lib_protocol.h" // http Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include "acl_cpp/stream/ofstream.hpp"
|
|
|
|
|
#include "acl_cpp/http/http_service.hpp"
|
|
|
|
|
|
|
|
|
|
class acl::string;
|
|
|
|
|
class acl::aio_handle;
|
|
|
|
|
|
|
|
|
|
class CHttpDownload : public acl::http_service_request
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CHttpDownload(const char* domain, unsigned short port,
|
|
|
|
|
acl::aio_handle* handle);
|
|
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
void SetHWnd(HWND hWnd);
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿڣ<D3BF><DAA3><EFBFBD><EFBFBD>ٹ<EFBFBD><D9B9>̣<EFBFBD><CCA3><EFBFBD> http_service <20>ദ<EFBFBD><E0B4A6><EFBFBD><EFBFBD><EFBFBD>Ϻ<EFBFBD><CFBA>Զ<EFBFBD><D4B6><EFBFBD><EFBFBD>øûص<C3BB>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
virtual void destroy();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
~CHttpDownload(void);
|
|
|
|
|
|
|
|
|
|
//////////////////////////////////////////////////////////////////////////
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD>HTTP<54><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD>Ļص<C4BB><D8B5>ӿڣ<D3BF>ע<EFBFBD><D7A2><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5>ÿռ<C3BF><D5BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ
|
|
|
|
|
// һ<><D2BB><EFBFBD>߳̿ռ䣬<D5BC><E4A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><C3BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD>Դʱ<D4B4><CAB1>Ҫע<D2AA>⻥<EFBFBD><E2BBA5>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
virtual const acl::string* get_body();
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <20><>Ӧͷʱ<CDB7>Ļص<C4BB><D8B5>ӿ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
virtual void on_hdr(const char* addr, const HTTP_HDR_RES* hdr);
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> HTTP <20><>Ӧ<EFBFBD><D3A6>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
virtual void on_body(const char* data, size_t dlen);
|
2019-07-28 10:31:56 +08:00
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧʧ<D3A6><CAA7>ʱ<EFBFBD>Ļص<C4BB><D8B5><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
virtual void on_error(acl::http_status_t errnum);
|
|
|
|
|
private:
|
|
|
|
|
acl::ofstream out_;
|
|
|
|
|
acl::aio_handle* handle_;
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
HWND hWnd_;
|
|
|
|
|
#endif
|
|
|
|
|
http_off_t read_length_;
|
|
|
|
|
http_off_t content_length_;
|
|
|
|
|
time_t begin_;
|
|
|
|
|
};
|