diff options
author | Daniel Stenberg <daniel@haxx.se> | 2008-02-20 08:28:02 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2008-02-20 08:28:02 +0000 |
commit | 55700cb01f4a01b8187f387e1655371e6fe0703a (patch) | |
tree | b7683b39a639a13b82517bc774b9b7c931f542f4 /lib | |
parent | f9a60620818b6a19ebe3e6f15e1b57d7012e6fb0 (diff) |
- We no longer support setting the CURLOPT_URL option from inside a callback
such as the CURLOPT_SSL_CTX_FUNCTION one treat that as if it was a Location:
following. The patch that introduced this feature was done for 7.11.0, but
this code and functionality has been broken since about 7.15.4 (March 2006)
with the introduction of non-blocking OpenSSL "connects".
It was a hack to begin with and since it doesn't work and hasn't worked
correctly for a long time and nobody has even noticed, I consider it a very
suitable subject for plain removal. And so it was done.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gtls.c | 4 | ||||
-rw-r--r-- | lib/multi.c | 45 | ||||
-rw-r--r-- | lib/transfer.c | 52 | ||||
-rw-r--r-- | lib/url.c | 2 | ||||
-rw-r--r-- | lib/urldata.h | 4 |
5 files changed, 26 insertions, 81 deletions
diff --git a/lib/gtls.c b/lib/gtls.c index e980a5bdc..2364c2778 100644 --- a/lib/gtls.c +++ b/lib/gtls.c @@ -230,7 +230,9 @@ Curl_gtls_connect(struct connectdata *conn, void *ssl_sessionid; size_t ssl_idsize; - if(!gtls_inited) _Curl_gtls_init(); + if(!gtls_inited) + _Curl_gtls_init(); + /* GnuTLS only supports TLSv1 (and SSLv3?) */ if(data->set.ssl.version == CURL_SSLVERSION_SSLv2) { failf(data, "GnuTLS does not support SSLv2"); diff --git a/lib/multi.c b/lib/multi.c index ab0db3236..a29b6a0ae 100644 --- a/lib/multi.c +++ b/lib/multi.c @@ -860,12 +860,14 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, CURLMcode result = CURLM_OK; struct SingleRequest *k; + if(!GOOD_EASY_HANDLE(easy->easy_handle)) + return CURLM_BAD_EASY_HANDLE; + do { + /* this is a do-while loop just to allow a break to skip to the end + of it */ bool disconnect_conn = FALSE; - if(!GOOD_EASY_HANDLE(easy->easy_handle)) - return CURLM_BAD_EASY_HANDLE; - /* Handle the case when the pipe breaks, i.e., the connection we're using gets cleaned up and we're left with nothing. */ if(easy->easy_handle->state.pipe_broke) { @@ -885,40 +887,9 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, } if(easy->state > CURLM_STATE_CONNECT && - easy->state < CURLM_STATE_COMPLETED) { + easy->state < CURLM_STATE_COMPLETED) /* Make sure we set the connection's current owner */ easy->easy_conn->data = easy->easy_handle; - } - - if(CURLM_STATE_WAITCONNECT <= easy->state && - easy->state <= CURLM_STATE_DO && - easy->easy_handle->change.url_changed) { - char *gotourl; - Curl_posttransfer(easy->easy_handle); - - easy->result = Curl_done(&easy->easy_conn, CURLE_OK, FALSE); - /* We make sure that the pipe broken flag is reset - because in this case, it isn't an actual break */ - easy->easy_handle->state.pipe_broke = FALSE; - if(CURLE_OK == easy->result) { - gotourl = strdup(easy->easy_handle->change.url); - if(gotourl) { - easy->easy_handle->change.url_changed = FALSE; - easy->result = Curl_follow(easy->easy_handle, gotourl, FALSE); - if(CURLE_OK == easy->result) - multistate(easy, CURLM_STATE_CONNECT); - else - free(gotourl); - } - else { - easy->result = CURLE_OUT_OF_MEMORY; - multistate(easy, CURLM_STATE_COMPLETED); - break; - } - } - } - - easy->easy_handle->change.url_changed = FALSE; switch(easy->state) { case CURLM_STATE_INIT: @@ -1403,9 +1374,7 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi, multistate(easy, CURLM_STATE_COMPLETED); } } - - } while(easy->easy_handle->change.url_changed); - + } while(0); if((CURLM_STATE_COMPLETED == easy->state) && !easy->msg) { if(easy->easy_handle->dns.hostcachetype == HCACHE_MULTI) { /* clear out the usage of the shared DNS cache */ diff --git a/lib/transfer.c b/lib/transfer.c index 49397e8c9..86dcfe24f 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -2260,44 +2260,24 @@ connect_host(struct SessionHandle *data, struct connectdata **conn) { CURLcode res = CURLE_OK; - int urlchanged = FALSE; - do { - bool async; - bool protocol_done=TRUE; /* will be TRUE always since this is only used + bool async; + bool protocol_done=TRUE; /* will be TRUE always since this is only used within the easy interface */ - Curl_pgrsTime(data, TIMER_STARTSINGLE); - data->change.url_changed = FALSE; - res = Curl_connect(data, conn, &async, &protocol_done); - - if((CURLE_OK == res) && async) { - /* Now, if async is TRUE here, we need to wait for the name - to resolve */ - res = Curl_wait_for_resolv(*conn, NULL); - if(CURLE_OK == res) - /* Resolved, continue with the connection */ - res = Curl_async_resolved(*conn, &protocol_done); - else - /* if we can't resolve, we kill this "connection" now */ - (void)Curl_disconnect(*conn); - } - if(res) - break; - - /* If a callback (or something) has altered the URL we should use within - the Curl_connect(), we detect it here and act as if we are redirected - to the new URL */ - urlchanged = data->change.url_changed; - if((CURLE_OK == res) && urlchanged) { - res = Curl_done(conn, res, FALSE); - if(CURLE_OK == res) { - char *gotourl = strdup(data->change.url); - res = Curl_follow(data, gotourl, FALSE); - if(res) - free(gotourl); - } - } - } while(urlchanged && res == CURLE_OK); + Curl_pgrsTime(data, TIMER_STARTSINGLE); + res = Curl_connect(data, conn, &async, &protocol_done); + + if((CURLE_OK == res) && async) { + /* Now, if async is TRUE here, we need to wait for the name + to resolve */ + res = Curl_wait_for_resolv(*conn, NULL); + if(CURLE_OK == res) + /* Resolved, continue with the connection */ + res = Curl_async_resolved(*conn, &protocol_done); + else + /* if we can't resolve, we kill this "connection" now */ + (void)Curl_disconnect(*conn); + } return res; } @@ -1481,8 +1481,6 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, result = setstropt(&data->set.str[STRING_SET_URL], va_arg(param, char *)); data->change.url = data->set.str[STRING_SET_URL]; - if(data->change.url) - data->change.url_changed = TRUE; break; case CURLOPT_PORT: /* diff --git a/lib/urldata.h b/lib/urldata.h index 505da5500..2eeb08c20 100644 --- a/lib/urldata.h +++ b/lib/urldata.h @@ -1250,10 +1250,6 @@ struct UrlState { struct DynamicStatic { char *url; /* work URL, copied from UserDefined */ bool url_alloc; /* URL string is malloc()'ed */ - bool url_changed; /* set on CURL_OPT_URL, used to detect if the URL was - changed after the connect phase, as we allow callback - to change it and if so, we reconnect to use the new - URL instead */ char *referer; /* referer string */ bool referer_alloc; /* referer sting is malloc()ed */ struct curl_slist *cookielist; /* list of cookie files set by |