File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11//
22// HTTPSession.h
33//
4- // $Id: //poco/svn /Net/include/Poco/Net/HTTPSession.h#2 $
4+ // $Id: //poco/Main /Net/include/Poco/Net/HTTPSession.h#5 $
55//
66// Library: Net
77// Package: HTTP
@@ -140,6 +140,9 @@ class Net_API HTTPSession
140140
141141 int receive (char * buffer, int length);
142142 // / Reads up to length bytes.
143+
144+ int buffered () const ;
145+ // / Returns the number of bytes in the buffer.
143146
144147 StreamSocket& socket ();
145148 // / Returns a reference to the underlying socket.
@@ -208,6 +211,12 @@ inline const Poco::Exception* HTTPSession::networkException() const
208211}
209212
210213
214+ inline int HTTPSession::buffered () const
215+ {
216+ return static_cast <int >(_pEnd - _pCurrent);
217+ }
218+
219+
211220} } // namespace Poco::Net
212221
213222
Original file line number Diff line number Diff line change 11//
22// HTTPServerSession.cpp
33//
4- // $Id: //poco/svn /Net/src/HTTPServerSession.cpp#2 $
4+ // $Id: //poco/Main /Net/src/HTTPServerSession.cpp#9 $
55//
66// Library: Net
77// Package: HTTPServer
@@ -70,7 +70,7 @@ bool HTTPServerSession::hasMoreRequests()
7070 {
7171 if (_maxKeepAliveRequests > 0 )
7272 --_maxKeepAliveRequests;
73- return socket ().poll (_keepAliveTimeout, Socket::SELECT_READ);
73+ return buffered () > 0 || socket ().poll (_keepAliveTimeout, Socket::SELECT_READ);
7474 }
7575 else return false ;
7676}
You can’t perform that action at this time.
0 commit comments