integrated changes from main repository

This commit is contained in:
Guenter Obiltschnig
2006-12-27 15:16:22 +00:00
parent 13f73441e2
commit d9d531350d
9 changed files with 113 additions and 17 deletions

View File

@@ -1,7 +1,7 @@
//
// HTTPRequest.cpp
//
// $Id: //poco/1.3/Net/src/HTTPRequest.cpp#1 $
// $Id: //poco/1.3/Net/src/HTTPRequest.cpp#2 $
//
// Library: Net
// Package: HTTP
@@ -211,10 +211,10 @@ void HTTPRequest::read(std::istream& istr)
while (isspace(ch)) ch = istr.get();
if (ch == eof) throw MessageException("No HTTP request header");
while (!isspace(ch) && ch != eof && method.length() < MAX_METHOD_LENGTH) { method += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("HTTP request method too long");
if (!isspace(ch)) throw MessageException("HTTP request method invalid or too long");
while (isspace(ch)) ch = istr.get();
while (!isspace(ch) && ch != eof && uri.length() < MAX_URI_LENGTH) { uri += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("HTTP request URI too long");
if (!isspace(ch)) throw MessageException("HTTP request URI invalid or too long");
while (isspace(ch)) ch = istr.get();
while (!isspace(ch) && ch != eof && version.length() < MAX_VERSION_LENGTH) { version += (char) ch; ch = istr.get(); }
if (!isspace(ch)) throw MessageException("Invalid HTTP version string");

View File

@@ -1,7 +1,7 @@
//
// HTTPServerSession.cpp
//
// $Id: //poco/1.3/Net/src/HTTPServerSession.cpp#1 $
// $Id: //poco/1.3/Net/src/HTTPServerSession.cpp#2 $
//
// Library: Net
// Package: HTTPServer
@@ -64,9 +64,10 @@ bool HTTPServerSession::hasMoreRequests()
--_maxKeepAliveRequests;
return socket().poll(getTimeout(), Socket::SELECT_READ);
}
else if (_maxKeepAliveRequests > 0 && getKeepAlive())
else if (_maxKeepAliveRequests != 0 && getKeepAlive())
{
--_maxKeepAliveRequests;
if (_maxKeepAliveRequests > 0)
--_maxKeepAliveRequests;
return socket().poll(_keepAliveTimeout, Socket::SELECT_READ);
}
else return false;