62 virtual bool has_delimiters()
const
95 void request(
const std::string& aUrl,
type_e aType =
Get,
const headers_t& aRequestHeaders =
headers_t(),
const std::variant<body_t, std::string>& aRequestBody = std::string());
96 void request(
const std::string& aHost,
const std::string& aResource,
type_e aType =
Get,
unsigned short aPort = 80,
bool aSecure =
false,
const headers_t& aRequestHeaders =
headers_t(),
const std::variant<body_t, std::string>& aRequestBody = std::string());
97 bool ok()
const {
return iOk; }
99 uint64_t
body_length()
const {
return iBodyLength ? *iBodyLength : iBody.size(); }
103 std::string
body_as_string()
const {
return std::string(iBody.begin(), iBody.end()); }
110 void add_response_header(
const std::string& aHeaderLine);
112 bool decode_chunked();
113 void connection_established();
114 void connection_failure(
const boost::system::error_code& aError);
117 void transfer_failure(
const boost::system::error_code& aError);
118 void connection_closed();
123 std::optional<http_stream> iPacketStream;
128 std::string iResource;
131 std::string iResponseLine;
132 std::string iResponseStatus;
134 headers_t::iterator iLastResponseHeader;
136 uint32_t iStatusCode;
137 std::optional<uint64_t> iBodyLength;
139 enum state { ResponseStatus, ResponseHeaders, Body, Finished } iState;
140 bool iPreviousWasCRLF;
141 std::optional<std::chrono::time_point<std::chrono::steady_clock>> iLastPacketReceived;
std::basic_string< CharType > contents_type
http_packet(const contents_type &aContents=contents_type())
const std::string & response_status() const
http(async_task &aIoTask)
double percent_done() const
bool operator==(const http &) const
std::map< ci_string, std::string > headers_t
const headers_t & response_headers() const
std::string body_as_string() const
uint64_t body_length() const
define_event(Started, started) define_event(Progress
uint32_t status_code() const
const body_t & body() const
void request(const std::string &aHost, const std::string &aResource, type_e aType=Get, unsigned short aPort=80, bool aSecure=false, const headers_t &aRequestHeaders=headers_t(), const std::variant< body_t, std::string > &aRequestBody=std::string())
http & operator=(const http &aOther)
void request(const std::string &aUrl, type_e aType=Get, const headers_t &aRequestHeaders=headers_t(), const std::variant< body_t, std::string > &aRequestBody=std::string())
std::vector< char > body_t
std::basic_string< char, ci_char_traits< std::char_traits< char > > > ci_string
packet_stream< http_packet, tcp_protocol > http_stream
#define define_event(name, declName,...)