diff options
author | Seonah Moon <seonah1.moon@samsung.com> | 2021-11-17 12:08:41 +0900 |
---|---|---|
committer | Seonah Moon <seonah1.moon@samsung.com> | 2021-11-17 12:08:43 +0900 |
commit | e663816381900eb14fbf477b244c11b3188d99e2 (patch) | |
tree | 4bcc663498cb9d0565964473a61d1d6ccbbfe0f1 | |
parent | 3cb6cb9788bae20d57247caf9da706febfd45b4a (diff) | |
download | curl-e663816381900eb14fbf477b244c11b3188d99e2.tar.gz curl-e663816381900eb14fbf477b244c11b3188d99e2.tar.bz2 curl-e663816381900eb14fbf477b244c11b3188d99e2.zip |
pretransfer: setup the User-Agent header heresubmit/tizen_base/20211118.011723accepted/tizen/base/20211121.213041
... and not in the connection setup, as for multiplexed transfers the
connection setup might be skipped and then the transfer would end up
without the set user-agent!
Reported-by: Flameborn on github
Assisted-by: Andrey Gursky
Assisted-by: Jay Satiro
Assisted-by: Mike Gelfand
Fixes #6312
Closes #6417
https://github.com/curl/curl/issues/6312
https://github.com/curl/curl/pull/6417
Change-Id: I91d196cf08bd96c0534621ad7eae9eb73a004f21
-rw-r--r-- | lib/transfer.c | 15 | ||||
-rw-r--r-- | lib/url.c | 14 | ||||
-rw-r--r-- | packaging/curl.spec | 2 |
3 files changed, 16 insertions, 15 deletions
diff --git a/lib/transfer.c b/lib/transfer.c index a07c7af8c..c7b3596eb 100644 --- a/lib/transfer.c +++ b/lib/transfer.c @@ -1531,6 +1531,21 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) Curl_http2_init_state(&data->state); } + /* + * Set user-agent. Used for HTTP, but since we can attempt to tunnel + * basically anything through a http proxy we can't limit this based on + * protocol. + */ + if(data->set.str[STRING_USERAGENT]) { + Curl_safefree(data->state.aptr.uagent); + data->state.aptr.uagent = + aprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]); + if(!data->state.aptr.uagent) + return CURLE_OUT_OF_MEMORY; + } + + data->req.headerbytecount = 0; + return result; } @@ -3942,20 +3942,6 @@ CURLcode Curl_setup_conn(struct connectdata *conn, lingering set from a previous invoke */ conn->bits.proxy_connect_closed = FALSE; #endif - /* - * Set user-agent. Used for HTTP, but since we can attempt to tunnel - * basically anything through a http proxy we can't limit this based on - * protocol. - */ - if(data->set.str[STRING_USERAGENT]) { - Curl_safefree(data->state.aptr.uagent); - data->state.aptr.uagent = - aprintf("User-Agent: %s\r\n", data->set.str[STRING_USERAGENT]); - if(!data->state.aptr.uagent) - return CURLE_OUT_OF_MEMORY; - } - - data->req.headerbytecount = 0; #ifdef CURL_DO_LINEEND_CONV data->state.crlf_conversions = 0; /* reset CRLF conversion counter */ diff --git a/packaging/curl.spec b/packaging/curl.spec index be0757a9f..80e43cc75 100644 --- a/packaging/curl.spec +++ b/packaging/curl.spec @@ -1,7 +1,7 @@ Name: curl Summary: A utility for getting files from remote servers (FTP, HTTP, and others) Version: 7.73.0 -Release: 1 +Release: 2 Group: Applications/Internet License: MIT URL: http://curl.haxx.se/ |