Overview
Features
Download
Documentation
Community
Add-Ons & Services

About HTTPClientSession creates persistent connection

Please post support and help requests here.

About HTTPClientSession creates persistent connection

Postby kevin00000000ex » 05 Jan 2013, 11:07

I create a persistent connection to a http server with HTTPClientSession object. When I receive the http response the isteam state change to badbit and then I call the HTTPpClientSession.reset() function to close current http connection.
I send the next http request with a new connection.But when I receive the http response I find I have received the residual http response correspond to the last request and the HTTPClientSession.receiveResponse ()function throw a exception, the exception.what() is "Malformed message: No HTTP response header".
I search the reason and find the residual http response is in the HTTPSession._pBuffer member variable.

So my question is why not emptied the _pBuffer through HTTPClientSession.reset() function in POCO completion. What should I do to solve the question?
kevin00000000ex
 
Posts: 7
Joined: 26 Dec 2012, 02:14

Re: About HTTPClientSession creates persistent connection

Postby alex » 07 Jan 2013, 16:57

kevin00000000ex wrote:So my question is why not emptied the _pBuffer through HTTPClientSession.reset() function in POCO completion.

I could be missing something but probably should be emptied.
kevin00000000ex wrote:What should I do to solve the question?

As things are now, I'd add something like HTTPSession::clear() and modify HTTPClientSession::reset() function to:

Code: Select all
HTTPClientSession::reset(bool resetBuf = false)
{
  close();
  if (resetBuf) clear();
}

If you can test this on your case and submit a patch (or, even better, a github pull request) with unit test, we may be able to squeeze it in 1.5.1 later this week.
alex
 
Posts: 1047
Joined: 11 Jul 2006, 16:27
Location: United_States

Re: About HTTPClientSession creates persistent connection

Postby kevin00000000ex » 10 Jan 2013, 15:29

alex wrote:
kevin00000000ex wrote:So my question is why not emptied the _pBuffer through HTTPClientSession.reset() function in POCO completion.

I could be missing something but probably should be emptied.
kevin00000000ex wrote:What should I do to solve the question?

As things are now, I'd add something like HTTPSession::clear() and modify HTTPClientSession::reset() function to:

Code: Select all
HTTPClientSession::reset(bool resetBuf = false)
{
  close();
  if (resetBuf) clear();
}

If you can test this on your case and submit a patch (or, even better, a github pull request) with unit test, we may be able to squeeze it in 1.5.1 later this week.


My solution is similar with yours.To avoid unnecessary bug, I add a member function named release and clear buf in it.Now I'm testing it
kevin00000000ex
 
Posts: 7
Joined: 26 Dec 2012, 02:14


Return to Support

Who is online

Users browsing this forum: No registered users and 2 guests

cron