mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-09-12 13:42:10 +02:00
Add helper methods to HTTPRequest to match original API
These methods are called by http_request_cb() and are present in the original http_libevent::HTTPRequest.
This commit is contained in:
@@ -322,6 +322,16 @@ public:
|
||||
{
|
||||
WriteReply(status, std::as_bytes(std::span{reply_body_view}));
|
||||
}
|
||||
|
||||
// These methods reimplement the API from http_libevent::HTTPRequest
|
||||
// for downstream JSONRPC and REST modules.
|
||||
std::string GetURI() const { return m_target; }
|
||||
CService GetPeer() const;
|
||||
HTTPRequestMethod GetRequestMethod() const { return m_method; }
|
||||
std::optional<std::string> GetQueryParameter(std::string_view key) const;
|
||||
std::pair<bool, std::string> GetHeader(std::string_view hdr) const;
|
||||
std::string ReadBody() const { return m_body; }
|
||||
void WriteHeader(std::string&& hdr, std::string&& value);
|
||||
};
|
||||
|
||||
class HTTPServer
|
||||
@@ -520,6 +530,8 @@ private:
|
||||
void DisconnectClients();
|
||||
};
|
||||
|
||||
std::optional<std::string> GetQueryParameterFromUri(std::string_view uri, std::string_view key);
|
||||
|
||||
class HTTPRemoteClient
|
||||
{
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user