pp->endofresp = ftp_endofresp;
pp->conn = conn;
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
- /* for FTP over HTTP proxy */
- struct HTTP http_proxy;
- struct FTP *ftp_save;
-
- /* 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 = data->state.proto.ftp;
- memset(&http_proxy, 0, sizeof(http_proxy));
- data->state.proto.http = &http_proxy;
-
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name, conn->remote_port);
-
- data->state.proto.ftp = ftp_save;
-
- if(CURLE_OK != result)
- return result;
- }
-
if(conn->handler->flags & PROTOPT_SSL) {
/* BLOCKING */
result = Curl_ssl_connect(conn, FIRSTSOCKET);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 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
function to make the re-use checks properly be able to check this bit. */
conn->bits.close = FALSE;
-#ifndef CURL_DISABLE_PROXY
- /* If we are not using a proxy and we want a secure connection, perform SSL
- * initialization & connection now. If using a proxy with https, then we
- * must tell the proxy to CONNECT to the host we want to talk to. Only
- * after the connect has occurred, can we start talking SSL
- */
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
-
- /* either SSL over proxy, or explicitly asked for */
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name,
- conn->remote_port);
- if(CURLE_OK != result)
- return result;
- }
-
if(conn->bits.tunnel_connecting) {
/* nothing else to do except wait right now - we're not done here. */
return CURLE_OK;
}
-#endif /* CURL_DISABLE_PROXY */
if(conn->given->flags & PROTOPT_SSL) {
/* perform SSL initialization */
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2012, 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
pp->endofresp = imap_endofresp;
pp->conn = conn;
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
- /* for IMAP over HTTP proxy */
- struct HTTP http_proxy;
- struct FTP *imap_save;
-
- /* BLOCKING */
- /* We want "seamless" IMAP operations through HTTP proxy tunnel */
-
- /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
- * conn->proto.http; we want IMAP 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
- * IMAP pointer
- */
- imap_save = data->state.proto.imap;
- memset(&http_proxy, 0, sizeof(http_proxy));
- data->state.proto.http = &http_proxy;
-
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name, conn->remote_port);
-
- data->state.proto.imap = imap_save;
-
- if(CURLE_OK != result)
- return result;
- }
-
if((conn->handler->flags & PROTOPT_SSL) &&
data->state.used_interface != Curl_if_multi) {
/* BLOCKING */
ldap_set_option(li->ld, LDAP_OPT_PROTOCOL_VERSION, &proto);
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
- /* for LDAP over HTTP proxy */
- struct HTTP http_proxy;
- ldapconninfo *li_save;
- CURLcode result;
-
- /* BLOCKING */
- /* We want "seamless" LDAP operations through HTTP proxy tunnel */
-
- /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
- * conn->proto.http; we want LDAP 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
- * LDAP pointer
- */
- li_save = data->state.proto.generic;
- memset(&http_proxy, 0, sizeof(http_proxy));
- data->state.proto.http = &http_proxy;
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name, conn->remote_port);
-
- data->state.proto.generic = li_save;
-
- if(CURLE_OK != result)
- return result;
- }
-
#ifdef USE_SSL
if(conn->handler->flags & PROTOPT_SSL) {
CURLcode res;
pp->endofresp = pop3_endofresp;
pp->conn = conn;
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
- /* for POP3 over HTTP proxy */
- struct HTTP http_proxy;
- struct FTP *pop3_save;
-
- /* BLOCKING */
- /* We want "seamless" POP3 operations through HTTP proxy tunnel */
-
- /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
- * conn->proto.http; we want POP3 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
- * POP3 pointer
- */
- pop3_save = data->state.proto.pop3;
- memset(&http_proxy, 0, sizeof(http_proxy));
- data->state.proto.http = &http_proxy;
-
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name, conn->remote_port);
-
- data->state.proto.pop3 = pop3_save;
-
- if(CURLE_OK != result)
- return result;
- }
-
if(conn->handler->flags & PROTOPT_SSL) {
/* BLOCKING */
result = Curl_ssl_connect(conn, FIRSTSOCKET);
pp->endofresp = smtp_endofresp;
pp->conn = conn;
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
- /* for SMTP over HTTP proxy */
- struct HTTP http_proxy;
- struct FTP *smtp_save;
-
- /* BLOCKING */
- /* We want "seamless" SMTP operations through HTTP proxy tunnel */
-
- /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
- * conn->proto.http; we want SMTP 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
- * SMTP pointer
- */
- smtp_save = data->state.proto.smtp;
- memset(&http_proxy, 0, sizeof(http_proxy));
- data->state.proto.http = &http_proxy;
-
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name, conn->remote_port);
-
- data->state.proto.smtp = smtp_save;
-
- if(CURLE_OK != result)
- return result;
- }
-
if((conn->handler->protocol & CURLPROTO_SMTPS) &&
data->state.used_interface != Curl_if_multi) {
/* SMTPS is simply smtp with SSL for the control channel */
#include "multiif.h"
#include "select.h"
#include "warnless.h"
-#include "http_proxy.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
sessionhandle, deal with it */
Curl_reset_reqproto(conn);
- if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
- /* for SSH over HTTP proxy */
- struct HTTP http_proxy;
- struct SSHPROTO *ssh_save;
-
- /* BLOCKING */
- /* We want "seamless" SSH operations through HTTP proxy tunnel */
-
- /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the member
- * conn->proto.http; we want SSH 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
- * SSH pointer
- */
- ssh_save = data->state.proto.ssh;
- memset(&http_proxy, 0, sizeof(http_proxy));
- data->state.proto.http = &http_proxy;
-
- result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
- conn->host.name, conn->remote_port);
-
- data->state.proto.ssh = ssh_save;
-
- if(CURLE_OK != result)
- return result;
- }
-
result = ssh_init(conn);
if(result)
return result;
#include "socks.h"
#include "curl_rtmp.h"
#include "gopher.h"
+#include "http_proxy.h"
#define _MPRINTF_REPLACE /* use our functions only */
#include <curl/mprintf.h>
Curl_verboseconnect(conn);
if(!conn->bits.protoconnstart) {
+
+ /* Set start time here for timeout purposes in the connect procedure, it
+ is later set again for the progress meter purpose */
+ conn->now = Curl_tvnow();
+
+ if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
+#ifndef CURL_DISABLE_PROXY
+ /* for [protocol] tunneled through HTTP proxy */
+ struct HTTP http_proxy;
+ void *prot_save;
+
+ /* BLOCKING */
+ /* We want "seamless" operations through HTTP proxy tunnel */
+
+ /* Curl_proxyCONNECT is based on a pointer to a struct HTTP at the
+ * member conn->proto.http; we want [protocol] 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 pointer
+ */
+ prot_save = data->state.proto.generic;
+ memset(&http_proxy, 0, sizeof(http_proxy));
+ data->state.proto.http = &http_proxy;
+
+ result = Curl_proxyCONNECT(conn, FIRSTSOCKET,
+ conn->host.name, conn->remote_port);
+
+ data->state.proto.generic = prot_save;
+
+ if(CURLE_OK != result)
+ return result;
+#else
+ return CURLE_NOT_BUILT_IN;
+#endif
+ }
+
if(conn->handler->connect_it) {
/* is there a protocol-specific connect() procedure? */
- /* Set start time here for timeout purposes in the connect procedure, it
- is later set again for the progress meter purpose */
- conn->now = Curl_tvnow();
-
/* Call the protocol-specific connect function */
result = conn->handler->connect_it(conn, protocol_done);
}