Commit 001c561b authored by Mathieu Stefani's avatar Mathieu Stefani

The default handler now returns an HTTP 500 when an exception occurs

parent 493c8fe0
......@@ -449,13 +449,12 @@ Response::writeTo(Tcp::Peer& peer)
void
Handler::onInput(const char* buffer, size_t len, Tcp::Peer& peer) {
try {
auto& parser = getParser(peer);
if (!parser.feed(buffer, len)) {
cout << "Could not feed parser bro" << endl;
throw HttpError(Code::Request_Entity_Too_Large, "Request exceeded maximum buffer size");
}
else {
try {
auto state = parser.parse();
if (state == Private::Parser::State::Done) {
onRequest(parser.request, peer);
......@@ -469,7 +468,6 @@ Handler::onInput(const char* buffer, size_t len, Tcp::Peer& peer) {
Response response(Code::Internal_Server_Error, e.what());
response.writeTo(peer);
}
}
}
void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment