37 lines
772 B
C++
37 lines
772 B
C++
#pragma once
|
|
|
|
#include <a8/singleton.h>
|
|
|
|
#include "f8/httpclientpool.h"
|
|
|
|
struct HttpProxyRequest;
|
|
class HttpProxy : public a8::Singleton<HttpProxy>
|
|
{
|
|
|
|
private:
|
|
HttpProxy() {};
|
|
friend class a8::Singleton<HttpProxy>;
|
|
|
|
public:
|
|
|
|
void Init();
|
|
void UnInit();
|
|
|
|
std::string HttpGet(
|
|
f8::HttpProxyCb cb,
|
|
const char* url,
|
|
a8::XObject url_params
|
|
);
|
|
std::shared_ptr<HttpProxyRequest> GetRequest(const std::string& req_id);
|
|
void DestoryRequest(std::shared_ptr<HttpProxyRequest> request);
|
|
|
|
private:
|
|
|
|
std::string CreateRequestId();
|
|
|
|
private:
|
|
std::map<std::string, std::shared_ptr<HttpProxyRequest>> request_hash_;
|
|
std::string request_prefix_;
|
|
|
|
};
|