aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
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 */
};