mirror of
https://github.com/curl/curl.git
synced 2025-01-30 14:22:33 +08:00
allow a custom "Accept-Encoding:" header override the internally set one
that gets set with CURLOPT_ENCODING
This commit is contained in:
parent
7261b4556b
commit
2646af106b
@ -1325,6 +1325,15 @@ CURLcode Curl_http(struct connectdata *conn)
|
|||||||
if(data->set.cookie && !checkheaders(data, "Cookie:"))
|
if(data->set.cookie && !checkheaders(data, "Cookie:"))
|
||||||
addcookies = data->set.cookie;
|
addcookies = data->set.cookie;
|
||||||
|
|
||||||
|
if(!checkheaders(data, "Accept-Encoding:") &&
|
||||||
|
data->set.encoding) {
|
||||||
|
Curl_safefree(conn->allocptr.accept_encoding);
|
||||||
|
conn->allocptr.accept_encoding =
|
||||||
|
aprintf("Accept-Encoding: %s\015\012", data->set.encoding);
|
||||||
|
if(!conn->allocptr.accept_encoding)
|
||||||
|
return CURLE_OUT_OF_MEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
if(!conn->bits.upload_chunky && (httpreq != HTTPREQ_GET)) {
|
if(!conn->bits.upload_chunky && (httpreq != HTTPREQ_GET)) {
|
||||||
/* not a chunky transfer yet, but data is to be sent */
|
/* not a chunky transfer yet, but data is to be sent */
|
||||||
ptr = checkheaders(data, "Transfer-Encoding:");
|
ptr = checkheaders(data, "Transfer-Encoding:");
|
||||||
|
@ -3348,14 +3348,6 @@ static CURLcode SetupConnection(struct connectdata *conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(data->set.encoding) {
|
|
||||||
Curl_safefree(conn->allocptr.accept_encoding);
|
|
||||||
conn->allocptr.accept_encoding =
|
|
||||||
aprintf("Accept-Encoding: %s\015\012", data->set.encoding);
|
|
||||||
if(!conn->allocptr.accept_encoding)
|
|
||||||
return CURLE_OUT_OF_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
conn->bytecount = 0;
|
conn->bytecount = 0;
|
||||||
conn->headerbytecount = 0;
|
conn->headerbytecount = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user