diff options
author | Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2021-02-03 19:46:57 +0000 |
---|---|---|
committer | Sunpoet Po-Chuan Hsieh <sunpoet@FreeBSD.org> | 2021-02-03 19:46:57 +0000 |
commit | 60d64e75b0d1bb4b73654f0b4cb62419678781d7 (patch) | |
tree | 7db6d83677ff42dd4cb0a00ad641373a0fdbb059 /ftp/curl | |
parent | 199844fd29273da8c1ab7819744f6bb3296b52f0 (diff) | |
download | ports-60d64e75b0d1bb4b73654f0b4cb62419678781d7.tar.gz ports-60d64e75b0d1bb4b73654f0b4cb62419678781d7.zip |
Make User-Agent header setting reliable
- Bump PORTREVISION for package change
Requested by: Jonathan Simon <info@simonabc.com>
Obtained from: https://github.com/curl/curl/commit/0936ecd0ee5e3e28c098fefc9e2c0e6847cb7a82
Notes
Notes:
svn path=/head/; revision=563916
Diffstat (limited to 'ftp/curl')
-rw-r--r-- | ftp/curl/Makefile | 1 | ||||
-rw-r--r-- | ftp/curl/files/patch-lib-transfer.c | 25 | ||||
-rw-r--r-- | ftp/curl/files/patch-lib-url.c | 27 |
3 files changed, 51 insertions, 2 deletions
diff --git a/ftp/curl/Makefile b/ftp/curl/Makefile index 577d03b57cba..7ab60b3f3e2b 100644 --- a/ftp/curl/Makefile +++ b/ftp/curl/Makefile @@ -3,6 +3,7 @@ PORTNAME= curl PORTVERSION= 7.74.0 +PORTREVISION= 1 CATEGORIES= ftp net www MASTER_SITES= https://curl.haxx.se/download/ \ LOCAL/sunpoet diff --git a/ftp/curl/files/patch-lib-transfer.c b/ftp/curl/files/patch-lib-transfer.c new file mode 100644 index 000000000000..624255504bec --- /dev/null +++ b/ftp/curl/files/patch-lib-transfer.c @@ -0,0 +1,25 @@ +Obtained from: https://github.com/curl/curl/commit/0936ecd0ee5e3e28c098fefc9e2c0e6847cb7a82 + +--- lib/transfer.c.orig 2020-12-08 08:14:13 UTC ++++ lib/transfer.c +@@ -1532,6 +1532,20 @@ CURLcode Curl_pretransfer(struct Curl_easy *data) + Curl_hsts_loadcb(data, data->hsts); + } + ++ /* ++ * 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; + } + diff --git a/ftp/curl/files/patch-lib-url.c b/ftp/curl/files/patch-lib-url.c index 770a9ca50b38..e19a8d85ef00 100644 --- a/ftp/curl/files/patch-lib-url.c +++ b/ftp/curl/files/patch-lib-url.c @@ -1,11 +1,13 @@ +Obtained from: https://github.com/curl/curl/commit/0936ecd0ee5e3e28c098fefc9e2c0e6847cb7a82 + Description: Different handling of signals and threads. Forwarded: not-needed Author: Peter Pentchev <roam@FreeBSD.org> Last-Update: 2010-12-18 ---- lib/url.c.orig 2019-05-21 17:57:39 UTC +--- lib/url.c.orig 2020-12-08 07:39:35 UTC +++ lib/url.c -@@ -552,6 +552,10 @@ CURLcode Curl_init_userdefined(struct Cu +@@ -607,6 +607,10 @@ CURLcode Curl_init_userdefined(struct Curl_easy *data) CURL_HTTP_VERSION_1_1 #endif ; @@ -16,3 +18,24 @@ Last-Update: 2010-12-18 Curl_http2_init_userset(set); return result; } +@@ -3940,20 +3944,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 */ |