Skip to content

Commit df29abf

Browse files
committed
Merge #14006: Add const modifier to HTTPRequest methods
18c49eb http: Add const modifier to HTTPRequest methods (João Barbosa) Pull request description: Tree-SHA512: 233617425ff3abc7419817a95337056c190640197c6c4d8b1a0810967d960c0968d02967e16ffbc1af1a2b3117fdc98722bf05e270504d59548e6838fa7f5ffb
2 parents af4fa72 + 18c49eb commit df29abf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/httpserver.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ HTTPRequest::~HTTPRequest()
536536
// evhttpd cleans up the request, as long as a reply was sent.
537537
}
538538

539-
std::pair<bool, std::string> HTTPRequest::GetHeader(const std::string& hdr)
539+
std::pair<bool, std::string> HTTPRequest::GetHeader(const std::string& hdr) const
540540
{
541541
const struct evkeyvalq* headers = evhttp_request_get_input_headers(req);
542542
assert(headers);
@@ -606,7 +606,7 @@ void HTTPRequest::WriteReply(int nStatus, const std::string& strReply)
606606
req = nullptr; // transferred back to main thread
607607
}
608608

609-
CService HTTPRequest::GetPeer()
609+
CService HTTPRequest::GetPeer() const
610610
{
611611
evhttp_connection* con = evhttp_request_get_connection(req);
612612
CService peer;
@@ -620,12 +620,12 @@ CService HTTPRequest::GetPeer()
620620
return peer;
621621
}
622622

623-
std::string HTTPRequest::GetURI()
623+
std::string HTTPRequest::GetURI() const
624624
{
625625
return evhttp_request_get_uri(req);
626626
}
627627

628-
HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod()
628+
HTTPRequest::RequestMethod HTTPRequest::GetRequestMethod() const
629629
{
630630
switch (evhttp_request_get_command(req)) {
631631
case EVHTTP_REQ_GET:

src/httpserver.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,21 +74,21 @@ class HTTPRequest
7474

7575
/** Get requested URI.
7676
*/
77-
std::string GetURI();
77+
std::string GetURI() const;
7878

7979
/** Get CService (address:ip) for the origin of the http request.
8080
*/
81-
CService GetPeer();
81+
CService GetPeer() const;
8282

8383
/** Get request method.
8484
*/
85-
RequestMethod GetRequestMethod();
85+
RequestMethod GetRequestMethod() const;
8686

8787
/**
8888
* Get the request header specified by hdr, or an empty string.
8989
* Return a pair (isPresent,string).
9090
*/
91-
std::pair<bool, std::string> GetHeader(const std::string& hdr);
91+
std::pair<bool, std::string> GetHeader(const std::string& hdr) const;
9292

9393
/**
9494
* Read request body.

0 commit comments

Comments
 (0)