curl/curl-7.17.0-cvs-fixes.patch

138 lines
4.9 KiB
Diff

Index: lib/escape.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/escape.c,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -p -r1.40 -r1.41
--- lib/escape.c 26 Aug 2007 05:53:26 -0000 1.40
+++ lib/escape.c 30 Sep 2007 22:40:24 -0000 1.41
@@ -5,7 +5,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2006, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2007, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -18,7 +18,7 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
- * $Id: escape.c,v 1.40 2007-08-26 05:53:26 danf Exp $
+ * $Id: escape.c,v 1.41 2007-09-30 22:40:24 bagder Exp $
***************************************************************************/
/* Escape and unescape URL encoding in strings. The functions return a new
@@ -59,7 +59,7 @@ char *curl_easy_escape(CURL *handle, con
size_t alloc = (inlength?(size_t)inlength:strlen(string))+1;
char *ns;
char *testing_ptr = NULL;
- char in;
+ unsigned char in; /* we need to treat the characters unsigned */
size_t newlen = alloc;
int strindex=0;
size_t length;
Index: lib/http.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/http.c,v
retrieving revision 1.334
retrieving revision 1.335
diff -u -p -r1.334 -r1.335
--- lib/http.c 27 Aug 2007 06:31:28 -0000 1.334
+++ lib/http.c 15 Sep 2007 21:14:13 -0000 1.335
@@ -18,7 +18,7 @@
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
- * $Id: http.c,v 1.334 2007-08-27 06:31:28 danf Exp $
+ * $Id: http.c,v 1.335 2007-09-15 21:14:13 bagder Exp $
***************************************************************************/
#include "setup.h"
@@ -1740,6 +1740,7 @@ CURLcode Curl_http(struct connectdata *c
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 *c
}
}
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 *c
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 *c
request,
ppath,
+ ftp_typecode,
httpstring,
conn->allocptr.proxyuserpwd?
conn->allocptr.proxyuserpwd:"",
Index: tests/data/test79
===================================================================
RCS file: /cvsroot/curl/curl/tests/data/test79,v
retrieving revision 1.9
retrieving revision 1.11
diff -u -p -r1.9 -r1.11
--- tests/data/test79 9 Mar 2007 21:01:40 -0000 1.9
+++ tests/data/test79 15 Sep 2007 21:14:13 -0000 1.11
@@ -45,8 +45,8 @@ ftp://%HOSTIP:%HTTPPORT/we/want/that/pag
^User-Agent:.*
</strip>
<protocol>
-GET ftp://127.0.0.1:%HTTPPORT/we/want/that/page/79 HTTP/1.1
-Host: 127.0.0.1:%HTTPPORT
+GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79;type=i HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
Pragma: no-cache
Accept: */*
Proxy-Connection: Keep-Alive
Index: tests/data/test208
===================================================================
RCS file: /cvsroot/curl/curl/tests/data/test208,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -r1.5 -r1.6
--- tests/data/test208 9 Mar 2007 21:01:40 -0000 1.5
+++ tests/data/test208 15 Sep 2007 21:14:13 -0000 1.6
@@ -44,7 +44,7 @@ the
^User-Agent:.*
</strip>
<protocol>
-PUT ftp://daniel:mysecret@host.com/we/want/208 HTTP/1.1
+PUT ftp://daniel:mysecret@host.com/we/want/208;type=i HTTP/1.1
Authorization: Basic ZGFuaWVsOm15c2VjcmV0
Host: host.com:21
Pragma: no-cache