NIM HTTP提供的http传输相关接口
More...
#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 (NIMProxyType type, const std::string &host, short port, const std::string &user, const std::string &pass) |
|
◆ HttpRequest() [1/4]
NIM HTTP 创建下载文件任务
- Parameters
-
[in] | url | 资源地址 |
[in] | download_file_path | 下载文件保存的本地路径 |
[in] | complete_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- Returns
- HttpRequestHandle http任务句柄
◆ HttpRequest() [2/4]
NIM HTTP 创建下载文件任务,支持断点续传
- Parameters
-
[in] | url | 资源地址 |
[in] | download_file_path | 下载文件保存的本地路径 |
[in] | range_start | 下载文件的起始点 |
[in] | complete_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- Returns
- HttpRequestHandle http任务句柄
◆ HttpRequest() [3/4]
NIM HTTP 创建上传任务
- Parameters
-
[in] | url | 资源保存地址 |
[in] | post_body | 上传的数据 |
[in] | post_body_size | 上传数据的大小 |
[in] | response_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- Returns
- HttpRequestHandle http任务句柄
◆ HttpRequest() [4/4]
NIM HTTP 创建上传任务
- Parameters
-
[in] | url | 资源保存地址 |
[in] | post_body | 上传的数据 |
[in] | post_body_size | 上传数据的大小 |
[in] | response_cb | 结束回调 |
[in] | progress_cb | 进度回调 |
[in] | speed_cb | 实时速度回调 |
[in] | transfer_cb | 传输信息回调 |
- Returns
- HttpRequestHandle http任务句柄
◆ AddHeader() [1/2]
void nim_http::HttpRequest::AddHeader |
( |
const std::map< std::string, std::string > & |
headers_map | ) |
|
NIM HTTP 创建任务
- Parameters
-
[in] | headers_map | 头的key,头的value |
- Returns
- void 无返回值
◆ AddHeader() [2/2]
void nim_http::HttpRequest::AddHeader |
( |
const std::string & |
key, |
|
|
const std::string & |
value |
|
) |
| |
NIM HTTP 创建任务
- Parameters
-
[in] | key | 头的key |
[in] | value | 头的value |
- Returns
- void 无返回值
◆ SetLowSpeed()
void nim_http::HttpRequest::SetLowSpeed |
( |
int |
low_speed_limit, |
|
|
int |
low_speed_time |
|
) |
| |
NIM HTTP 设置最低传输速度
- Parameters
-
[in] | low_speed_limit | 最低传输的字节数(大于0) |
[in] | low_speed_time | 多少秒传输速度不得低于low_speed_limit,不满足条件则会终止传输(大于0) |
- Returns
- void 无返回值
◆ SetMethodAsPost()
void nim_http::HttpRequest::SetMethodAsPost |
( |
| ) |
|
NIM HTTP 强制设置http请求方法为post
- Returns
- void 无返回值
◆ SetProxy()
void nim_http::HttpRequest::SetProxy |
( |
NIMProxyType |
type, |
|
|
const std::string & |
host, |
|
|
short |
port, |
|
|
const std::string & |
user, |
|
|
const std::string & |
pass |
|
) |
| |
NIM HTTP 设置代理
- Parameters
-
[in] | type | 代理类型NIMProxyType |
[in] | host | 代理地址 |
[in] | port | 代理端口 |
[in] | user | 代理账号 |
[in] | pass | 代理密码 |
- Returns
- void 无返回值
◆ SetTimeout()
void nim_http::HttpRequest::SetTimeout |
( |
int |
timeout_ms | ) |
|
NIM HTTP 设置超时
- Parameters
-
- Returns
- void 无返回值
The documentation for this class was generated from the following files: