Patches item #1616294, was opened at 2006-12-15 11:56
Message generated for change (Settings changed) made by obiltschnig
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=725711&aid=1616294&group_id=132964
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
>Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: KeepAlive HTTPServerSession patch
Initial Comment:
>From documentation on Poco::Net::HTTPServerParams:
<citate>
void setMaxKeepAliveRequests(int maxKeepAliveRequests);
Specifies the maximun number of requests allowed during a persistent connection. 0 means unlimited connections.
</citate>
But really when I set maxKeepAliveRequests to 0 server allow only one request per session. I submitt patch, that solve this problem.
---
Submitted by Sergey N. Yatskevich<sncc@...>
----------------------------------------------------------------------
Comment By: Guenter Obiltschnig (obiltschnig)
Date: 2007-02-23 15:52
Message:
Logged In: YES
user_id=1148207
Originator: NO
I have updated the Trunk in SVN with our latest sources.
----------------------------------------------------------------------
Comment By: Alex Fabijanic (aleksf)
Date: 2007-02-23 00:36
Message:
Logged In: YES
user_id=1001095
Originator: NO
I have discovered later that my problem was actually caused by a call to
redirect(). I'll see if it happens again after the patches. I am assuming
that the patches will show up in SVN trunk as well.
----------------------------------------------------------------------
Comment By: Guenter Obiltschnig (obiltschnig)
Date: 2007-02-22 10:22
Message:
Logged In: YES
user_id=1148207
Originator: NO
Actually the patch was correct. _maxKeepAliveRequests == 0 means unlimited
requests. In the first request, this is decremented to -1, which in the
following requests satisfy the test for _maxKeepAliveRequests != 0. The
problem Alex observes probably comes from somewhere else. We have recently
added lots of fixes to persistent connection handling that solve the
problem observed by Alex.
----------------------------------------------------------------------
Comment By: Alex Fabijanic (aleksf)
Date: 2007-02-12 18:50
Message:
Logged In: YES
user_id=1001095
Originator: NO
Due to the change from '(_maxKeepAliveRequests > 0)' to
'(_maxKeepAliveRequests != 0)', there should be a check for > 0 before
decrementing _maxKeepAliveRequests member on first request. Otherwise,
hasMoreRequests() will return true in second call for case when
_maxKeepAliveRequests is initially set to zero and on first request
decremented to -1. This causes HTTPServerConnection::run() to re-enter
another loop iteration and ultimately causes HTTPRequest::read to throw.
Here's the code:
bool HTTPServerSession::hasMoreRequests()
{
if (_firstRequest)
{
_firstRequest = false;
if (_maxKeepAliveRequests > 0) //this line added
--_maxKeepAliveRequests;
return socket().poll(getTimeout(),Socket::SELECT_READ);
}
else if (_maxKeepAliveRequests != 0 && getKeepAlive())
{
if (_maxKeepAliveRequests > 0)
--_maxKeepAliveRequests;
return socket().poll(_keepAliveTimeout,Socket::SELECT_READ);
}
else return false;
}
----------------------------------------------------------------------
Comment By: Guenter Obiltschnig (obiltschnig)
Date: 2006-12-27 11:26
Message:
Logged In: YES
user_id=1148207
Originator: NO
thanks, I have incorporated the patch into the code base
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=725711&aid=1616294&group_id=132964
|