mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
Hopefully this change addresses these two bug reports: 707003 and 706624.
We need to make sure that when we init a 'connectdata' struct and then afterwards check for and re-use another one, we must be careful so that the newly set values are transmitted and used in the surviving connectdata struct.
This commit is contained in:
parent
68bb74d172
commit
56dd2da962
49
lib/url.c
49
lib/url.c
@ -1806,42 +1806,32 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
conn->bits.httpproxy = (data->change.proxy && *data->change.proxy &&
|
conn->bits.httpproxy = (data->change.proxy && *data->change.proxy &&
|
||||||
(data->set.proxytype == CURLPROXY_HTTP))?
|
(data->set.proxytype == CURLPROXY_HTTP))?
|
||||||
TRUE:FALSE; /* http proxy or not */
|
TRUE:FALSE; /* http proxy or not */
|
||||||
conn->bits.use_range = data->set.set_range?TRUE:FALSE; /* range status */
|
|
||||||
conn->range = data->set.set_range; /* clone the range setting */
|
|
||||||
conn->resume_from = data->set.set_resume_from; /* inherite resume_from */
|
|
||||||
|
|
||||||
/* Default protocol-independent behavior doesn't support persistant
|
/* Default protocol-independent behavior doesn't support persistant
|
||||||
connections, so we set this to force-close. Protocols that support
|
connections, so we set this to force-close. Protocols that support
|
||||||
this need to set this to FALSE in their "curl_do" functions. */
|
this need to set this to FALSE in their "curl_do" functions. */
|
||||||
conn->bits.close = TRUE;
|
conn->bits.close = TRUE;
|
||||||
|
|
||||||
/* inherite initial knowledge from the data struct */
|
|
||||||
conn->bits.user_passwd = data->set.userpwd?1:0;
|
|
||||||
conn->bits.proxy_user_passwd = data->set.proxyuserpwd?1:0;
|
|
||||||
|
|
||||||
/* maxdownload must be -1 on init, as 0 is a valid value! */
|
/* maxdownload must be -1 on init, as 0 is a valid value! */
|
||||||
conn->maxdownload = -1; /* might have been used previously! */
|
conn->maxdownload = -1; /* might have been used previously! */
|
||||||
|
|
||||||
/* Store creation time to help future close decision making */
|
/* Store creation time to help future close decision making */
|
||||||
conn->created = Curl_tvnow();
|
conn->created = Curl_tvnow();
|
||||||
|
|
||||||
|
conn->bits.use_range = data->set.set_range?TRUE:FALSE; /* range status */
|
||||||
|
conn->range = data->set.set_range; /* clone the range setting */
|
||||||
|
conn->resume_from = data->set.set_resume_from; /* inherite resume_from */
|
||||||
|
|
||||||
/* Set the start time temporary to this creation time to allow easier
|
/* Set the start time temporary to this creation time to allow easier
|
||||||
timeout checks before the transfer has started for real. The start time
|
timeout checks before the transfer has started for real. The start time
|
||||||
is later set "for real" using Curl_pgrsStartNow(). */
|
is later set "for real" using Curl_pgrsStartNow(). */
|
||||||
conn->data->progress.start = conn->created;
|
conn->data->progress.start = conn->created;
|
||||||
|
|
||||||
conn->bits.upload_chunky =
|
conn->bits.user_passwd = data->set.userpwd?1:0;
|
||||||
((conn->protocol&PROT_HTTP) &&
|
conn->bits.proxy_user_passwd = data->set.proxyuserpwd?1:0;
|
||||||
data->set.upload &&
|
|
||||||
(data->set.infilesize == -1) &&
|
|
||||||
(data->set.httpversion != CURL_HTTP_VERSION_1_0))?
|
|
||||||
/* HTTP, upload, unknown file size and not HTTP 1.0 */
|
|
||||||
TRUE:
|
|
||||||
/* else, no chunky upload */
|
|
||||||
FALSE;
|
|
||||||
|
|
||||||
conn->fread = data->set.fread;
|
/* This initing continues below, see the comment "Continue connectdata
|
||||||
conn->fread_in = data->set.in;
|
* initialization here" */
|
||||||
|
|
||||||
/***********************************************************
|
/***********************************************************
|
||||||
* We need to allocate memory to store the path in. We get the size of the
|
* We need to allocate memory to store the path in. We get the size of the
|
||||||
@ -2631,8 +2621,14 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
char *ppath = old_conn->ppath; /* this is the modified path pointer */
|
char *ppath = old_conn->ppath; /* this is the modified path pointer */
|
||||||
if(old_conn->proxyhost)
|
if(old_conn->proxyhost)
|
||||||
free(old_conn->proxyhost);
|
free(old_conn->proxyhost);
|
||||||
|
|
||||||
conn = conn_temp; /* use this connection from now on */
|
conn = conn_temp; /* use this connection from now on */
|
||||||
|
|
||||||
|
/* get the user+password information from the old_conn struct since it may
|
||||||
|
* be new for this request even when we re-use an existing connection */
|
||||||
|
conn->bits.user_passwd = old_conn->bits.user_passwd;
|
||||||
|
conn->bits.proxy_user_passwd = conn->bits.proxy_user_passwd;
|
||||||
|
|
||||||
/* If we speak over a proxy, we need to copy the host name too, as it
|
/* If we speak over a proxy, we need to copy the host name too, as it
|
||||||
might be another remote host even when re-using a connection */
|
might be another remote host even when re-using a connection */
|
||||||
strcpy(conn->gname, old_conn->gname); /* safe strcpy() */
|
strcpy(conn->gname, old_conn->gname); /* safe strcpy() */
|
||||||
@ -2690,6 +2686,23 @@ static CURLcode CreateConnection(struct SessionHandle *data,
|
|||||||
ConnectionStore(data, conn);
|
ConnectionStore(data, conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Continue connectdata initialization here.
|
||||||
|
*
|
||||||
|
* Inherit the proper values from the urldata struct AFTER we have arranged
|
||||||
|
* the persistant conncetion stuff */
|
||||||
|
conn->fread = data->set.fread;
|
||||||
|
conn->fread_in = data->set.in;
|
||||||
|
|
||||||
|
conn->bits.upload_chunky =
|
||||||
|
((conn->protocol&PROT_HTTP) &&
|
||||||
|
data->set.upload &&
|
||||||
|
(data->set.infilesize == -1) &&
|
||||||
|
(data->set.httpversion != CURL_HTTP_VERSION_1_0))?
|
||||||
|
/* HTTP, upload, unknown file size and not HTTP 1.0 */
|
||||||
|
TRUE:
|
||||||
|
/* else, no chunky upload */
|
||||||
|
FALSE;
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
* Set timeout if that is being used
|
* Set timeout if that is being used
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
Loading…
Reference in New Issue
Block a user