mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-20 22:31:23 +01:00
improved HTTP server handling of errors while reading header
This commit is contained in:
parent
2e657d2a61
commit
cc52a8a3db
@ -209,6 +209,7 @@ void HTTPRequest::read(std::istream& istr)
|
||||
uri.reserve(64);
|
||||
version.reserve(16);
|
||||
int ch = istr.get();
|
||||
if (istr.bad()) throw NetException("Error reading HTTP request header");
|
||||
if (ch == eof) throw NoMessageException();
|
||||
while (Poco::Ascii::isSpace(ch)) ch = istr.get();
|
||||
if (ch == eof) throw MessageException("No HTTP request header");
|
||||
|
@ -113,6 +113,14 @@ void HTTPServerConnection::run()
|
||||
{
|
||||
sendErrorResponse(session, HTTPResponse::HTTP_BAD_REQUEST);
|
||||
}
|
||||
catch (Poco::Exception&)
|
||||
{
|
||||
if (session.networkException())
|
||||
{
|
||||
session.networkException()->rethrow();
|
||||
}
|
||||
else throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user