diff --git a/lib/http.c b/lib/http.c index 567d16dd2be6fe4f62db5d30b9afac901bc1ded4..07354a1c466ef8d9b1b31c0811ba333c3764136d 100644 --- a/lib/http.c +++ b/lib/http.c @@ -1325,6 +1325,15 @@ CURLcode Curl_http(struct connectdata *conn) if(data->set.cookie && !checkheaders(data, "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)) { /* not a chunky transfer yet, but data is to be sent */ ptr = checkheaders(data, "Transfer-Encoding:"); diff --git a/lib/url.c b/lib/url.c index 23100fc135c6cc92bddf746a905ef332da98326c..8099688df5805a7bbfa990a0c9020ced7f8dd4df 100644 --- a/lib/url.c +++ b/lib/url.c @@ -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->headerbytecount = 0;