mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
http: Implement HTTPResponse class
HTTP Response message: https://datatracker.ietf.org/doc/html/rfc1945#section-6 Status line (first line of response): https://datatracker.ietf.org/doc/html/rfc1945#section-6.1 Status code definitions: https://datatracker.ietf.org/doc/html/rfc1945#section-9
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <span>
|
||||
#include <string>
|
||||
|
||||
#include <rpc/protocol.h>
|
||||
#include <util/strencodings.h>
|
||||
#include <util/string.h>
|
||||
|
||||
@@ -234,6 +235,29 @@ private:
|
||||
*/
|
||||
std::vector<std::pair<std::string, std::string>> m_headers;
|
||||
};
|
||||
|
||||
struct HTTPVersion {
|
||||
/**
|
||||
* Default HTTP protocol version 1.1 is used by error responses
|
||||
* when a request is unreadable.
|
||||
*/
|
||||
/// @{
|
||||
uint8_t major{1};
|
||||
uint8_t minor{1};
|
||||
/// @}
|
||||
};
|
||||
|
||||
|
||||
class HTTPResponse
|
||||
{
|
||||
public:
|
||||
HTTPVersion m_version;
|
||||
|
||||
HTTPStatusCode m_status{HTTP_INTERNAL_SERVER_ERROR};
|
||||
HTTPHeaders m_headers;
|
||||
|
||||
std::string StringifyHeaders() const;
|
||||
};
|
||||
} // namespace http_bitcoin
|
||||
|
||||
#endif // BITCOIN_HTTPSERVER_H
|
||||
|
||||
Reference in New Issue
Block a user