FTP+proxy: macrofied functions when proxy disabled
In my attempts to reduce #ifdefs in code, the SOCKS functions are now macros when libcurl is built without proxy support and therefore the FTP code could avoid some #ifs.
This commit is contained in:
parent
8e9e19b0d5
commit
8321a367ee
@ -1719,7 +1719,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
|
|||||||
ftp_pasv_verbose(conn, conninfo, newhost, connectport);
|
ftp_pasv_verbose(conn, conninfo, newhost, connectport);
|
||||||
|
|
||||||
switch(data->set.proxytype) {
|
switch(data->set.proxytype) {
|
||||||
#ifndef CURL_DISABLE_PROXY
|
|
||||||
/* FIX: this MUST wait for a proper connect first if 'connected' is
|
/* FIX: this MUST wait for a proper connect first if 'connected' is
|
||||||
* FALSE */
|
* FALSE */
|
||||||
case CURLPROXY_SOCKS5:
|
case CURLPROXY_SOCKS5:
|
||||||
@ -1735,7 +1734,6 @@ static CURLcode ftp_state_pasv_resp(struct connectdata *conn,
|
|||||||
result = Curl_SOCKS4(conn->proxyuser, newhost, newport,
|
result = Curl_SOCKS4(conn->proxyuser, newhost, newport,
|
||||||
SECONDARYSOCKET, conn, TRUE);
|
SECONDARYSOCKET, conn, TRUE);
|
||||||
break;
|
break;
|
||||||
#endif /* CURL_DISABLE_PROXY */
|
|
||||||
case CURLPROXY_HTTP:
|
case CURLPROXY_HTTP:
|
||||||
case CURLPROXY_HTTP_1_0:
|
case CURLPROXY_HTTP_1_0:
|
||||||
/* do nothing here. handled later. */
|
/* do nothing here. handled later. */
|
||||||
@ -2924,7 +2922,6 @@ static CURLcode ftp_connect(struct connectdata *conn,
|
|||||||
pp->endofresp = ftp_endofresp;
|
pp->endofresp = ftp_endofresp;
|
||||||
pp->conn = conn;
|
pp->conn = conn;
|
||||||
|
|
||||||
#if !defined(CURL_DISABLE_HTTP) && !defined(CURL_DISABLE_PROXY)
|
|
||||||
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
|
if(conn->bits.tunnel_proxy && conn->bits.httpproxy) {
|
||||||
/* for FTP over HTTP proxy */
|
/* for FTP over HTTP proxy */
|
||||||
struct HTTP http_proxy;
|
struct HTTP http_proxy;
|
||||||
@ -2951,7 +2948,6 @@ static CURLcode ftp_connect(struct connectdata *conn,
|
|||||||
if(CURLE_OK != result)
|
if(CURLE_OK != result)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif /* !CURL_DISABLE_HTTP && !CURL_DISABLE_PROXY */
|
|
||||||
|
|
||||||
if(conn->handler->protocol & CURLPROTO_FTPS) {
|
if(conn->handler->protocol & CURLPROTO_FTPS) {
|
||||||
/* BLOCKING */
|
/* BLOCKING */
|
||||||
|
16
lib/socks.h
16
lib/socks.h
@ -1,5 +1,5 @@
|
|||||||
#ifndef __SOCKS_H
|
#ifndef __CURL_SOCKS_H
|
||||||
#define __SOCKS_H
|
#define __CURL_SOCKS_H
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* _ _ ____ _
|
* _ _ ____ _
|
||||||
* Project ___| | | | _ \| |
|
* Project ___| | | | _ \| |
|
||||||
@ -7,7 +7,7 @@
|
|||||||
* | (__| |_| | _ <| |___
|
* | (__| |_| | _ <| |___
|
||||||
* \___|\___/|_| \_\_____|
|
* \___|\___/|_| \_\_____|
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998 - 2009, Daniel Stenberg, <daniel@haxx.se>, et al.
|
* Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
*
|
*
|
||||||
* This software is licensed as described in the file COPYING, which
|
* This software is licensed as described in the file COPYING, which
|
||||||
* you should have received as part of this distribution. The terms
|
* you should have received as part of this distribution. The terms
|
||||||
@ -22,6 +22,12 @@
|
|||||||
*
|
*
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "setup.h"
|
||||||
|
|
||||||
|
#ifdef CURL_DISABLE_PROXY
|
||||||
|
#define Curl_SOCKS4(a,b,c,d,e,f) CURLE_FAILED_INIT
|
||||||
|
#define Curl_SOCKS5(a,b,c,d,e,f) CURLE_FAILED_INIT
|
||||||
|
#else
|
||||||
/*
|
/*
|
||||||
* Helper read-from-socket functions. Does the same as Curl_read() but it
|
* Helper read-from-socket functions. Does the same as Curl_read() but it
|
||||||
* blocks until all bytes amount of buffersize will be read. No more, no less.
|
* blocks until all bytes amount of buffersize will be read. No more, no less.
|
||||||
@ -66,4 +72,6 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(int sockindex,
|
|||||||
struct connectdata *conn);
|
struct connectdata *conn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __SOCKS_H */
|
#endif /* CURL_DISABLE_PROXY */
|
||||||
|
|
||||||
|
#endif /* __CURL_SOCKS_H */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user