NIM HTTP提供的http传输相关接口
更多...
#include <nim_tools_http_cpp.h>
|
| HttpRequest (const std::string &url, const std::string &download_file_path, const CompletedCallback &complete_cb, const ProgressCallback &progress_cb=ProgressCallback(), const SpeedCallback &speed_cb=SpeedCallback(), const TransferCallback &transfer_cb=TransferCallback()) |
|
| HttpRequest (const std::string &url, const std::string &download_file_path, int64_t range_start, const CompletedCallback &complete_cb, const ProgressCallback &progress_cb=ProgressCallback(), const SpeedCallback &speed_cb=SpeedCallback(), const TransferCallback &transfer_cb=TransferCallback()) |
|
| HttpRequest (const std::string &url, const char *post_body, size_t post_body_size, const ResponseCallback &response_cb, const ProgressCallback &progress_cb=ProgressCallback(), const SpeedCallback &speed_cb=SpeedCallback(), const TransferCallback &transfer_cb=TransferCallback()) |
|
| HttpRequest (const std::string &url, const char *post_body, size_t post_body_size, const ResponseCallbackEx &response_cb, const ProgressCallback &progress_cb=ProgressCallback(), const SpeedCallback &speed_cb=SpeedCallback(), const TransferCallback &transfer_cb=TransferCallback()) |
|
void | AddHeader (const std::string &key, const std::string &value) |
|
void | AddHeader (const std::map< std::string, std::string > &headers_map) |
|
void | SetMethodAsPost () |
|
void | SetTimeout (int timeout_ms) |
|
void | SetLowSpeed (int low_speed_limit, int low_speed_time) |
|
void | SetProxy (nim::NIMProxyType type, const std::string &host, short port, const std::string &user, const std::string &pass) |
|
|
static void | CompletedCallbackWrapper (const void *user_data, bool is_ok, int response_code) |
|
static void | ResponseCallbackWrapper (const void *user_data, bool is_ok, int response_code, const char *content, const char *head) |
|
static void | ProgressCallbackWrapper (const void *user_data, double upload_size, double uploaded_size, double download_size, double downloaded_size) |
|
static void | SpeedCallbackWrapper (const void *user_data, double upload_speed, double download_speed) |
|
static void | TransferCallbackWrapper (const void *user_data, double actual_upload_size, double upload_speed, double actual_download_size, double download_speed) |
|
◆ HttpRequest() [1/4]
NIM HTTP 创建下载文件任务
- 参数
-
[in] | url | 资源地址 |
[in] | download_file_path | 下载文件保存的本地路径 |
[in] | complete_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- 返回
- HttpRequestHandle http任务句柄
◆ HttpRequest() [2/4]
NIM HTTP 创建下载文件任务,支持断点续传
- 参数
-
[in] | url | 资源地址 |
[in] | download_file_path | 下载文件保存的本地路径 |
[in] | range_start | 下载文件的起始点 |
[in] | complete_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- 返回
- HttpRequestHandle http任务句柄
◆ HttpRequest() [3/4]
NIM HTTP 创建上传任务
- 参数
-
[in] | url | 资源保存地址 |
[in] | post_body | 上传的数据 |
[in] | post_body_size | 上传数据的大小 |
[in] | response_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- 返回
- HttpRequestHandle http任务句柄
◆ HttpRequest() [4/4]
NIM HTTP 创建上传任务
- 参数
-
[in] | url | 资源保存地址 |
[in] | post_body | 上传的数据 |
[in] | post_body_size | 上传数据的大小 |
[in] | response_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- 返回
- HttpRequestHandle http任务句柄
◆ AddHeader() [1/2]
void nim_http::HttpRequest::AddHeader |
( |
const std::map< std::string, std::string > & |
headers_map | ) |
|
NIM HTTP 创建任务
- 参数
-
[in] | headers_map | 头的key,头的value |
- 返回
- void 无返回值
◆ AddHeader() [2/2]
void nim_http::HttpRequest::AddHeader |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
NIM HTTP 创建任务
- 参数
-
[in] | key | 头的key |
[in] | value | 头的value |
- 返回
- void 无返回值
◆ CompletedCallbackWrapper()
void nim_http::HttpRequest::CompletedCallbackWrapper |
( |
const void * |
user_data, |
|
|
bool |
is_ok, |
|
|
int |
response_code |
|
) |
| |
|
staticprivate |
◆ ProgressCallbackWrapper()
void nim_http::HttpRequest::ProgressCallbackWrapper |
( |
const void * |
user_data, |
|
|
double |
upload_size, |
|
|
double |
uploaded_size, |
|
|
double |
download_size, |
|
|
double |
downloaded_size |
|
) |
| |
|
staticprivate |
◆ ResponseCallbackWrapper()
void nim_http::HttpRequest::ResponseCallbackWrapper |
( |
const void * |
user_data, |
|
|
bool |
is_ok, |
|
|
int |
response_code, |
|
|
const char * |
content, |
|
|
const char * |
head |
|
) |
| |
|
staticprivate |
◆ SetLowSpeed()
void nim_http::HttpRequest::SetLowSpeed |
( |
int |
low_speed_limit, |
|
|
int |
low_speed_time |
|
) |
| |
NIM HTTP 设置最低传输速度
- 参数
-
[in] | low_speed_limit | 最低传输的字节数(大于0) |
[in] | low_speed_time | 多少秒传输速度不得低于low_speed_limit,不满足条件则会终止传输(大于0) |
- 返回
- void 无返回值
◆ SetMethodAsPost()
void nim_http::HttpRequest::SetMethodAsPost |
( |
| ) |
|
NIM HTTP 强制设置http请求方法为post
- 返回
- void 无返回值
◆ SetProxy()
void nim_http::HttpRequest::SetProxy |
( |
nim::NIMProxyType |
type, |
|
|
const std::string & |
host, |
|
|
short |
port, |
|
|
const std::string & |
user, |
|
|
const std::string & |
pass |
|
) |
| |
NIM HTTP 设置代理
- 参数
-
[in] | type | 代理类型NIMProxyType |
[in] | host | 代理地址 |
[in] | port | 代理端口 |
[in] | user | 代理账号 |
[in] | pass | 代理密码 |
- 返回
- void 无返回值
◆ SetTimeout()
void nim_http::HttpRequest::SetTimeout |
( |
int |
timeout_ms | ) |
|
NIM HTTP 设置超时
- 参数
-
- 返回
- void 无返回值
◆ SpeedCallbackWrapper()
void nim_http::HttpRequest::SpeedCallbackWrapper |
( |
const void * |
user_data, |
|
|
double |
upload_speed, |
|
|
double |
download_speed |
|
) |
| |
|
staticprivate |
◆ TransferCallbackWrapper()
void nim_http::HttpRequest::TransferCallbackWrapper |
( |
const void * |
user_data, |
|
|
double |
actual_upload_size, |
|
|
double |
upload_speed, |
|
|
double |
actual_download_size, |
|
|
double |
download_speed |
|
) |
| |
|
staticprivate |
◆ PostRequest
◆ http_reuqest_handle_
该类的文档由以下文件生成:
- D:/GitLab/builds/5sbaxrcd/0/nim-pc/california/nim-cross-platform-sdk/exports/wrapper/nim_tools_cpp_wrapper/nim_tools_http_cpp.h
- D:/GitLab/builds/5sbaxrcd/0/nim-pc/california/nim-cross-platform-sdk/exports/wrapper/nim_tools_cpp_wrapper/nim_tools_http_cpp.cpp