mirror of https://github.com/moparisthebest/curl
vtls: move the SUPPORT_HTTPS_PROXY flag into the Curl_ssl struct
That will allow us to choose the SSL backend at runtime. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
parent
937899a3b8
commit
f0b4db1ab0
13
lib/url.c
13
lib/url.c
|
@ -5082,13 +5082,14 @@ static CURLcode parse_proxy(struct Curl_easy *data,
|
||||||
else
|
else
|
||||||
proxyptr = proxy; /* No xxx:// head: It's a HTTP proxy */
|
proxyptr = proxy; /* No xxx:// head: It's a HTTP proxy */
|
||||||
|
|
||||||
#ifndef HTTPS_PROXY_SUPPORT
|
#ifdef USE_SSL
|
||||||
if(proxytype == CURLPROXY_HTTPS) {
|
if(!Curl_ssl->support_https_proxy)
|
||||||
failf(data, "Unsupported proxy \'%s\'"
|
|
||||||
", libcurl is built without the HTTPS-proxy support.", proxy);
|
|
||||||
return CURLE_NOT_BUILT_IN;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
if(proxytype == CURLPROXY_HTTPS) {
|
||||||
|
failf(data, "Unsupported proxy \'%s\', libcurl is built without the "
|
||||||
|
"HTTPS-proxy support.", proxy);
|
||||||
|
return CURLE_NOT_BUILT_IN;
|
||||||
|
}
|
||||||
|
|
||||||
sockstype = proxytype == CURLPROXY_SOCKS5_HOSTNAME ||
|
sockstype = proxytype == CURLPROXY_SOCKS5_HOSTNAME ||
|
||||||
proxytype == CURLPROXY_SOCKS5 ||
|
proxytype == CURLPROXY_SOCKS5 ||
|
||||||
|
|
|
@ -323,9 +323,6 @@ static curl_version_info_data version_info = {
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_LIBPSL)
|
#if defined(USE_LIBPSL)
|
||||||
| CURL_VERSION_PSL
|
| CURL_VERSION_PSL
|
||||||
#endif
|
|
||||||
#if defined(HTTPS_PROXY_SUPPORT)
|
|
||||||
| CURL_VERSION_HTTPS_PROXY
|
|
||||||
#endif
|
#endif
|
||||||
,
|
,
|
||||||
NULL, /* ssl_version */
|
NULL, /* ssl_version */
|
||||||
|
@ -355,6 +352,10 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
|
||||||
#ifdef USE_SSL
|
#ifdef USE_SSL
|
||||||
Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
|
Curl_ssl_version(ssl_buffer, sizeof(ssl_buffer));
|
||||||
version_info.ssl_version = ssl_buffer;
|
version_info.ssl_version = ssl_buffer;
|
||||||
|
if(Curl_ssl->support_https_proxy)
|
||||||
|
version_info.features |= CURL_VERSION_HTTPS_PROXY;
|
||||||
|
else
|
||||||
|
version_info.features &= ~CURL_VERSION_HTTPS_PROXY;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBZ
|
#ifdef HAVE_LIBZ
|
||||||
|
|
|
@ -709,6 +709,7 @@ const struct Curl_ssl Curl_ssl_axtls = {
|
||||||
0, /* have_certinfo */
|
0, /* have_certinfo */
|
||||||
0, /* have_pinnedpubkey */
|
0, /* have_pinnedpubkey */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_axtls_init, /* init */
|
Curl_axtls_init, /* init */
|
||||||
Curl_axtls_cleanup, /* cleanup */
|
Curl_axtls_cleanup, /* cleanup */
|
||||||
|
|
|
@ -974,6 +974,7 @@ const struct Curl_ssl Curl_ssl_cyassl = {
|
||||||
0, /* have_pinnedpubkey */
|
0, /* have_pinnedpubkey */
|
||||||
#endif
|
#endif
|
||||||
1, /* have_ssl_ctx */
|
1, /* have_ssl_ctx */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_cyassl_init, /* init */
|
Curl_cyassl_init, /* init */
|
||||||
Curl_none_cleanup, /* cleanup */
|
Curl_none_cleanup, /* cleanup */
|
||||||
|
|
|
@ -2886,6 +2886,7 @@ const struct Curl_ssl Curl_ssl_darwinssl = {
|
||||||
0, /* have_pinnedpubkey */
|
0, /* have_pinnedpubkey */
|
||||||
#endif /* DARWIN_SSL_PINNEDPUBKEY */
|
#endif /* DARWIN_SSL_PINNEDPUBKEY */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_none_init, /* init */
|
Curl_none_init, /* init */
|
||||||
Curl_none_cleanup, /* cleanup */
|
Curl_none_cleanup, /* cleanup */
|
||||||
|
|
|
@ -1341,6 +1341,9 @@ const struct Curl_ssl Curl_ssl_gskit = {
|
||||||
1, /* have_certinfo */
|
1, /* have_certinfo */
|
||||||
0, /* have_pinnedpubkey */
|
0, /* have_pinnedpubkey */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
/* TODO: convert to 1 and fix test #1014 (if need) */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
|
|
||||||
Curl_gskit_init, /* init */
|
Curl_gskit_init, /* init */
|
||||||
Curl_gskit_cleanup, /* cleanup */
|
Curl_gskit_cleanup, /* cleanup */
|
||||||
|
|
|
@ -41,9 +41,6 @@ int Curl_gskit_shutdown(struct connectdata *conn, int sockindex);
|
||||||
size_t Curl_gskit_version(char *buffer, size_t size);
|
size_t Curl_gskit_version(char *buffer, size_t size);
|
||||||
int Curl_gskit_check_cxn(struct connectdata *cxn);
|
int Curl_gskit_check_cxn(struct connectdata *cxn);
|
||||||
|
|
||||||
/* Support HTTPS-proxy */
|
|
||||||
/* TODO: add '#define HTTPS_PROXY_SUPPORT 1' and fix test #1014 (if need) */
|
|
||||||
|
|
||||||
extern const struct Curl_ssl Curl_ssl_gskit;
|
extern const struct Curl_ssl Curl_ssl_gskit;
|
||||||
|
|
||||||
/* Set the API backend definition to GSKit */
|
/* Set the API backend definition to GSKit */
|
||||||
|
|
|
@ -1793,6 +1793,7 @@ const struct Curl_ssl Curl_ssl_gnutls = {
|
||||||
1, /* have_certinfo */
|
1, /* have_certinfo */
|
||||||
1, /* have_pinnedpubkey */
|
1, /* have_pinnedpubkey */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
1, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_gtls_init, /* init */
|
Curl_gtls_init, /* init */
|
||||||
Curl_gtls_cleanup, /* cleanup */
|
Curl_gtls_cleanup, /* cleanup */
|
||||||
|
|
|
@ -49,9 +49,6 @@ CURLcode Curl_gtls_random(struct Curl_easy *data,
|
||||||
|
|
||||||
bool Curl_gtls_cert_status_request(void);
|
bool Curl_gtls_cert_status_request(void);
|
||||||
|
|
||||||
/* Support HTTPS-proxy */
|
|
||||||
#define HTTPS_PROXY_SUPPORT 1
|
|
||||||
|
|
||||||
extern const struct Curl_ssl Curl_ssl_gnutls;
|
extern const struct Curl_ssl Curl_ssl_gnutls;
|
||||||
|
|
||||||
/* Set the API backend definition to GnuTLS */
|
/* Set the API backend definition to GnuTLS */
|
||||||
|
|
|
@ -1022,6 +1022,7 @@ const struct Curl_ssl Curl_ssl_mbedtls = {
|
||||||
0, /* have_certinfo */
|
0, /* have_certinfo */
|
||||||
1, /* have_pinnedpubkey */
|
1, /* have_pinnedpubkey */
|
||||||
1, /* have_ssl_ctx */
|
1, /* have_ssl_ctx */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_mbedtls_init, /* init */
|
Curl_mbedtls_init, /* init */
|
||||||
Curl_mbedtls_cleanup, /* cleanup */
|
Curl_mbedtls_cleanup, /* cleanup */
|
||||||
|
|
|
@ -2331,6 +2331,7 @@ const struct Curl_ssl Curl_ssl_nss = {
|
||||||
1, /* have_certinfo */
|
1, /* have_certinfo */
|
||||||
1, /* have_pinnedpubkey */
|
1, /* have_pinnedpubkey */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
1, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_nss_init, /* init */
|
Curl_nss_init, /* init */
|
||||||
Curl_nss_cleanup, /* cleanup */
|
Curl_nss_cleanup, /* cleanup */
|
||||||
|
|
|
@ -56,9 +56,6 @@ bool Curl_nss_cert_status_request(void);
|
||||||
|
|
||||||
bool Curl_nss_false_start(void);
|
bool Curl_nss_false_start(void);
|
||||||
|
|
||||||
/* Support HTTPS-proxy */
|
|
||||||
#define HTTPS_PROXY_SUPPORT 1
|
|
||||||
|
|
||||||
extern const struct Curl_ssl Curl_ssl_nss;
|
extern const struct Curl_ssl Curl_ssl_nss;
|
||||||
|
|
||||||
/* Set the API backend definition to NSS */
|
/* Set the API backend definition to NSS */
|
||||||
|
|
|
@ -3394,6 +3394,7 @@ const struct Curl_ssl Curl_ssl_openssl = {
|
||||||
1, /* have_certinfo */
|
1, /* have_certinfo */
|
||||||
1, /* have_pinnedpubkey */
|
1, /* have_pinnedpubkey */
|
||||||
1, /* have_ssl_ctx */
|
1, /* have_ssl_ctx */
|
||||||
|
1, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_ossl_init, /* init */
|
Curl_ossl_init, /* init */
|
||||||
Curl_ossl_cleanup, /* cleanup */
|
Curl_ossl_cleanup, /* cleanup */
|
||||||
|
|
|
@ -71,9 +71,6 @@ CURLcode Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
|
||||||
|
|
||||||
bool Curl_ossl_cert_status_request(void);
|
bool Curl_ossl_cert_status_request(void);
|
||||||
|
|
||||||
/* Support HTTPS-proxy */
|
|
||||||
#define HTTPS_PROXY_SUPPORT 1
|
|
||||||
|
|
||||||
extern const struct Curl_ssl Curl_ssl_openssl;
|
extern const struct Curl_ssl Curl_ssl_openssl;
|
||||||
|
|
||||||
/* Set the API backend definition to OpenSSL */
|
/* Set the API backend definition to OpenSSL */
|
||||||
|
|
|
@ -885,6 +885,7 @@ const struct Curl_ssl Curl_ssl_polarssl = {
|
||||||
0, /* have_certinfo */
|
0, /* have_certinfo */
|
||||||
1, /* have_pinnedpubkey */
|
1, /* have_pinnedpubkey */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_polarssl_init, /* init */
|
Curl_polarssl_init, /* init */
|
||||||
Curl_polarssl_cleanup, /* cleanup */
|
Curl_polarssl_cleanup, /* cleanup */
|
||||||
|
|
|
@ -1733,6 +1733,7 @@ const struct Curl_ssl Curl_ssl_schannel = {
|
||||||
1, /* have_certinfo */
|
1, /* have_certinfo */
|
||||||
0, /* have_pinnedpubkey */
|
0, /* have_pinnedpubkey */
|
||||||
0, /* have_ssl_ctx */
|
0, /* have_ssl_ctx */
|
||||||
|
0, /* support_https_proxy */
|
||||||
|
|
||||||
Curl_schannel_init, /* init */
|
Curl_schannel_init, /* init */
|
||||||
Curl_schannel_cleanup, /* cleanup */
|
Curl_schannel_cleanup, /* cleanup */
|
||||||
|
|
|
@ -205,12 +205,10 @@ ssl_connect_init_proxy(struct connectdata *conn, int sockindex)
|
||||||
DEBUGASSERT(conn->bits.proxy_ssl_connected[sockindex]);
|
DEBUGASSERT(conn->bits.proxy_ssl_connected[sockindex]);
|
||||||
if(ssl_connection_complete == conn->ssl[sockindex].state &&
|
if(ssl_connection_complete == conn->ssl[sockindex].state &&
|
||||||
!conn->proxy_ssl[sockindex].use) {
|
!conn->proxy_ssl[sockindex].use) {
|
||||||
#if defined(HTTPS_PROXY_SUPPORT)
|
if(!Curl_ssl->support_https_proxy)
|
||||||
|
return CURLE_NOT_BUILT_IN;
|
||||||
conn->proxy_ssl[sockindex] = conn->ssl[sockindex];
|
conn->proxy_ssl[sockindex] = conn->ssl[sockindex];
|
||||||
memset(&conn->ssl[sockindex], 0, sizeof(conn->ssl[sockindex]));
|
memset(&conn->ssl[sockindex], 0, sizeof(conn->ssl[sockindex]));
|
||||||
#else
|
|
||||||
return CURLE_NOT_BUILT_IN;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,8 @@ struct Curl_ssl {
|
||||||
unsigned have_pinnedpubkey:1; /* supports CURLOPT_PINNEDPUBLICKEY */
|
unsigned have_pinnedpubkey:1; /* supports CURLOPT_PINNEDPUBLICKEY */
|
||||||
unsigned have_ssl_ctx:1; /* supports CURLOPT_SSL_CTX_* */
|
unsigned have_ssl_ctx:1; /* supports CURLOPT_SSL_CTX_* */
|
||||||
|
|
||||||
|
unsigned support_https_proxy:1; /* supports access via HTTPS proxies */
|
||||||
|
|
||||||
int (*init)(void);
|
int (*init)(void);
|
||||||
void (*cleanup)(void);
|
void (*cleanup)(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue