cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: Unable to retrieve some document header

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 19 Oct 2001 10:09:43 +0200 (MET DST)

On Wed, 17 Oct 2001, Yanick Pelletier wrote:

(CC'ing this to the libcurl list, where it belongs....)

> > When you issue the second request, you'll get the same connection that
> > was previously in use (a persistant connection) and the server is still
> > providing the previous request on that.
> >
> > Does this seem likely?
>
> In fact this is true. I have notice that when a do my second request is
> receive data that in fact are the remains of the first request! So i
> have add the two following options to my connection to force it use a new
> connection.
>
> curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
> curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
>
> This fix the problem, so i always receive the data that i'm asking for.

Yep, that should be it. It should also be OK to either only use the first
option (CURLOPT_FORBID_REUSE) on the first connection or only use the second
option (CURLOPT_FRESH_CONNECT) on the second connection.
>
> > As an experiment, could you try to add code that close the transfer
> > socket if Curl_client_write() returns an error?
>
> I could, but can you gives me an hit of what call to do and where to do
> it, so i don't break anything!!!!

There's no need to. The upcoming pre-release (7.9.1-pre4) will do this. I'd
appriciate if you would try your program without the options set above to see
if we deal with this situation better now.

-- 
    Daniel Stenberg -- curl groks URLs -- http://curl.haxx.se/
Received on 2001-10-19