载入中...
搜索中...
未找到
HttpRequest.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "NetTypes.h"
6
7#include <cstdint>
8#include <map>
9#include <memory>
10#include <optional>
11#include <string>
12#include <vector>
13
14namespace eve::data {
15class ByteData;
16}
17
18namespace eve::network {
19
20class Network;
21class HttpRuntime;
22
34public:
36 HttpRequest(Network* net, std::string method, std::string url);
40 HttpRequest(const HttpRequest& other);
42 HttpRequest& operator=(const HttpRequest& other);
43
45 void setHeader(std::string k, std::string v);
47 void setBody(eve::data::ByteData* data);
49 void setBodyString(std::string s);
51 void setTimeout(int ms);
53 void setVerifySsl(bool verify);
59 void setCaLocation(std::string location);
63 bool submit();
64
69 Network* network() const;
70
71private:
72 Network* net_ = nullptr;
73 std::weak_ptr<HttpRuntime> runtime_;
74 std::string method_;
75 std::string url_;
76 std::map<std::string, std::string> headers_;
77 std::shared_ptr<std::vector<char>> body_;
78 int timeoutMs_ = -1;
79 int verifySsl_ = -1; // -1 = use module default
80 std::optional<std::string> caLocation_;
81};
82
83} // namespace eve::network
const std::string & s
std::uint16_t method
#define EVENGINE_API_PLATFORM
Definition Export.h:107
float v
In-memory byte buffer implementing eve::Data (ref-counted).
Definition ByteData.h:13
Asynchronous HTTP request (Poco-based). Configure headers/body, call submit(), then receive the respo...
Definition HttpRequest.h:33
Network module: TCP/UDP/HTTP factories, background worker, and completion event plumbing....
Definition Network.h:39