mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -03:00
Merge #18168: httpserver: use own HTTP status codes
aff2748f8a
httpserver: use own HTTP status codes (Filip Gospodinov) Pull request description: Before, macros defined in `<event2/http.h>` have been used for some HTTP status codes. `<event2/http.h>` is included implicitly and the usage of its status code macros is inconsistent with the majority HTTP response implementations in this file. Now, the `HTTPStatusCode` enum from `<rpc/protocol.h>` is consistently used for all HTTP response implementations. ACKs for top commit: practicalswift: ACKaff2748f8a
-- patch looks correct laanwj: ACKaff2748f8a
Tree-SHA512: 6a7043488b88dcd584215d16b5f16f7bd668fe5553d31298d1beef134d2b0648aef81533014e34d1cd600baa36ee4e853f195352f4a00c866bd5ab1ff688bd50
This commit is contained in:
commit
ac5c5d0162
1 changed files with 4 additions and 4 deletions
|
@ -236,7 +236,7 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
|||
if (hreq->GetRequestMethod() == HTTPRequest::UNKNOWN) {
|
||||
LogPrint(BCLog::HTTP, "HTTP request from %s rejected: Unknown HTTP request method\n",
|
||||
hreq->GetPeer().ToString());
|
||||
hreq->WriteReply(HTTP_BADMETHOD);
|
||||
hreq->WriteReply(HTTP_BAD_METHOD);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -268,10 +268,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
|||
item.release(); /* if true, queue took ownership */
|
||||
else {
|
||||
LogPrintf("WARNING: request rejected because http work queue depth exceeded, it can be increased with the -rpcworkqueue= setting\n");
|
||||
item->req->WriteReply(HTTP_INTERNAL, "Work queue depth exceeded");
|
||||
item->req->WriteReply(HTTP_INTERNAL_SERVER_ERROR, "Work queue depth exceeded");
|
||||
}
|
||||
} else {
|
||||
hreq->WriteReply(HTTP_NOTFOUND);
|
||||
hreq->WriteReply(HTTP_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -519,7 +519,7 @@ HTTPRequest::~HTTPRequest()
|
|||
if (!replySent) {
|
||||
// Keep track of whether reply was sent to avoid request leaks
|
||||
LogPrintf("%s: Unhandled request\n", __func__);
|
||||
WriteReply(HTTP_INTERNAL, "Unhandled request");
|
||||
WriteReply(HTTP_INTERNAL_SERVER_ERROR, "Unhandled request");
|
||||
}
|
||||
// evhttpd cleans up the request, as long as a reply was sent.
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue