@@ -33,7 +33,7 @@ class HttpSender {
3333 bool is_check_md5 = false ,
3434 bool is_verify_cert = true ,
3535 const std::string& ca_location = " " ,
36- SSLCtxCallback ssl_ctx_cb = nullptr ,
36+ const SSLCtxCallback& ssl_ctx_cb = nullptr ,
3737 void *user_data = nullptr );
3838
3939 static int SendRequest (const SharedTransferHandler& handler,
@@ -48,43 +48,45 @@ class HttpSender {
4848 bool is_check_md5 = false ,
4949 bool is_verify_cert = true ,
5050 const std::string& ca_location = " " ,
51- SSLCtxCallback ssl_ctx_cb = nullptr ,
51+ const SSLCtxCallback& ssl_ctx_cb = nullptr ,
5252 void *user_data = nullptr );
5353
5454 static int SendRequest (const SharedTransferHandler& handler,
5555 const std::string& http_method,
5656 const std::string& url_str,
5757 const std::map<std::string, std::string>& req_params,
5858 const std::map<std::string, std::string>& req_headers,
59- std::istream& is,
59+ std::istream& is, // 流式输入,用于传输请求正文
6060 uint64_t conn_timeout_in_ms,
6161 uint64_t recv_timeout_in_ms,
6262 std::map<std::string, std::string>* resp_headers,
63- std::ostream& resp_stream,
63+ std::ostream& resp_stream, // 流式输出,用于接收响应正文
6464 std::string* err_msg,
6565 bool is_check_md5 = false ,
6666 bool is_verify_cert = true ,
6767 const std::string& ca_location = " " ,
68- SSLCtxCallback ssl_ctx_cb = nullptr ,
68+ const SSLCtxCallback& ssl_ctx_cb = nullptr ,
6969 void *user_data = nullptr ,
70- const char *req_body_buf = nullptr ,
70+ const char *req_body_buf = nullptr , // 可选的缓冲区
7171 size_t req_body_len = 0 );
7272
7373 static int SendRequest (const SharedTransferHandler& handler,
7474 const std::string& http_method,
7575 const std::string& url_str,
7676 const std::map<std::string, std::string>& req_params,
7777 const std::map<std::string, std::string>& req_headers,
78- const std::string& req_body,
78+ const std::string& req_body, // 字符串输入,用于传输请求正文
7979 uint64_t conn_timeout_in_ms,
8080 uint64_t recv_timeout_in_ms,
8181 std::map<std::string, std::string>* resp_headers,
82- std::string* xml_err_str, std::ostream& resp_stream,
83- std::string* err_msg, uint64_t * real_byte,
82+ std::string* xml_err_str, // 额外的错误信息, 用于响应返回非 2xx 错误码时, 传输报错响应信息
83+ std::ostream& resp_stream, // 流式输出, 用于传输响应正文
84+ std::string* err_msg,
85+ uint64_t * real_byte, // 实际接收字节数
8486 bool is_check_md5 = false ,
8587 bool is_verify_cert = true ,
8688 const std::string& ca_location = " " ,
87- SSLCtxCallback ssl_ctx_cb = nullptr ,
89+ const SSLCtxCallback& ssl_ctx_cb = nullptr ,
8890 void *user_data = nullptr );
8991};
9092
0 commit comments