]> granicus.if.org Git - curl/commitdiff
Michal Marek made libcurl automatically append ";type=<a|i>" when using HTTP
authorDaniel Stenberg <daniel@haxx.se>
Sat, 15 Sep 2007 21:14:12 +0000 (21:14 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 15 Sep 2007 21:14:12 +0000 (21:14 +0000)
proxies for FTP urls.

CHANGES
RELEASE-NOTES
lib/http.c
tests/data/test208
tests/data/test79

diff --git a/CHANGES b/CHANGES
index 4b07521c0440106d990215b95e3b52ec97085398..361e81662b8b1553345c7452f26a7a271e363a76 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@
 
                                   Changelog
 
+Daniel S (15 September 2007)
+- Michal Marek made libcurl automatically append ";type=<a|i>" when using HTTP
+  proxies for FTP urls.
+
+- Günter Knauf fixed LDAP builds in the Windows makefiles and fixed LDAPv3
+  support on Windows.
+
 Dan F (13 September 2007)
 - Added LDAPS, SCP and SFTP to curl-config --protocols. Removed and
   fixed some AC_SUBST configure entries.
index be3e7aff6a9dec4669c8329a85bd46f19b31f00f..1fbc6f12f7d57f7d368ee91e95826b2e36188cc4 100644 (file)
@@ -11,7 +11,7 @@ Curl and libcurl 7.17.1
 
 This release includes the following changes:
  
- o 
+ o automatically append ";type=<a|i>" when using HTTP proxies for FTP urls
 
 This release includes the following bugfixes:
 
@@ -32,6 +32,6 @@ New curl mirrors:
 This release would not have looked like this without help, code, reports and
 advice from friends like these:
 
- Dan Fandrich
+ Dan Fandrich, Michal Marek
  
         Thanks! (and sorry if I forgot to mention someone)
index 2938c37cada9c835243c115c71b1e2c1c5872d77..090aad3d2bbeb6e491c1f1a8954750572b91b09e 100644 (file)
@@ -1740,6 +1740,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
   CURLcode result=CURLE_OK;
   struct HTTP *http;
   char *ppath = data->reqdata.path;
+  char ftp_typecode[sizeof(";type=?")] = "";
   char *host = conn->host.name;
   const char *te = ""; /* transfer-encoding */
   char *ptr;
@@ -1950,6 +1951,23 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       }
     }
     ppath = data->change.url;
+    /* when doing ftp, append ;type=<a|i> if not present */
+    if (checkprefix("ftp://", ppath) || checkprefix("ftps://", ppath)) {
+      char *p = strstr(ppath, ";type=");
+      if (p && p[6] && p[7] == 0) {
+        switch (toupper(p[6])) {
+        case 'A':
+        case 'D':
+        case 'I':
+          break;
+        default:
+          p = NULL;
+        }
+      }
+      if (!p)
+        snprintf(ftp_typecode, sizeof(ftp_typecode), ";type=%c",
+                 data->set.prefer_ascii ? 'a' : 'i');
+    }
   }
   if(HTTPREQ_POST_FORM == httpreq) {
     /* we must build the whole darned post sequence first, so that we have
@@ -2093,7 +2111,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
     result =
       add_bufferf(req_buffer,
                   "%s " /* GET/HEAD/POST/PUT */
-                  "%s HTTP/%s\r\n" /* path + HTTP version */
+                  "%s%s HTTP/%s\r\n" /* path + HTTP version */
                   "%s" /* proxyuserpwd */
                   "%s" /* userpwd */
                   "%s" /* range */
@@ -2108,6 +2126,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
 
                 request,
                 ppath,
+                ftp_typecode,
                 httpstring,
                 conn->allocptr.proxyuserpwd?
                 conn->allocptr.proxyuserpwd:"",
index eac3d5572c3790ec3251a9b3c33277612494b488..4fc485801caec76620c78cc1941d6cafb37e4007 100644 (file)
@@ -44,7 +44,7 @@ the
 ^User-Agent:.*
 </strip>
 <protocol>
-PUT ftp://daniel:mysecret@host.com/we/want/208 HTTP/1.1\r
+PUT ftp://daniel:mysecret@host.com/we/want/208;type=i HTTP/1.1\r
 Authorization: Basic ZGFuaWVsOm15c2VjcmV0\r
 Host: host.com:21\r
 Pragma: no-cache\r
index 49299379c03971e9f757d35e479a97580f5d550e..7c6ed1ee5b421824af080f0696009c9f77b493d9 100644 (file)
@@ -45,7 +45,7 @@ ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79 -x %HOSTIP:%HTTPPORT
 ^User-Agent:.*
 </strip>
 <protocol>
-GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79 HTTP/1.1\r
+GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79;type=i HTTP/1.1\r
 Host: %HOSTIP:%HTTPPORT\r
 Pragma: no-cache\r
 Accept: */*\r