OK to patch curl to fix no_proxy?
https://github.com/curl/curl/issues/9821
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/curl/Makefile,v
retrieving revision 1.174
diff -u -p -r1.174 Makefile
--- Makefile 28 Oct 2022 17:59:06 -0000 1.174
+++ Makefile 2 Nov 2022 02:47:01 -0000
@@ -1,6 +1,7 @@
COMMENT= transfer files with FTP, HTTP, HTTPS, etc.
DISTNAME= curl-7.86.0
+REVISION= 0
SHARED_LIBS= curl 26.17 # 12.0
CATEGORIES= net
HOMEPAGE= https://curl.se/
Index: patches/patch-lib_noproxy_c
===================================================================
RCS file: patches/patch-lib_noproxy_c
diff -N patches/patch-lib_noproxy_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_noproxy_c 2 Nov 2022 02:47:01 -0000
@@ -0,0 +1,54 @@
+From b830f9ba9e94acf672cd191993ff679fa888838b Mon Sep 17 00:00:00 2001
+From: Daniel Stenberg <daniel@haxx.se>
+Date: Fri, 28 Oct 2022 10:51:49 +0200
+Subject: [PATCH] noproxy: fix tail-matching
+
+Index: lib/noproxy.c
+--- lib/noproxy.c.orig
++++ lib/noproxy.c
+@@ -149,9 +149,14 @@ bool Curl_check_noproxy(const char *name, const char *
+ }
+ else {
+ unsigned int address;
++ namelen = strlen(name);
+ if(1 == Curl_inet_pton(AF_INET, name, &address))
+ type = TYPE_IPV4;
+- namelen = strlen(name);
++ else {
++ /* ignore trailing dots in the host name */
++ if(name[namelen - 1] == '.')
++ namelen--;
++ }
+ }
+
+ while(*p) {
+@@ -173,12 +178,23 @@ bool Curl_check_noproxy(const char *name, const char *
+ if(tokenlen) {
+ switch(type) {
+ case TYPE_HOST:
+- if(*token == '.') {
+- ++token;
+- --tokenlen;
+- /* tailmatch */
+- match = (tokenlen <= namelen) &&
+- strncasecompare(token, name + (namelen - tokenlen), namelen);
++ /* ignore trailing dots in the token to check */
++ if(token[tokenlen - 1] == '.')
++ tokenlen--;
++
++ if(tokenlen && (*token == '.')) {
++ /* A: example.com matches '.example.com'
++ B: www.example.com matches '.example.com'
++ C: nonexample.com DOES NOT match '.example.com'
++ */
++ if((tokenlen - 1) == namelen)
++ /* case A, exact match without leading dot */
++ match = strncasecompare(token + 1, name, namelen);
++ else if(tokenlen < namelen)
++ /* case B, tailmatch with leading dot */
++ match = strncasecompare(token, name + (namelen - tokenlen),
++ tokenlen);
++ /* case C passes through, not a match */
+ }
+ else
+ match = (tokenlen == namelen) &&
Index: patches/patch-m4_curl-compilers_m4
===================================================================
RCS file: /cvs/ports/net/curl/patches/patch-m4_curl-compilers_m4,v
retrieving revision 1.5
diff -u -p -r1.5 patch-m4_curl-compilers_m4
--- patches/patch-m4_curl-compilers_m4 30 Jun 2022 18:11:25 -0000 1.5
+++ patches/patch-m4_curl-compilers_m4 2 Nov 2022 02:47:01 -0000
@@ -9,7 +9,7 @@ Do not override optimization flags in CF
Index: m4/curl-compilers.m4
--- m4/curl-compilers.m4.orig
+++ m4/curl-compilers.m4
-@@ -693,7 +693,7 @@ AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
+@@ -695,7 +695,7 @@ AC_DEFUN([CURL_SET_COMPILER_OPTIMIZE_OPTS], [
tmp_options=""
tmp_CFLAGS="$CFLAGS"
tmp_CPPFLAGS="$CPPFLAGS"
No comments:
Post a Comment