Asynchronous HTTP request (Poco-based). Configure headers/body, call submit(), then receive the response through Network::pump as a NetEvType::HttpResp completion. 更多...
#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 ()=default | |
| 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. | |
| bool | submit () |
| Queues the request on the worker; true when accepted. | |
| Network * | network () const |
| Owning module. | |
详细描述
Asynchronous HTTP request (Poco-based). Configure headers/body, call submit(), then receive the response through Network::pump as a NetEvType::HttpResp completion.
在文件 HttpRequest.h 第 24 行定义.
构造及析构函数说明
◆ HttpRequest()
| 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 第 19 行定义.
◆ ~HttpRequest()
|
default |
成员函数说明
◆ network()
|
inline |
Owning module.
在文件 HttpRequest.h 第 44 行定义.
◆ setBody()
| void eve::network::HttpRequest::setBody | ( | eve::data::ByteData * | data | ) |
◆ setBodyString()
| void eve::network::HttpRequest::setBodyString | ( | std::string | s | ) |
◆ 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 第 40 行定义.
◆ setVerifySsl()
| void eve::network::HttpRequest::setVerifySsl | ( | bool | verify | ) |
Overrides TLS verification for this request.
在文件 HttpRequest.cpp 第 44 行定义.
◆ submit()
| bool eve::network::HttpRequest::submit | ( | ) |
Queues the request on the worker; true when accepted.
在文件 HttpRequest.cpp 第 48 行定义.
引用了 body, c, eve::network::Err, eve::network::Network::getTimeout(), eve::network::Network::getVerifySsl(), eve::network::Http, eve::network::HttpResp, eve::network::NetCompletion::kind , 以及 os.
该类的文档由以下文件生成:
- src/modules/network/HttpRequest.h
- src/modules/network/HttpRequest.cpp