Asynchronous HTTP request (Poco-based). Configure headers/body, call submit(), then receive the response through Network::pump as a NetEvType::HttpResp completion. @ownership Owns its configuration and body; borrows its Network. @lifetime Destruction cancels results not yet pumped. Keep the handle alive until consuming events already queued by pump(); copies copy configuration only. @thread Configure, submit and destroy on the Network owner thread. @reentrancy No user callbacks run from the HTTP executor. 更多...
#include <HttpRequest.h>
Public 成员函数 | |
| HttpRequest (Network *net, std::string method, std::string url) | |
| Creates a request; method is e.g. "GET"/"POST", url is absolute. | |
| ~HttpRequest () | |
| Drops undelivered results; in-flight I/O finishes under its timeout. | |
| HttpRequest (const HttpRequest &other) | |
| Copies configuration and the borrowed module, without copying jobs. | |
| HttpRequest & | operator= (const HttpRequest &other) |
| Cancels this handle's jobs before copying the other configuration. | |
| void | setHeader (std::string k, std::string v) |
| Sets one request header. | |
| void | setBody (eve::data::ByteData *data) |
| Sets the request body bytes. | |
| void | setBodyString (std::string s) |
| Sets the request body as a string. | |
| void | setTimeout (int ms) |
| Overrides the module default timeout for this request (ms). | |
| void | setVerifySsl (bool verify) |
| Overrides TLS verification for this request. | |
| void | setCaLocation (std::string location) |
| Overrides the CA file or hashed CA directory with an owning UTF-8 path. Empty selects system/default trust; an unset override inherits the module. The custom trust source is exclusive. Applied to subsequent submissions. @cost Copies a path per configuration change; certificate loading occurs on submit's job. | |
| bool | submit () |
| Queues an immutable request snapshot; true reports acceptance only. @cost Starts a thread and performs network I/O per submission; final results arrive through pump(). | |
| Network * | network () const |
| Returns the live module, or null after module destruction. @ownership Borrowed; the Network owner retains ownership. @lifetime Owner thread only; valid until the module is destroyed. | |
详细描述
Asynchronous HTTP request (Poco-based). Configure headers/body, call submit(), then receive the response through Network::pump as a NetEvType::HttpResp completion. @ownership Owns its configuration and body; borrows its Network. @lifetime Destruction cancels results not yet pumped. Keep the handle alive until consuming events already queued by pump(); copies copy configuration only. @thread Configure, submit and destroy on the Network owner thread. @reentrancy No user callbacks run from the HTTP executor.
在文件 HttpRequest.h 第 33 行定义.
构造及析构函数说明
◆ HttpRequest() [1/2]
| eve::network::HttpRequest::HttpRequest | ( | Network * | net, |
| std::string | method, | ||
| std::string | url | ||
| ) |
Creates a request; method is e.g. "GET"/"POST", url is absolute.
在文件 HttpRequest.cpp 第 254 行定义.
◆ ~HttpRequest()
| eve::network::HttpRequest::~HttpRequest | ( | ) |
Drops undelivered results; in-flight I/O finishes under its timeout.
在文件 HttpRequest.cpp 第 259 行定义.
◆ HttpRequest() [2/2]
| eve::network::HttpRequest::HttpRequest | ( | const HttpRequest & | other | ) |
Copies configuration and the borrowed module, without copying jobs.
在文件 HttpRequest.cpp 第 262 行定义.
成员函数说明
◆ network()
| Network * eve::network::HttpRequest::network | ( | ) | const |
Returns the live module, or null after module destruction. @ownership Borrowed; the Network owner retains ownership. @lifetime Owner thread only; valid until the module is destroyed.
在文件 HttpRequest.cpp 第 288 行定义.
◆ operator=()
| HttpRequest & eve::network::HttpRequest::operator= | ( | const HttpRequest & | other | ) |
Cancels this handle's jobs before copying the other configuration.
在文件 HttpRequest.cpp 第 273 行定义.
◆ setBody()
| void eve::network::HttpRequest::setBody | ( | eve::data::ByteData * | data | ) |
◆ setBodyString()
| void eve::network::HttpRequest::setBodyString | ( | std::string | s | ) |
Sets the request body as a string.
在文件 HttpRequest.cpp 第 301 行定义.
引用了 body.
被这些函数引用 eve::network::Network::httpRequest().
◆ setCaLocation()
| void eve::network::HttpRequest::setCaLocation | ( | std::string | location | ) |
Overrides the CA file or hashed CA directory with an owning UTF-8 path. Empty selects system/default trust; an unset override inherits the module. The custom trust source is exclusive. Applied to subsequent submissions. @cost Copies a path per configuration change; certificate loading occurs on submit's job.
在文件 HttpRequest.cpp 第 306 行定义.
◆ setHeader()
| void eve::network::HttpRequest::setHeader | ( | std::string | k, |
| std::string | v | ||
| ) |
◆ setTimeout()
| void eve::network::HttpRequest::setTimeout | ( | int | ms | ) |
Overrides the module default timeout for this request (ms).
在文件 HttpRequest.cpp 第 304 行定义.
被这些函数引用 eve::network::Network::httpRequest().
◆ setVerifySsl()
| void eve::network::HttpRequest::setVerifySsl | ( | bool | verify | ) |
Overrides TLS verification for this request.
在文件 HttpRequest.cpp 第 305 行定义.
◆ submit()
| bool eve::network::HttpRequest::submit | ( | ) |
Queues an immutable request snapshot; true reports acceptance only. @cost Starts a thread and performs network I/O per submission; final results arrive through pump().
在文件 HttpRequest.cpp 第 308 行定义.
引用了 eve::network::HttpRuntime::Accepted , 以及 options.
被这些函数引用 eve::network::Network::httpRequest().
该类的文档由以下文件生成:
- src/modules/network/HttpRequest.h
- src/modules/network/HttpRequest.cpp