Kurlyk
Loading...
Searching...
No Matches
HttpResponse.hpp
Go to the documentation of this file.
1#pragma once
2#ifndef _KURLYK_HTTP_RESPONSE_HPP_INCLUDED
3#define _KURLYK_HTTP_RESPONSE_HPP_INCLUDED
4
7
8namespace kurlyk {
9
16 public:
18 std::string content;
19 std::error_code error_code;
20 std::string error_message;
21 long status_code = 0;
22 long retry_attempt = 0;
23 bool ready = false;
24 bool stream_chunk = false;
25
26 // --- Timing metrics (all values in seconds) ---
27 double namelookup_time = -1;
28 double connect_time = -1;
29 double appconnect_time = -1;
30 double pretransfer_time = -1;
31 double starttransfer_time = -1;
32 double total_time = -1;
33 }; // HttpResponse
34
36 using HttpResponsePtr = std::unique_ptr<HttpResponse>;
37
40 using HttpResponseCallback = std::function<void(HttpResponsePtr response)>;
41
42} // namespace kurlyk
43
44#endif // _KURLYK_HTTP_RESPONSE_HPP_INCLUDED
45
Represents an HTTP response.
long retry_attempt
Number of retry attempts performed for this request.
double total_time
Total time of the transfer.
double namelookup_time
Time until name resolution completed (DNS).
Headers headers
HTTP response headers.
double connect_time
Time until TCP connection established.
long status_code
HTTP status code of the response (e.g., 200, 404).
std::string content
Body content of the HTTP response.
std::string error_message
Error message describing the issue, if any.
double pretransfer_time
Time until request is ready to be sent.
double appconnect_time
Time until SSL handshake completed (HTTPS only).
bool stream_chunk
Indicates whether content contains an intermediate streaming body chunk.
std::error_code error_code
Error code indicating response or transport issues, if any.
double starttransfer_time
Time until first byte is received from the server.
bool ready
Indicates whether the response is final and ready to be processed.
Primary namespace for the Kurlyk library, encompassing initialization, request management,...
std::function< void(HttpResponsePtr response)> HttpResponseCallback
Callback invoked with an HTTP response.
std::unique_ptr< HttpResponse > HttpResponsePtr
Owning pointer to an HTTP response.
utils::CaseInsensitiveMultimap Headers
Alias for HTTP headers, providing a case-insensitive unordered multimap.