From 02dbfa21921aded6bba292b99dd224fe450e7254 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 4 Apr 2011 16:24:37 +0200 Subject: http-proxy: move proxy code to http_proxy.c The new http_proxy.* files now host HTTP proxy specific code (500+ lines moved out from http.c), and as a consequence there is a macro introduced for the Curl_proxyCONNECT() function so that code can use it without actually supporting proxy (or HTTP) in builds. --- lib/http_proxy.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/http_proxy.h (limited to 'lib/http_proxy.h') diff --git a/lib/http_proxy.h b/lib/http_proxy.h new file mode 100644 index 000000000..da08fa50a --- /dev/null +++ b/lib/http_proxy.h @@ -0,0 +1,33 @@ +/*************************************************************************** + * _ _ ____ _ + * Project ___| | | | _ \| | + * / __| | | | |_) | | + * | (__| |_| | _ <| |___ + * \___|\___/|_| \_\_____| + * + * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * + * This software is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at http://curl.haxx.se/docs/copyright.html. + * + * You may opt to use, copy, modify, merge, publish, distribute and/or sell + * copies of the Software, and permit persons to whom the Software is + * furnished to do so, under the terms of the COPYING file. + * + * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY + * KIND, either express or implied. + * + ***************************************************************************/ +#if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) +/* ftp can use this as well */ +CURLcode Curl_proxyCONNECT(struct connectdata *conn, + int tunnelsocket, + const char *hostname, unsigned short remote_port); + +/* Default proxy timeout in milliseconds */ +#define PROXY_TIMEOUT (3600*1000) + +#else +#define Curl_proxyCONNECT(x,y,x,w) CURLE_FAILED_INIT +#endif -- cgit v1.2.1 From 01f05d0c758795e5bb02c6245fc73b8458eb397a Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 5 Apr 2011 15:14:02 +0200 Subject: return code cleanup: build, init and run-time errors Stop the abuse of CURLE_FAILED_INIT as return code for things not being init related by introducing two new return codes: CURLE_NOT_BUILT_IN and CURLE_UNKNOWN_OPTION CURLE_NOT_BUILT_IN replaces return code 4 that has been obsoleted for several years. It is used for returning error when something is attempted to be used but the feature/option was not enabled or explictitly disabled at build-time. Getting this error mostly means that libcurl needs to be rebuilt. CURLE_FAILED_INIT is now saved and used strictly for init failures. Getting this problem means something went seriously wrong, like a resource shortage or similar. CURLE_UNKNOWN_OPTION is the option formerly known as CURLE_UNKNOWN_TELNET_OPTION (and the old name is still present, separately defined to be removed in a very distant future). This error code is meant to be used to return when an option is given to libcurl that isn't known. This problem would mostly indicate a problem in the program that uses libcurl. --- lib/http_proxy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/http_proxy.h') diff --git a/lib/http_proxy.h b/lib/http_proxy.h index da08fa50a..271b98a6e 100644 --- a/lib/http_proxy.h +++ b/lib/http_proxy.h @@ -29,5 +29,5 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, #define PROXY_TIMEOUT (3600*1000) #else -#define Curl_proxyCONNECT(x,y,x,w) CURLE_FAILED_INIT +#define Curl_proxyCONNECT(x,y,x,w) CURLE_NOT_BUILT_IN #endif -- cgit v1.2.1 From 6eb484942b011aceb1ca00d7a126c07d06e6eea9 Mon Sep 17 00:00:00 2001 From: Dan Fandrich Date: Tue, 5 Apr 2011 22:28:26 -0700 Subject: Don't list NTLM in curl-config when HTTP is disabled Also, fixed Curl_proxyCONNECT() stub with HTTP disabled. --- lib/http_proxy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/http_proxy.h') diff --git a/lib/http_proxy.h b/lib/http_proxy.h index 271b98a6e..5ea0a21af 100644 --- a/lib/http_proxy.h +++ b/lib/http_proxy.h @@ -29,5 +29,5 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, #define PROXY_TIMEOUT (3600*1000) #else -#define Curl_proxyCONNECT(x,y,x,w) CURLE_NOT_BUILT_IN +#define Curl_proxyCONNECT(x,y,z,w) CURLE_NOT_BUILT_IN #endif -- cgit v1.2.1 From a41c7f97367b893acc4764ac270f7f6cd2374976 Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Tue, 24 May 2011 15:42:02 +0200 Subject: build: inclusion guard Enclose header file in an inclusion guard --- lib/http_proxy.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/http_proxy.h') diff --git a/lib/http_proxy.h b/lib/http_proxy.h index 5ea0a21af..3caf9287f 100644 --- a/lib/http_proxy.h +++ b/lib/http_proxy.h @@ -1,3 +1,5 @@ +#ifndef HEADER_CURL_HTTP_PROXY_H +#define HEADER_CURL_HTTP_PROXY_H /*************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | @@ -31,3 +33,5 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, #else #define Curl_proxyCONNECT(x,y,z,w) CURLE_NOT_BUILT_IN #endif + +#endif /* HEADER_CURL_HTTP_PROXY_H */ -- cgit v1.2.1 From c83de6d07625b813e3bbc31f9a0827c3a0007355 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 21 Mar 2012 23:22:39 +0100 Subject: CONNECT: fix multi interface regression The refactoring of HTTP CONNECT handling in commit 41b0237834232 that made it protocol independent broke it for the multi interface. This fix now introduce a better state handling and moved some logic to the http_proxy.c source file. Reported by: Yang Tse Bug: http://curl.haxx.se/mail/lib-2012-03/0162.html --- lib/http_proxy.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/http_proxy.h') diff --git a/lib/http_proxy.h b/lib/http_proxy.h index 3caf9287f..197996f9e 100644 --- a/lib/http_proxy.h +++ b/lib/http_proxy.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2011, Daniel Stenberg, , et al. + * Copyright (C) 1998 - 2012, Daniel Stenberg, , et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -21,6 +21,9 @@ * KIND, either express or implied. * ***************************************************************************/ + +CURLcode Curl_proxy_connect(struct connectdata *conn); + #if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) /* ftp can use this as well */ CURLcode Curl_proxyCONNECT(struct connectdata *conn, -- cgit v1.2.1 From fe93b0a8740f6d105c94c2aee0d2613aacbb5e4d Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 22 Mar 2012 17:27:14 +0100 Subject: http_proxy.h: fix builds with proxy or http disabled --- lib/http_proxy.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/http_proxy.h') diff --git a/lib/http_proxy.h b/lib/http_proxy.h index 197996f9e..518c09383 100644 --- a/lib/http_proxy.h +++ b/lib/http_proxy.h @@ -22,8 +22,6 @@ * ***************************************************************************/ -CURLcode Curl_proxy_connect(struct connectdata *conn); - #if !defined(CURL_DISABLE_PROXY) && !defined(CURL_DISABLE_HTTP) /* ftp can use this as well */ CURLcode Curl_proxyCONNECT(struct connectdata *conn, @@ -33,8 +31,11 @@ CURLcode Curl_proxyCONNECT(struct connectdata *conn, /* Default proxy timeout in milliseconds */ #define PROXY_TIMEOUT (3600*1000) +CURLcode Curl_proxy_connect(struct connectdata *conn); + #else #define Curl_proxyCONNECT(x,y,z,w) CURLE_NOT_BUILT_IN +#define Curl_proxy_connect(x) CURLE_OK #endif #endif /* HEADER_CURL_HTTP_PROXY_H */ -- cgit v1.2.1