1
0
mirror of https://github.com/moparisthebest/curl synced 2024-08-13 17:03:50 -04:00

When following to a new URL, we must make sure to call Curl_done() first,

since the current connection must be taken care of properly before we move
on. Christopher R. Palmer reported a problem he found due to this mistake.
This commit is contained in:
Daniel Stenberg 2004-03-04 16:13:33 +00:00
parent e40392ac03
commit 465753c2de

View File

@ -331,13 +331,16 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
char *gotourl; char *gotourl;
Curl_posttransfer(easy->easy_handle); Curl_posttransfer(easy->easy_handle);
gotourl = strdup(easy->easy_handle->change.url); easy->result = Curl_done(easy->easy_conn);
easy->easy_handle->change.url_changed = FALSE; if(CURLE_OK == easy->result) {
easy->result = Curl_follow(easy->easy_handle, gotourl); gotourl = strdup(easy->easy_handle->change.url);
if(CURLE_OK == easy->result) easy->easy_handle->change.url_changed = FALSE;
easy->state = CURLM_STATE_CONNECT; easy->result = Curl_follow(easy->easy_handle, gotourl);
else if(CURLE_OK == easy->result)
free(gotourl); easy->state = CURLM_STATE_CONNECT;
else
free(gotourl);
}
} }
easy->easy_handle->change.url_changed = FALSE; easy->easy_handle->change.url_changed = FALSE;
@ -503,7 +506,9 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles)
if(easy->easy_conn->newurl) { if(easy->easy_conn->newurl) {
char *newurl = easy->easy_conn->newurl; char *newurl = easy->easy_conn->newurl;
easy->easy_conn->newurl = NULL; easy->easy_conn->newurl = NULL;
easy->result = Curl_follow(easy->easy_handle, newurl); easy->result = Curl_done(easy->easy_conn);
if(easy->result == CURLE_OK)
easy->result = Curl_follow(easy->easy_handle, newurl);
if(CURLE_OK == easy->result) { if(CURLE_OK == easy->result) {
easy->state = CURLM_STATE_CONNECT; easy->state = CURLM_STATE_CONNECT;
result = CURLM_CALL_MULTI_PERFORM; result = CURLM_CALL_MULTI_PERFORM;