svn commit: r563916 - in head/ftp/curl: . files

Sunpoet Po-Chuan Hsieh sunpoet at FreeBSD.org
Wed Feb 3 19:47:00 UTC 2021


Author: sunpoet
Date: Wed Feb  3 19:46:57 2021
New Revision: 563916
URL: https://svnweb.freebsd.org/changeset/ports/563916

Log:
  Make User-Agent header setting reliable
  
  - Bump PORTREVISION for package change
  
  Requested by:	Jonathan Simon <info at simonabc.com>
  Obtained from:	https://github.com/curl/curl/commit/0936ecd0ee5e3e28c098fefc9e2c0e6847cb7a82

Added:
  head/ftp/curl/files/patch-lib-transfer.c   (contents, props changed)
Modified:
  head/ftp/curl/Makefile
  head/ftp/curl/files/patch-lib-url.c

Modified: head/ftp/curl/Makefile
==============================================================================
--- head/ftp/curl/Makefile	Wed Feb  3 19:46:50 2021	(r563915)
+++ head/ftp/curl/Makefile	Wed Feb  3 19:46:57 2021	(r563916)
@@ -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

Added: head/ftp/curl/files/patch-lib-transfer.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/ftp/curl/files/patch-lib-transfer.c	Wed Feb  3 19:46:57 2021	(r563916)
@@ -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;
+ }
+ 

Modified: head/ftp/curl/files/patch-lib-url.c
==============================================================================
--- head/ftp/curl/files/patch-lib-url.c	Wed Feb  3 19:46:50 2021	(r563915)
+++ head/ftp/curl/files/patch-lib-url.c	Wed Feb  3 19:46:57 2021	(r563916)
@@ -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 at 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 */


More information about the svn-ports-all mailing list