NIM SDK API  8.7.0
Public Member Functions | Friends | List of all members
nim_http::HttpRequest Class Reference

NIM HTTP提供的http传输相关接口 More...

#include <nim_tools_http_cpp.h>

Public Member Functions

 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 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)
 

Friends

HttpRequestID PostRequest (const HttpRequest &http_request)
 

Detailed Description

NIM HTTP提供的http传输相关接口

Constructor & Destructor Documentation

◆ HttpRequest() [1/4]

nim_http::HttpRequest::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() 
)

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::HttpRequest::HttpRequest ( const std::string &  url,
const std::string &  download_file_path,
__int64  range_start,
const CompletedCallback complete_cb,
const ProgressCallback progress_cb = ProgressCallback(),
const SpeedCallback speed_cb = SpeedCallback(),
const TransferCallback transfer_cb = TransferCallback() 
)

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::HttpRequest::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() 
)

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::HttpRequest::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() 
)

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任务句柄

Member Function Documentation

◆ 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
[in]timeout_ms超时时间,单位是毫秒
Returns
void 无返回值

The documentation for this class was generated from the following file: