curl-library
RE: CURL loops infinitely when cable is pulled out.
Date: Mon, 23 Apr 2007 14:57:25 -0700
Hi,
My code uses just resume from.
I think everywhere else resume from is converted to range even if range
was not specified.
The ConnectionExists executes after that
#ifndef CURL_DISABLE_HTTP
/************************************************************
* RESUME on a HTTP page is a tricky business. First, let's just check
that
* 'range' isn't used, then set the range parameter and leave the
resume as
* it is to inform about this situation for later use. We will then
* "attempt" to resume, and if we're talking to a HTTP/1.1 (or later)
* server, we will get the document resumed. If we talk to a HTTP/1.0
* server, we just fail since we can't rewind the file writing from
within
* this function.
***********************************************************/
if(data->reqdata.resume_from) {
if(!data->reqdata.use_range) {
/* if it already was in use, we just skip this */
data->reqdata.range = aprintf("%" FORMAT_OFF_T "-",
data->reqdata.resume_from);
if(!data->reqdata.range)
return CURLE_OUT_OF_MEMORY;
data->reqdata.rangestringalloc = TRUE; /* mark as allocated */
data->reqdata.use_range = 1; /* switch on range usage */
}
}
#endif
/*************************************************************
* Check the current list of connections to see if we can
* re-use an already existing one or if we have to create a
* new one.
*************************************************************/
/* get a cloned copy of the SSL config situation stored in the
connection struct */
if(!Curl_clone_ssl_config(&data->set.ssl, &conn->ssl_config))
return CURLE_OUT_OF_MEMORY;
/* reuse_fresh is TRUE if we are told to use a new connection by
force, but
we only acknowledge this option if this is not a re-used connection
already (which happens due to follow-location or during a HTTP
authentication phase). */
if(data->set.reuse_fresh && !data->state.this_is_a_follow)
reuse = FALSE;
else
reuse = ConnectionExists(data, conn, &conn_temp);
if(reuse) - has this taken care of.
The else part where my code path went does not.
Thanks,
Sonia.
-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se
[mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Monday, April 23, 2007 2:10 PM
To: libcurl development
Cc: Charlotte Chang; Robert Spath; Shalu Jain
Subject: RE: CURL loops infinitely when cable is pulled out.
On Mon, 23 Apr 2007, Sonia Subramanian wrote:
> 3. In the next session a new CURL object is created and it does a
bunch of
> other things (like head requests) before actually requesting for the
object.
> 4. It looks at the file information and and if the info says partial
it sets
> the CURL resume from, from that byte.
> 5. This worked well in the previous version that I used. (7.15.4).
> 6. In the new version, in this scenario I got http 416.
So why isn't the code around lib/url.c:3712 good enough? It checks if
resume
is set (but not range) and then sets the internal reqdata.range variable
to
point to a suitable just created range string. What's wrong with that
created
string, or when does it go bad?
Does your code by any chance set _both_ resume_from and range?
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2007-04-24