mirror of https://github.com/moparisthebest/curl
Jared Lundell filed bug report #1604956
(http://curl.haxx.se/bug/view.cgi?id=1604956) which identified setting CURLOPT_MAXCONNECTS to zero caused libcurl to SIGSEGV. Starting now, libcurl will always internally use no less than 1 entry in the connection cache.
This commit is contained in:
parent
d6b0612882
commit
e4505aefd9
5
CHANGES
5
CHANGES
|
@ -7,6 +7,11 @@
|
||||||
Changelog
|
Changelog
|
||||||
|
|
||||||
Daniel (5 December 2006)
|
Daniel (5 December 2006)
|
||||||
|
- Jared Lundell filed bug report #1604956
|
||||||
|
(http://curl.haxx.se/bug/view.cgi?id=1604956) which identified setting
|
||||||
|
CURLOPT_MAXCONNECTS to zero caused libcurl to SIGSEGV. Starting now, libcurl
|
||||||
|
will always internally use no less than 1 entry in the connection cache.
|
||||||
|
|
||||||
- Sh Diao reported that CURLOPT_FORBID_REUSE no works, and indeed it broke in
|
- Sh Diao reported that CURLOPT_FORBID_REUSE no works, and indeed it broke in
|
||||||
the 7.16.0 release.
|
the 7.16.0 release.
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,7 @@ This release includes the following bugfixes:
|
||||||
o active FTP didn't work with multi interface
|
o active FTP didn't work with multi interface
|
||||||
o curl_getdate() could be off one hour for TZ time zones with DST, on windows
|
o curl_getdate() could be off one hour for TZ time zones with DST, on windows
|
||||||
o CURLOPT_FORBID_REUSE works again
|
o CURLOPT_FORBID_REUSE works again
|
||||||
|
o CURLOPT_MAXCONNECTS set to zero caused libcurl to SIGSEGV
|
||||||
|
|
||||||
Other curl-related news:
|
Other curl-related news:
|
||||||
|
|
||||||
|
@ -47,6 +48,6 @@ advice from friends like these:
|
||||||
|
|
||||||
James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
|
James Housley, Olaf Stueben, Yang Tse, Gisle Vanem, Bradford Bruce,
|
||||||
Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest,
|
Ciprian Badescu, Dmitriy Sergeyev, Nir Soffer, Venkat Akella, Toon Verwaest,
|
||||||
Matt Witherspoon, Alexey Simak, Martin Skinner, Sh Diao
|
Matt Witherspoon, Alexey Simak, Martin Skinner, Sh Diao, Jared Lundell
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
|
|
@ -471,7 +471,7 @@ CURLcode curl_easy_perform(CURL *curl)
|
||||||
|
|
||||||
if(!data->state.connc) {
|
if(!data->state.connc) {
|
||||||
/* oops, no connection cache, make one up */
|
/* oops, no connection cache, make one up */
|
||||||
data->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE);
|
data->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE, -1);
|
||||||
if(!data->state.connc)
|
if(!data->state.connc)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
}
|
||||||
|
@ -561,7 +561,7 @@ CURL *curl_easy_duphandle(CURL *incurl)
|
||||||
if(data->state.used_interface == Curl_if_multi)
|
if(data->state.used_interface == Curl_if_multi)
|
||||||
outcurl->state.connc = data->state.connc;
|
outcurl->state.connc = data->state.connc;
|
||||||
else
|
else
|
||||||
outcurl->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE);
|
outcurl->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE, -1);
|
||||||
|
|
||||||
if(!outcurl->state.connc)
|
if(!outcurl->state.connc)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -347,7 +347,7 @@ CURLM *curl_multi_init(void)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
multi->connc = Curl_mk_connc(CONNCACHE_MULTI);
|
multi->connc = Curl_mk_connc(CONNCACHE_MULTI, -1);
|
||||||
if(!multi->connc) {
|
if(!multi->connc) {
|
||||||
Curl_hash_destroy(multi->hostcache);
|
Curl_hash_destroy(multi->hostcache);
|
||||||
free(multi);
|
free(multi);
|
||||||
|
|
20
lib/url.c
20
lib/url.c
|
@ -377,11 +377,13 @@ CURLcode Curl_close(struct SessionHandle *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a connection cache of a private or multi type */
|
/* create a connection cache of a private or multi type */
|
||||||
struct conncache *Curl_mk_connc(int type)
|
struct conncache *Curl_mk_connc(int type,
|
||||||
|
int amount) /* set -1 to use default */
|
||||||
{
|
{
|
||||||
/* It is subject for debate how many default connections to have for a multi
|
/* It is subject for debate how many default connections to have for a multi
|
||||||
connection cache... */
|
connection cache... */
|
||||||
int default_amount = (type == CONNCACHE_PRIVATE)?5:10;
|
int default_amount = amount == -1?
|
||||||
|
((type == CONNCACHE_PRIVATE)?5:10):amount;
|
||||||
struct conncache *c;
|
struct conncache *c;
|
||||||
|
|
||||||
c= calloc(sizeof(struct conncache), 1);
|
c= calloc(sizeof(struct conncache), 1);
|
||||||
|
@ -407,6 +409,20 @@ CURLcode Curl_ch_connc(struct SessionHandle *data,
|
||||||
long i;
|
long i;
|
||||||
struct connectdata **newptr;
|
struct connectdata **newptr;
|
||||||
|
|
||||||
|
if(newamount < 1)
|
||||||
|
newamount = 1; /* we better have at least one entry */
|
||||||
|
|
||||||
|
if(!c) {
|
||||||
|
/* we get a NULL pointer passed in as connection cache, which means that
|
||||||
|
there is no cache created for this SessionHandle just yet, we create a
|
||||||
|
brand new with the requested size.
|
||||||
|
*/
|
||||||
|
data->state.connc = Curl_mk_connc(CONNCACHE_PRIVATE, newamount);
|
||||||
|
if(!data->state.connc)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
return CURLE_OK;
|
||||||
|
}
|
||||||
|
|
||||||
if(newamount < c->num) {
|
if(newamount < c->num) {
|
||||||
/* Since this number is *decreased* from the existing number, we must
|
/* Since this number is *decreased* from the existing number, we must
|
||||||
close the possibly open connections that live on the indexes that
|
close the possibly open connections that live on the indexes that
|
||||||
|
|
|
@ -47,7 +47,7 @@ CURLcode Curl_protocol_doing(struct connectdata *conn, bool *done);
|
||||||
void Curl_safefree(void *ptr);
|
void Curl_safefree(void *ptr);
|
||||||
|
|
||||||
/* create a connection cache */
|
/* create a connection cache */
|
||||||
struct conncache *Curl_mk_connc(int type);
|
struct conncache *Curl_mk_connc(int type, int amount);
|
||||||
/* free a connection cache */
|
/* free a connection cache */
|
||||||
void Curl_rm_connc(struct conncache *c);
|
void Curl_rm_connc(struct conncache *c);
|
||||||
/* Change number of entries of a connection cache */
|
/* Change number of entries of a connection cache */
|
||||||
|
|
Loading…
Reference in New Issue