diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-03-04 16:13:33 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-03-04 16:13:33 +0000 |
commit | 465753c2dea28567b54d28eeee05141b3a016829 (patch) | |
tree | 683039d034ad1ee4484997842ded82a2d5a0dd81 | |
parent | e40392ac035d2d545027659d5fca8255e586f8cb (diff) |
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.
-rw-r--r-- | lib/multi.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/multi.c b/lib/multi.c index 926506b8a..83e0b1d8c 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -331,13 +331,16 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) char *gotourl; Curl_posttransfer(easy->easy_handle); - gotourl = strdup(easy->easy_handle->change.url); - easy->easy_handle->change.url_changed = FALSE; - easy->result = Curl_follow(easy->easy_handle, gotourl); - if(CURLE_OK == easy->result) - easy->state = CURLM_STATE_CONNECT; - else - free(gotourl); + easy->result = Curl_done(easy->easy_conn); + if(CURLE_OK == easy->result) { + gotourl = strdup(easy->easy_handle->change.url); + easy->easy_handle->change.url_changed = FALSE; + easy->result = Curl_follow(easy->easy_handle, gotourl); + if(CURLE_OK == easy->result) + easy->state = CURLM_STATE_CONNECT; + else + free(gotourl); + } } 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) { char *newurl = easy->easy_conn->newurl; 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) { easy->state = CURLM_STATE_CONNECT; result = CURLM_CALL_MULTI_PERFORM; |