aboutsummaryrefslogtreecommitdiff
path: root/src/httpserver.cpp
diff options
context:
space:
mode:
authorpracticalswift <practicalswift@users.noreply.github.com>2018-10-31 11:42:01 +0100
committerpracticalswift <practicalswift@users.noreply.github.com>2018-11-05 13:27:02 +0100
commit991248649b76a5a071e1360a700f3e2ecf3e1e1f (patch)
treee147a5a52931d8eba9c3d8831d3ff136e5002673 /src/httpserver.cpp
parent76ae7a1ac9b18437e89b54fa23bc22cff507ad42 (diff)
rpc: Make HTTP RPC debug logging more informative
Diffstat (limited to 'src/httpserver.cpp')
-rw-r--r--src/httpserver.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/httpserver.cpp b/src/httpserver.cpp
index 60e7b917d0..b327af3f19 100644
--- a/src/httpserver.cpp
+++ b/src/httpserver.cpp
@@ -224,21 +224,25 @@ static void http_request_cb(struct evhttp_request* req, void* arg)
}
std::unique_ptr<HTTPRequest> hreq(new HTTPRequest(req));
- LogPrint(BCLog::HTTP, "Received a %s request for %s from %s\n",
- RequestMethodString(hreq->GetRequestMethod()), hreq->GetURI(), hreq->GetPeer().ToString());
-
// Early address-based allow check
if (!ClientAllowed(hreq->GetPeer())) {
+ LogPrint(BCLog::HTTP, "HTTP request from %s rejected: Client network is not allowed RPC access\n",
+ hreq->GetPeer().ToString());
hreq->WriteReply(HTTP_FORBIDDEN);
return;
}
// Early reject unknown HTTP methods
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);
return;
}
+ LogPrint(BCLog::HTTP, "Received a %s request for %s from %s\n",
+ RequestMethodString(hreq->GetRequestMethod()), SanitizeString(hreq->GetURI()).substr(0, 100), hreq->GetPeer().ToString());
+
// Find registered handler for prefix
std::string strURI = hreq->GetURI();
std::string path;