From b5e58adef2ff2621a24ec28dedcf3bde45b7518a Mon Sep 17 00:00:00 2001 From: Miguel Freitas Date: Mon, 9 Nov 2015 12:05:09 -0200 Subject: [PATCH] provide a minimal 404 page --- src/bitcoinrpc.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index 392be102..dbedce51 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -1055,7 +1055,13 @@ void ServiceConnection(AcceptedConnection *conn) conn->stream() << HTTPReply(HTTP_OK, str, false, contentType) << std::flush; } else { printf("ServiceConnection: file %s not found\n", fname.c_str()); - conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush; + + ostringstream s; + s << "\r\n" + << "ERROR 404
" + << "ServiceConnection: file '" << fname << "' not found\r\n" + << "\r\n"; + conn->stream() << HTTPReply(HTTP_NOT_FOUND, s.str(), false, "text/html; charset=utf-8") << std::flush; } continue; }