fixed SF# 1956300: HTTPServerConnection hanging

This commit is contained in:
Guenter Obiltschnig 2008-05-02 16:41:14 +00:00
parent 2ba1d4181f
commit 4ec68cecaf
2 changed files with 12 additions and 3 deletions

View File

@ -1,7 +1,7 @@
//
// HTTPSession.h
//
// $Id: //poco/svn/Net/include/Poco/Net/HTTPSession.h#2 $
// $Id: //poco/Main/Net/include/Poco/Net/HTTPSession.h#5 $
//
// Library: Net
// Package: HTTP
@ -140,6 +140,9 @@ protected:
int receive(char* buffer, int length);
/// Reads up to length bytes.
int buffered() const;
/// Returns the number of bytes in the buffer.
StreamSocket& socket();
/// Returns a reference to the underlying socket.
@ -208,6 +211,12 @@ inline const Poco::Exception* HTTPSession::networkException() const
}
inline int HTTPSession::buffered() const
{
return static_cast<int>(_pEnd - _pCurrent);
}
} } // namespace Poco::Net

View File

@ -1,7 +1,7 @@
//
// HTTPServerSession.cpp
//
// $Id: //poco/svn/Net/src/HTTPServerSession.cpp#2 $
// $Id: //poco/Main/Net/src/HTTPServerSession.cpp#9 $
//
// Library: Net
// Package: HTTPServer
@ -70,7 +70,7 @@ bool HTTPServerSession::hasMoreRequests()
{
if (_maxKeepAliveRequests > 0)
--_maxKeepAliveRequests;
return socket().poll(_keepAliveTimeout, Socket::SELECT_READ);
return buffered() > 0 || socket().poll(_keepAliveTimeout, Socket::SELECT_READ);
}
else return false;
}