diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-01-12 12:40:04 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-01-12 12:40:04 +0000 |
commit | 31c7aa0ba4dfcd69099ed2b669c35d40d05df69c (patch) | |
tree | bee75bb96c25213d268607dc73ee7fa504bababb /lib | |
parent | fc2388189fcee7ab975d3358dd83e5709bc0e9b4 (diff) |
Michael Jahn fixed ftp over CONNECT
Diffstat (limited to 'lib')
-rw-r--r-- | lib/ftp.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -1675,7 +1675,22 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn, /* BLOCKING */ /* We want "seamless" FTP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want FTP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * FTP pointer + */ + struct HTTP http_proxy; + struct FTP *ftp_save = conn->proto.ftp; + memset(&http_proxy, 0, sizeof(http_proxy)); + conn->proto.http = &http_proxy; + result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, newhost, newport); + + conn->proto.ftp = ftp_save; + if(CURLE_OK != result) return result; } @@ -2726,6 +2741,11 @@ CURLcode Curl_ftp_connect(struct connectdata *conn, { struct FTP *ftp; CURLcode result; +#ifndef CURL_DISABLE_HTTP + /* for FTP over HTTP proxy */ + struct HTTP http_proxy; + struct FTP *ftp_save; +#endif /* CURL_DISABLE_HTTP */ *done = FALSE; /* default to not done yet */ @@ -2753,8 +2773,22 @@ CURLcode Curl_ftp_connect(struct connectdata *conn, if (conn->bits.tunnel_proxy) { /* BLOCKING */ /* We want "seamless" FTP operations through HTTP proxy tunnel */ + + /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member + * conn->proto.http; we want FTP through HTTP and we have to change the + * member temporarily for connecting to the HTTP proxy. After + * Curl_proxyCONNECT we have to set back the member to the original struct + * FTP pointer + */ + ftp_save = conn->proto.ftp; + memset(&http_proxy, 0, sizeof(http_proxy)); + conn->proto.http = &http_proxy; + result = Curl_proxyCONNECT(conn, FIRSTSOCKET, conn->host.name, conn->remote_port); + + conn->proto.ftp = ftp_save; + if(CURLE_OK != result) return result; } |