1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -05:00

Vincent Bronner pointed out that if you set CURLOPT_COOKIE to NULL, it still

sends off the previously set cookie. This also concerns CURLOPT_REFERER.
This fix should stop this.
This commit is contained in:
Daniel Stenberg 2003-10-04 15:48:15 +00:00
parent 8297ac4a28
commit 780652e5b6

View File

@ -1053,16 +1053,17 @@ CURLcode Curl_http(struct connectdata *conn)
if(result) if(result)
return result; return result;
if((data->change.referer) && !checkheaders(data, "Referer:")) { Curl_safefree(conn->allocptr.ref);
if(conn->allocptr.ref) if(data->change.referer && !checkheaders(data, "Referer:"))
free(conn->allocptr.ref);
conn->allocptr.ref = aprintf("Referer: %s\015\012", data->change.referer); conn->allocptr.ref = aprintf("Referer: %s\015\012", data->change.referer);
} else
if(data->set.cookie && !checkheaders(data, "Cookie:")) { conn->allocptr.ref = NULL;
if(conn->allocptr.cookie)
free(conn->allocptr.cookie); Curl_safefree(conn->allocptr.cookie);
if(data->set.cookie && !checkheaders(data, "Cookie:"))
conn->allocptr.cookie = aprintf("Cookie: %s\015\012", data->set.cookie); conn->allocptr.cookie = aprintf("Cookie: %s\015\012", data->set.cookie);
} else
conn->allocptr.cookie = NULL;
if(!conn->bits.upload_chunky && (data->set.httpreq != HTTPREQ_GET)) { if(!conn->bits.upload_chunky && (data->set.httpreq != HTTPREQ_GET)) {
/* not a chunky transfer but data is to be sent */ /* not a chunky transfer but data is to be sent */