1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-19 19:59:43 +00:00

Make User-Agent header setting reliable

- Bump PORTREVISION for package change

Requested by:	Jonathan Simon <info@simonabc.com>
Obtained from:	0936ecd0ee
This commit is contained in:
Sunpoet Po-Chuan Hsieh 2021-02-03 19:46:57 +00:00
parent 199844fd29
commit 60d64e75b0
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=563916
3 changed files with 51 additions and 2 deletions

View File

@ -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

View File

@ -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;
}

View File

@ -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 */