8#ifndef _NIM_TOOLS_SDK_CPP_HTTP_H_
9#define _NIM_TOOLS_SDK_CPP_HTTP_H_
41typedef std::function<void(
bool,
int,
const std::string&,
const std::string&)>
ResponseCallbackEx;
72bool Init(
const std::string& library_path =
"");
85void InitLog(
const std::string& log_file_path);
102void SetGlobalProxy(nim::NIMProxyType type,
const std::string& host,
short port,
const std::string& user,
const std::string& pass);
141 const std::string& download_file_path,
159 const std::string& download_file_path,
178 const char* post_body,
179 size_t post_body_size,
197 const char* post_body,
198 size_t post_body_size,
210 void AddHeader(
const std::string& key,
const std::string& value);
217 void AddHeader(
const std::map<std::string, std::string>& headers_map);
238 void SetLowSpeed(
int low_speed_limit,
int low_speed_time);
249 void SetProxy(nim::NIMProxyType type,
const std::string& host,
short port,
const std::string& user,
const std::string& pass);
253 static void ResponseCallbackWrapper(
const void* user_data,
bool is_ok,
int response_code,
const char* content,
const char* head);
256 double uploaded_size,
257 double download_size,
258 double downloaded_size);
259 static void SpeedCallbackWrapper(
const void* user_data,
double upload_speed,
double download_speed);
261 double actual_upload_size,
263 double actual_download_size,
264 double download_speed);
NIM HTTP提供的http传输相关接口
Definition: nim_tools_http_cpp.h:128
HttpRequestHandle http_reuqest_handle_
Definition: nim_tools_http_cpp.h:268
static void ResponseCallbackWrapper(const void *user_data, bool is_ok, int response_code, const char *content, const char *head)
Definition: nim_tools_http_cpp.cpp:434
friend HttpRequestID PostRequest(const HttpRequest &http_request)
Definition: nim_tools_http_cpp.cpp:208
static void ProgressCallbackWrapper(const void *user_data, double upload_size, double uploaded_size, double download_size, double downloaded_size)
Definition: nim_tools_http_cpp.cpp:450
static void SpeedCallbackWrapper(const void *user_data, double upload_speed, double download_speed)
Definition: nim_tools_http_cpp.cpp:463
static void TransferCallbackWrapper(const void *user_data, double actual_upload_size, double upload_speed, double actual_download_size, double download_speed)
Definition: nim_tools_http_cpp.cpp:472
void SetTimeout(int timeout_ms)
Definition: nim_tools_http_cpp.cpp:406
void SetMethodAsPost()
Definition: nim_tools_http_cpp.cpp:402
static void CompletedCallbackWrapper(const void *user_data, bool is_ok, int response_code)
Definition: nim_tools_http_cpp.cpp:418
void SetLowSpeed(int low_speed_limit, int low_speed_time)
Definition: nim_tools_http_cpp.cpp:410
void AddHeader(const std::string &key, const std::string &value)
Definition: nim_tools_http_cpp.cpp:392
void SetProxy(nim::NIMProxyType type, const std::string &host, short port, const std::string &user, const std::string &pass)
Definition: nim_tools_http_cpp.cpp:414
NIM提供的HTTP工具
Definition: nim_tools_http_cpp.cpp:16
HttpRequestID PostRequest(const HttpRequest &http_request)
Definition: nim_tools_http_cpp.cpp:208
std::function< void(double, double, double, double)> ProgressCallback
Definition: nim_tools_http_cpp.h:49
bool IsInitLog()
Definition: nim_tools_http_cpp.cpp:190
bool Init(const std::string &library_path)
Definition: nim_tools_http_cpp.cpp:106
void RemoveRequest(HttpRequestID http_request_id)
Definition: nim_tools_http_cpp.cpp:212
std::function< void(bool, int, const std::string &, const std::string &)> ResponseCallbackEx
Definition: nim_tools_http_cpp.h:41
std::function< void(double, double, double, double)> TransferCallback
Definition: nim_tools_http_cpp.h:63
std::function< void(bool, int, const std::string &)> ResponseCallback
Definition: nim_tools_http_cpp.h:33
std::function< void(double, double)> SpeedCallback
Definition: nim_tools_http_cpp.h:55
void InitLog(const std::string &log_file_path)
Definition: nim_tools_http_cpp.cpp:186
void SetGlobalProxy(nim::NIMProxyType type, const std::string &host, short port, const std::string &user, const std::string &pass)
Definition: nim_tools_http_cpp.cpp:200
void Uninit()
Definition: nim_tools_http_cpp.cpp:179
std::function< void(bool, int)> CompletedCallback
Definition: nim_tools_http_cpp.h:26
std::string GetResponseHead(HttpRequestID http_request_id)
Definition: nim_tools_http_cpp.cpp:215