From aff2748f8aee72f03b5fb6f6f97f0d0f66391755 Mon Sep 17 00:00:00 2001 From: Filip Gospodinov Date: Tue, 18 Feb 2020 08:29:35 +0100 Subject: httpserver: use own HTTP status codes Before, macros defined in `` have been used for some HTTP status codes. `` 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 `` is consistently used for all HTTP response implementations. --- src/httpserver.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/httpserver.cpp') diff --git a/src/httpserver.cpp b/src/httpserver.cpp index 0e13b85806..11d73b7c9a 100644 --- a/src/httpserver.cpp +++ b/src/httpserver.cpp @@ -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. } -- cgit v1.2.3