Browse Source

provide a minimal 404 page

miguelfreitas
Miguel Freitas 9 years ago
parent
commit
b5e58adef2
  1. 8
      src/bitcoinrpc.cpp

8
src/bitcoinrpc.cpp

@ -1055,7 +1055,13 @@ void ServiceConnection(AcceptedConnection *conn)
conn->stream() << HTTPReply(HTTP_OK, str, false, contentType) << std::flush; conn->stream() << HTTPReply(HTTP_OK, str, false, contentType) << std::flush;
} else { } else {
printf("ServiceConnection: file %s not found\n", fname.c_str()); printf("ServiceConnection: file %s not found\n", fname.c_str());
conn->stream() << HTTPReply(HTTP_NOT_FOUND, "", false) << std::flush;
ostringstream s;
s << "<html><body>\r\n"
<< "<b>ERROR 404</b><br/>"
<< "ServiceConnection: file '<b>" << fname << "</b>' not found\r\n"
<< "</body></html>\r\n";
conn->stream() << HTTPReply(HTTP_NOT_FOUND, s.str(), false, "text/html; charset=utf-8") << std::flush;
} }
continue; continue;
} }

Loading…
Cancel
Save