mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-03 09:56:38 -05:00
httpserver: use own HTTP status codes
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.
This commit is contained in:
parent
36f42e1bf4
commit
aff2748f8a
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) {
|
if (hreq->GetRequestMethod() == HTTPRequest::UNKNOWN) {
|
||||||
LogPrint(BCLog::HTTP, "HTTP request from %s rejected: Unknown HTTP request method\n",
|
LogPrint(BCLog::HTTP, "HTTP request from %s rejected: Unknown HTTP request method\n",
|
||||||
hreq->GetPeer().ToString());
|
hreq->GetPeer().ToString());
|
||||||
hreq->WriteReply(HTTP_BADMETHOD);
|
hreq->WriteReply(HTTP_BAD_METHOD);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,10 +268,10 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
|
||||||
item.release(); /* if true, queue took ownership */
|
item.release(); /* if true, queue took ownership */
|
||||||
else {
|
else {
|
||||||
LogPrintf("WARNING: request rejected because http work queue depth exceeded, it can be increased with the -rpcworkqueue= setting\n");
|
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 {
|
} else {
|
||||||
hreq->WriteReply(HTTP_NOTFOUND);
|
hreq->WriteReply(HTTP_NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ HTTPRequest::~HTTPRequest()
|
||||||
if (!replySent) {
|
if (!replySent) {
|
||||||
// Keep track of whether reply was sent to avoid request leaks
|
// Keep track of whether reply was sent to avoid request leaks
|
||||||
LogPrintf("%s: Unhandled request\n", __func__);
|
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.
|
// evhttpd cleans up the request, as long as a reply was sent.
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue