aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-12-02 23:38:23 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-12-02 23:38:23 +0000
commit1c93e75375882ed309c7d93a1ce59d27a53f23d3 (patch)
treec5d2406eff23e3930dcb6dfd53be0bc20266d271 /lib
parent380ed8bebf4aa3bc605077c8cf5350986ae031a5 (diff)
Michal Marek introduced CURLOPT_PROXY_TRANSFER_MODE which is used to control
the appending of the "type=" thing on FTP URLs when they are passed to a HTTP proxy. Some proxies just don't like that appending (which is done unconditionally in 7.17.1), and some proxies treat binary/ascii transfers better with the appending done!
Diffstat (limited to 'lib')
-rw-r--r--lib/http.c30
-rw-r--r--lib/url.c17
-rw-r--r--lib/urldata.h2
3 files changed, 35 insertions, 14 deletions
diff --git a/lib/http.c b/lib/http.c
index 635506e08..7cfb23f3c 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -2122,22 +2122,24 @@ 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((int)((unsigned char)p[6]))) {
- case 'A':
- case 'D':
- case 'I':
- break;
- default:
- p = NULL;
+ if (data->set.proxy_transfer_mode) {
+ /* 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((int)((unsigned char)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(!p)
- snprintf(ftp_typecode, sizeof(ftp_typecode), ";type=%c",
- data->set.prefer_ascii ? 'a' : 'i');
}
}
if(HTTPREQ_POST_FORM == httpreq) {
diff --git a/lib/url.c b/lib/url.c
index e7c1412bf..a176ac225 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -2036,6 +2036,23 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option,
*/
data->set.new_directory_perms = va_arg(param, long);
break;
+ case CURLOPT_PROXY_TRANSFER_MODE:
+ /*
+ * set transfer mode (;type=<a|i>) when doing FTP via an HTTP proxy
+ */
+ switch (va_arg(param, long)) {
+ case 0:
+ data->set.proxy_transfer_mode = FALSE;
+ break;
+ case 1:
+ data->set.proxy_transfer_mode = TRUE;
+ break;
+ default:
+ /* reserve other values for future use */
+ result = CURLE_FAILED_INIT;
+ break;
+ }
+ break;
default:
/* unknown tag and its companion, just ignore: */
diff --git a/lib/urldata.h b/lib/urldata.h
index 0188a8e93..9febb8415 100644
--- a/lib/urldata.h
+++ b/lib/urldata.h
@@ -1439,6 +1439,8 @@ struct UserDefined {
content-encoded (chunked, compressed) */
long new_file_perms; /* Permissions to use when creating remote files */
long new_directory_perms; /* Permissions to use when creating remote dirs */
+ bool proxy_transfer_mode; /* set transfer mode (;type=<a|i>) when doing FTP
+ via an HTTP proxy */
char *str[STRING_LAST]; /* array of strings, pointing to allocated memory */
};