mirror of
https://github.com/moparisthebest/curl
synced 2024-08-13 17:03:50 -04:00
Michal Marek made libcurl automatically append ";type=<a|i>" when using HTTP
proxies for FTP urls.
This commit is contained in:
parent
cdb2552424
commit
e04151ed76
7
CHANGES
7
CHANGES
@ -6,6 +6,13 @@
|
|||||||
|
|
||||||
Changelog
|
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)
|
Dan F (13 September 2007)
|
||||||
- Added LDAPS, SCP and SFTP to curl-config --protocols. Removed and
|
- Added LDAPS, SCP and SFTP to curl-config --protocols. Removed and
|
||||||
fixed some AC_SUBST configure entries.
|
fixed some AC_SUBST configure entries.
|
||||||
|
@ -11,7 +11,7 @@ Curl and libcurl 7.17.1
|
|||||||
|
|
||||||
This release includes the following changes:
|
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:
|
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
|
This release would not have looked like this without help, code, reports and
|
||||||
advice from friends like these:
|
advice from friends like these:
|
||||||
|
|
||||||
Dan Fandrich
|
Dan Fandrich, Michal Marek
|
||||||
|
|
||||||
Thanks! (and sorry if I forgot to mention someone)
|
Thanks! (and sorry if I forgot to mention someone)
|
||||||
|
21
lib/http.c
21
lib/http.c
@ -1740,6 +1740,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
CURLcode result=CURLE_OK;
|
CURLcode result=CURLE_OK;
|
||||||
struct HTTP *http;
|
struct HTTP *http;
|
||||||
char *ppath = data->reqdata.path;
|
char *ppath = data->reqdata.path;
|
||||||
|
char ftp_typecode[sizeof(";type=?")] = "";
|
||||||
char *host = conn->host.name;
|
char *host = conn->host.name;
|
||||||
const char *te = ""; /* transfer-encoding */
|
const char *te = ""; /* transfer-encoding */
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@ -1950,6 +1951,23 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ppath = data->change.url;
|
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) {
|
if(HTTPREQ_POST_FORM == httpreq) {
|
||||||
/* we must build the whole darned post sequence first, so that we have
|
/* 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 =
|
result =
|
||||||
add_bufferf(req_buffer,
|
add_bufferf(req_buffer,
|
||||||
"%s " /* GET/HEAD/POST/PUT */
|
"%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" /* proxyuserpwd */
|
||||||
"%s" /* userpwd */
|
"%s" /* userpwd */
|
||||||
"%s" /* range */
|
"%s" /* range */
|
||||||
@ -2108,6 +2126,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
|
|||||||
|
|
||||||
request,
|
request,
|
||||||
ppath,
|
ppath,
|
||||||
|
ftp_typecode,
|
||||||
httpstring,
|
httpstring,
|
||||||
conn->allocptr.proxyuserpwd?
|
conn->allocptr.proxyuserpwd?
|
||||||
conn->allocptr.proxyuserpwd:"",
|
conn->allocptr.proxyuserpwd:"",
|
||||||
|
@ -44,7 +44,7 @@ the
|
|||||||
^User-Agent:.*
|
^User-Agent:.*
|
||||||
</strip>
|
</strip>
|
||||||
<protocol>
|
<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
|
Authorization: Basic ZGFuaWVsOm15c2VjcmV0
|
||||||
Host: host.com:21
|
Host: host.com:21
|
||||||
Pragma: no-cache
|
Pragma: no-cache
|
||||||
|
@ -45,7 +45,7 @@ ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79 -x %HOSTIP:%HTTPPORT
|
|||||||
^User-Agent:.*
|
^User-Agent:.*
|
||||||
</strip>
|
</strip>
|
||||||
<protocol>
|
<protocol>
|
||||||
GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79 HTTP/1.1
|
GET ftp://%HOSTIP:%HTTPPORT/we/want/that/page/79;type=i HTTP/1.1
|
||||||
Host: %HOSTIP:%HTTPPORT
|
Host: %HOSTIP:%HTTPPORT
|
||||||
Pragma: no-cache
|
Pragma: no-cache
|
||||||
Accept: */*
|
Accept: */*
|
||||||
|
Loading…
Reference in New Issue
Block a user