mirror of
https://github.com/curl/curl.git
synced 2026-08-26 06:33:32 +03:00
- 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.
This commit is contained in:
parent
f9a6062081
commit
55700cb01f
11 changed files with 43 additions and 501 deletions
|
|
@ -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");
|
||||
|
|
|
|||
47
lib/multi.c
47
lib/multi.c
|
|
@ -860,11 +860,13 @@ static CURLMcode multi_runsingle(struct Curl_multi *multi,
|
|||
CURLMcode result = CURLM_OK;
|
||||
struct SingleRequest *k;
|
||||
|
||||
do {
|
||||
bool disconnect_conn = FALSE;
|
||||
if(!GOOD_EASY_HANDLE(easy->easy_handle))
|
||||
return CURLM_BAD_EASY_HANDLE;
|
||||
|
||||
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;
|
||||
|
||||
/* Handle the case when the pipe breaks, i.e., the connection
|
||||
we're using gets cleaned up and we're left with nothing. */
|
||||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
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);
|
||||
}
|
||||
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);
|
||||
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:
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue