rpms/curl/F-12 curl-7.19.7-bz589132.patch, NONE, 1.1 curl.spec, 1.138, 1.139

Kamil Dudka kdudka at fedoraproject.org
Thu Jun 17 08:49:30 UTC 2010


Author: kdudka

Update of /cvs/extras/rpms/curl/F-12
In directory cvs01.phx2.fedoraproject.org:/tmp/cvs-serv27685

Modified Files:
	curl.spec 
Added Files:
	curl-7.19.7-bz589132.patch 
Log Message:
- improve handling of proxy related environment variables (#589132)

curl-7.19.7-bz589132.patch:
 CHANGES                |   10 ++++++++
 lib/url.c              |   44 +++++++++++++++++++++-----------------
 tests/data/Makefile.am |    2 -
 tests/data/test1106    |   56 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 20 deletions(-)

--- NEW FILE curl-7.19.7-bz589132.patch ---
 CHANGES                |   10 ++++++++
 lib/url.c              |   44 +++++++++++++++++++++----------------
 tests/data/Makefile.am |    2 +-
 tests/data/test1106    |   56 ++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 92 insertions(+), 20 deletions(-)

diff --git a/CHANGES b/CHANGES
index 1f299ed..d227309 100644
--- a/CHANGES
+++ b/CHANGES
@@ -34,6 +34,16 @@ Björn Stenberg (23 Jan 2010)
   -O/--remote-name option to use the server-specified Content-Disposition
   filename instead of extracting a filename from the URL.
 
+Daniel Stenberg (15 Dec 2009)
+- Jon Nelson found a regression that turned out to be a flaw in how libcurl
+  detects and uses proxies based on the environment variables. If the proxy
+  was given as an explicit option it worked, but due to the setup order
+  mistake proxies would not be used fine for a few protocols when picked up
+  from '[protocol]_proxy'. Obviously this broke after 7.19.4. I now also added
+  test case 1106 that verifies this functionality.
+
+  (http://curl.haxx.se/bug/view.cgi?id=2913886)
+
 Kamil Dudka (12 Nov 2009)
 - Kevin Baughman provided a fix preventing libcurl-NSS from crash on doubly
   closed NSPR descriptor. The issue was hard to find, reported several times
diff --git a/lib/url.c b/lib/url.c
index c13d7ff..023c442 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -3198,6 +3198,7 @@ static struct connectdata *allocate_conn(void)
   conn->sock[FIRSTSOCKET] = CURL_SOCKET_BAD;     /* no file descriptor */
   conn->sock[SECONDARYSOCKET] = CURL_SOCKET_BAD; /* no file descriptor */
   conn->connectindex = -1;    /* no index */
+  conn->port = -1; /* unknown at this point */
 
   /* Default protocol-independent behavior doesn't support persistent
      connections, so we set this to force-close. Protocols that support
@@ -3452,7 +3453,8 @@ static CURLcode setup_range(struct SessionHandle *data)
 
 
 /***************************************************************
-* Setup connection internals specific to the requested protocol
+* Setup connection internals specific to the requested protocol.
+* This MUST get called after proxy magic has been figured out.
 ***************************************************************/
 static CURLcode setup_connection_internals(struct SessionHandle *data,
                                            struct connectdata *conn)
@@ -3491,7 +3493,10 @@ static CURLcode setup_connection_internals(struct SessionHandle *data,
         p = conn->handler;              /* May have changed. */
       }
 
-      conn->port = p->defport;
+      if(conn->port < 0)
+        /* we check for -1 here since if proxy was detected already, this
+           was very likely already set to the proxy port */
+        conn->port = p->defport;
       conn->remote_port = (unsigned short)p->defport;
       conn->protocol |= p->protocol;
       return CURLE_OK;
@@ -4401,23 +4406,6 @@ static CURLcode create_conn(struct SessionHandle *data,
     conn->protocol &= ~PROT_MISSING; /* switch that one off again */
   }
 
-  /*************************************************************
-   * Setup internals depending on protocol
-   *************************************************************/
-  result = setup_connection_internals(data, conn);
-  if(result != CURLE_OK) {
-    Curl_safefree(proxy);
-    return result;
-  }
-
-  /*************************************************************
-   * Parse a user name and password in the URL and strip it out
-   * of the host name
-   *************************************************************/
-  result = parse_url_userpass(data, conn, user, passwd);
-  if(result != CURLE_OK)
-    return result;
-
 #ifndef CURL_DISABLE_PROXY
   /*************************************************************
    * Extract the user and password from the authentication string
@@ -4491,6 +4479,24 @@ static CURLcode create_conn(struct SessionHandle *data,
   }
 #endif /* CURL_DISABLE_PROXY */
 
+  /*************************************************************
+   * Setup internals depending on protocol. Needs to be done after
+   * we figured out what/if proxy to use.
+   *************************************************************/
+  result = setup_connection_internals(data, conn);
+  if(result != CURLE_OK) {
+    Curl_safefree(proxy);
+    return result;
+  }
+
+  /*************************************************************
+   * Parse a user name and password in the URL and strip it out
+   * of the host name
+   *************************************************************/
+  result = parse_url_userpass(data, conn, user, passwd);
+  if(result != CURLE_OK)
+    return result;
+
   /***********************************************************************
    * file: is a special case in that it doesn't need a network connection
    ***********************************************************************/
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index d6dc4f3..8fdd58f 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -63,7 +63,7 @@ EXTRA_DIST = test1 test108 test117 test127 test20 test27 test34 test46	   \
  test1089 test1090 test1091 test1092 test1093 test1094 test1095 test1096   \
  test1097 test560 test561 test1098 test1099 test562 test563 test1100       \
  test564 test1101 test1102 test1103 test1104 test299 test310 test311       \
- test312 test1105 test565
+ test312 test1105 test565 test1106
 
 filecheck:
 	@mkdir test-place; \
diff --git a/tests/data/test1106 b/tests/data/test1106
new file mode 100644
index 0000000..2ac14d1
--- /dev/null
+++ b/tests/data/test1106
@@ -0,0 +1,56 @@
+<testcase>
+<info>
+<keywords>
+FTP
+CURLOPT_PORT
+HTTP proxy
+</keywords>
+</info>
+
+# Server-side
+<reply>
+<data nocheck="yes">
+HTTP/1.1 200 OK swsclose
+Date: Thu, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Accept-Ranges: bytes
+Content-Length: 6
+
+hello
+</data>
+</reply>
+
+# Client-side
+<client>
+<server>
+http
+</server>
+ <name>
+FTP URL and with ftp_proxy environment variable set
+ </name>
+
+<setenv>
+ftp_proxy=http://%HOSTIP:%HTTPPORT/
+</setenv>
+# note that we need quotes around the URL below to make sure the shell doesn't
+# treat the semicolon as a separator!
+ <command>
+"ftp://%HOSTIP:23456/1106"
+</command>
+
+</client>
+
+# Verify data after the test has been "shot"
+<verify>
+<strip>
+^User-Agent:.*
+</strip>
+<protocol>
+GET ftp://%HOSTIP:23456/1106 HTTP/1.1
+Host: %HOSTIP:23456
+Accept: */*
+Proxy-Connection: Keep-Alive
+
+</protocol>
+</verify>
+</testcase>


Index: curl.spec
===================================================================
RCS file: /cvs/extras/rpms/curl/F-12/curl.spec,v
retrieving revision 1.138
retrieving revision 1.139
diff -u -p -r1.138 -r1.139
--- curl.spec	27 May 2010 08:28:22 -0000	1.138
+++ curl.spec	17 Jun 2010 08:49:30 -0000	1.139
@@ -1,7 +1,7 @@
 Summary: A utility for getting files from remote servers (FTP, HTTP, and others)
 Name: curl
 Version: 7.19.7
-Release: 10%{?dist}
+Release: 11%{?dist}
 License: MIT
 Group: Applications/Internet
 Source: http://curl.haxx.se/download/%{name}-%{version}.tar.lzma
@@ -20,6 +20,7 @@ Patch8: curl-7.20.1-47dda4a.patch
 Patch9: curl-7.20.0-read.patch
 Patch10: curl-7.20.0-alarm-race.patch
 Patch11: curl-7.19.7-ssl-connect-timeout.patch
+Patch12: curl-7.19.7-bz589132.patch
 
 Patch101: curl-7.15.3-multilib.patch
 Patch102: curl-7.16.0-privlibs.patch
@@ -107,6 +108,7 @@ done
 %patch9 -p1
 %patch10 -p1
 %patch11 -p1
+%patch12 -p1
 
 # other patches
 %patch4 -p1
@@ -209,6 +211,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/aclocal/libcurl.m4
 
 %changelog
+* Thu Jun 17 2010 Kamil Dudka <kdudka at redhat.com> 7.19.7-11
+- improve handling of proxy related environment variables (#589132)
+
 * Thu May 27 2010 Kamil Dudka <kdudka at redhat.com> 7.19.7-10
 - fix -J/--remote-header-name to strip CR-LF (upstream patch)
 - do not ignore given timeout during SSL connection



More information about the scm-commits mailing list