]> granicus.if.org Git - curl/commitdiff
vtls: move the SUPPORT_HTTPS_PROXY flag into the Curl_ssl struct
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Mon, 26 Jun 2017 16:05:38 +0000 (18:05 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 28 Aug 2017 12:56:56 +0000 (14:56 +0200)
That will allow us to choose the SSL backend at runtime.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
18 files changed:
lib/url.c
lib/version.c
lib/vtls/axtls.c
lib/vtls/cyassl.c
lib/vtls/darwinssl.c
lib/vtls/gskit.c
lib/vtls/gskit.h
lib/vtls/gtls.c
lib/vtls/gtls.h
lib/vtls/mbedtls.c
lib/vtls/nss.c
lib/vtls/nssg.h
lib/vtls/openssl.c
lib/vtls/openssl.h
lib/vtls/polarssl.c
lib/vtls/schannel.c
lib/vtls/vtls.c
lib/vtls/vtls.h

index dd254af541169533022934a5ab0ba57b9d937e5c..6d6a56e1f85ebd200837225461d7efea513dc074 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -5082,13 +5082,14 @@ static CURLcode parse_proxy(struct Curl_easy *data,
   else
     proxyptr = proxy; /* No xxx:// head: It's a HTTP proxy */
 
-#ifndef HTTPS_PROXY_SUPPORT
-  if(proxytype == CURLPROXY_HTTPS) {
-    failf(data, "Unsupported proxy \'%s\'"
-                ", libcurl is built without the HTTPS-proxy support.", proxy);
-    return CURLE_NOT_BUILT_IN;
-  }
+#ifdef USE_SSL
+  if(!Curl_ssl->support_https_proxy)
 #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 ||
               proxytype == CURLPROXY_SOCKS5 ||
index 3d17768131fbcdee0ec7a24c8b640cefd55d67d6..b1959dee1242acd29e661d00da4195c9be3bb348 100644 (file)
@@ -323,9 +323,6 @@ static curl_version_info_data version_info = {
 #endif
 #if defined(USE_LIBPSL)
   | CURL_VERSION_PSL
-#endif
-#if defined(HTTPS_PROXY_SUPPORT)
-  | CURL_VERSION_HTTPS_PROXY
 #endif
   ,
   NULL, /* ssl_version */
@@ -355,6 +352,10 @@ curl_version_info_data *curl_version_info(CURLversion stamp)
 #ifdef USE_SSL
   Curl_ssl_version(ssl_buffer, sizeof(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
 
 #ifdef HAVE_LIBZ
index 885cbf53223468c03360516c4e6a13c7b077ce95..12c3a4fff73fe50a6c734ffed83abb8b948ab99e 100644 (file)
@@ -709,6 +709,7 @@ const struct Curl_ssl Curl_ssl_axtls = {
   0, /* have_certinfo */
   0, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
+  0, /* support_https_proxy */
 
   Curl_axtls_init,                /* init */
   Curl_axtls_cleanup,             /* cleanup */
index 7f90e913fa258c09f9ffdd1546bf374eb55868e6..59aa1d5b213bdd3b5b0621558669e7e79a1a1bdc 100644 (file)
@@ -974,6 +974,7 @@ const struct Curl_ssl Curl_ssl_cyassl = {
   0, /* have_pinnedpubkey */
 #endif
   1, /* have_ssl_ctx */
+  0, /* support_https_proxy */
 
   Curl_cyassl_init,                /* init */
   Curl_none_cleanup,               /* cleanup */
index 4d755d6b6b1cd648143f67871c7a002a676d30d4..076ee293cb011dac15976325b900c074517b9167 100644 (file)
@@ -2886,6 +2886,7 @@ const struct Curl_ssl Curl_ssl_darwinssl = {
   0, /* have_pinnedpubkey */
 #endif /* DARWIN_SSL_PINNEDPUBKEY */
   0, /* have_ssl_ctx */
+  0, /* support_https_proxy */
 
   Curl_none_init,                     /* init */
   Curl_none_cleanup,                  /* cleanup */
index dc24f044bb312efec3e3273c4c2c4a6bebf7bd86..fc73cf28924f7cd9677f8525521c45467db1f0cf 100644 (file)
@@ -1341,6 +1341,9 @@ const struct Curl_ssl Curl_ssl_gskit = {
   1, /* have_certinfo */
   0, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
+  /* TODO: convert to 1 and fix test #1014 (if need) */
+  0, /* support_https_proxy */
+
 
   Curl_gskit_init,                /* init */
   Curl_gskit_cleanup,             /* cleanup */
index f2f5eb89aa72359110d8f71bbd2468dd085b2265..c8a2810e5cc155b40da6d536d277726b377e2a56 100644 (file)
@@ -41,9 +41,6 @@ int Curl_gskit_shutdown(struct connectdata *conn, int sockindex);
 size_t Curl_gskit_version(char *buffer, size_t size);
 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;
 
 /* Set the API backend definition to GSKit */
index fbbcdf334d2d0f8c25afb5bc9138cf098ce98da5..493520a6261694c8d6fd66a254329d45c46aabdd 100644 (file)
@@ -1793,6 +1793,7 @@ const struct Curl_ssl Curl_ssl_gnutls = {
   1, /* have_certinfo */
   1, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
+  1, /* support_https_proxy */
 
   Curl_gtls_init,                /* init */
   Curl_gtls_cleanup,             /* cleanup */
index d393b889d599e7e44afda60c1f8ec64e49a64e3b..f51cd70cf9a4738771ca0ba99f6eadaf5c8143e8 100644 (file)
@@ -49,9 +49,6 @@ CURLcode Curl_gtls_random(struct Curl_easy *data,
 
 bool Curl_gtls_cert_status_request(void);
 
-/* Support HTTPS-proxy */
-#define HTTPS_PROXY_SUPPORT 1
-
 extern const struct Curl_ssl Curl_ssl_gnutls;
 
 /* Set the API backend definition to GnuTLS */
index c925ea93c560ac38d3d70cf1598e2127404dd7b3..b13c617a4d7f68aa1a11e83fb8d06cad1df9845d 100644 (file)
@@ -1022,6 +1022,7 @@ const struct Curl_ssl Curl_ssl_mbedtls = {
   0, /* have_certinfo */
   1, /* have_pinnedpubkey */
   1, /* have_ssl_ctx */
+  0, /* support_https_proxy */
 
   Curl_mbedtls_init,                /* init */
   Curl_mbedtls_cleanup,             /* cleanup */
index ff338940c730bf1a4f8265ab205215b2ca4a5907..8c216184379cdcf64d934f223e5411a750ba83c5 100644 (file)
@@ -2331,6 +2331,7 @@ const struct Curl_ssl Curl_ssl_nss = {
   1, /* have_certinfo */
   1, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
+  1, /* support_https_proxy */
 
   Curl_nss_init,                /* init */
   Curl_nss_cleanup,             /* cleanup */
index 222c6e28e5db637ec9e364dcdc567503ad196711..7bf8123a6efe0b0254a795fe1fd0ffad95fe742a 100644 (file)
@@ -56,9 +56,6 @@ bool Curl_nss_cert_status_request(void);
 
 bool Curl_nss_false_start(void);
 
-/* Support HTTPS-proxy */
-#define HTTPS_PROXY_SUPPORT 1
-
 extern const struct Curl_ssl Curl_ssl_nss;
 
 /* Set the API backend definition to NSS */
index 7376588c3824dece983088adbf6ce1c136238222..00956f986a49873ff50ad67bfe9cf36a7215f607 100644 (file)
@@ -3394,6 +3394,7 @@ const struct Curl_ssl Curl_ssl_openssl = {
   1, /* have_certinfo */
   1, /* have_pinnedpubkey */
   1, /* have_ssl_ctx */
+  1, /* support_https_proxy */
 
   Curl_ossl_init,                /* init */
   Curl_ossl_cleanup,             /* cleanup */
index c17dff28471ef8e9d6de2c9d5c2609e28df7b004..9df0503ea0304a440e876d3fe9a54d58093ca108 100644 (file)
@@ -71,9 +71,6 @@ CURLcode Curl_ossl_random(struct Curl_easy *data, unsigned char *entropy,
 
 bool Curl_ossl_cert_status_request(void);
 
-/* Support HTTPS-proxy */
-#define HTTPS_PROXY_SUPPORT 1
-
 extern const struct Curl_ssl Curl_ssl_openssl;
 
 /* Set the API backend definition to OpenSSL */
index 4d8db72d8b63a4827eb2eef86caeb97e9fec2ca4..ee5a942da8a3e468615e90522871606f8adb4836 100644 (file)
@@ -885,6 +885,7 @@ const struct Curl_ssl Curl_ssl_polarssl = {
   0, /* have_certinfo */
   1, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
+  0, /* support_https_proxy */
 
   Curl_polarssl_init,                /* init */
   Curl_polarssl_cleanup,             /* cleanup */
index fe7ec47b8f65c589fa168275b33cb6c560df3eb4..c65f6b3949280230e90e79bcc74980f17ff4c23d 100644 (file)
@@ -1733,6 +1733,7 @@ const struct Curl_ssl Curl_ssl_schannel = {
   1, /* have_certinfo */
   0, /* have_pinnedpubkey */
   0, /* have_ssl_ctx */
+  0, /* support_https_proxy */
 
   Curl_schannel_init,                /* init */
   Curl_schannel_cleanup,             /* cleanup */
index 86bb46c2ae59c138f142903f4059daa8d28cddb2..d55328b8c0794b84cab9e111c0d8c4e1b4fddf3c 100644 (file)
@@ -205,12 +205,10 @@ ssl_connect_init_proxy(struct connectdata *conn, int sockindex)
   DEBUGASSERT(conn->bits.proxy_ssl_connected[sockindex]);
   if(ssl_connection_complete == conn->ssl[sockindex].state &&
      !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];
     memset(&conn->ssl[sockindex], 0, sizeof(conn->ssl[sockindex]));
-#else
-    return CURLE_NOT_BUILT_IN;
-#endif
   }
   return CURLE_OK;
 }
index 8b3ff05ae26cd8596eb21d0e4eb0c966e115b0b3..de98df02751a58e6448f4787b69a747e3b20d5fd 100644 (file)
@@ -33,6 +33,8 @@ struct Curl_ssl {
   unsigned have_pinnedpubkey:1; /* supports CURLOPT_PINNEDPUBLICKEY */
   unsigned have_ssl_ctx:1;      /* supports CURLOPT_SSL_CTX_* */
 
+  unsigned support_https_proxy:1; /* supports access via HTTPS proxies */
+
   int (*init)(void);
   void (*cleanup)(void);