]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
curl: add --proxy-http2
authorDaniel Stenberg <daniel@haxx.se>
Tue, 11 Apr 2023 09:20:12 +0000 (11:20 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 14 Apr 2023 08:39:23 +0000 (10:39 +0200)
For trying HTTP/2 with an HTTPS proxy.

Closes #10926

docs/cmdline-opts/Makefile.inc
docs/cmdline-opts/proxy-http2.d [new file with mode: 0644]
docs/options-in-versions
src/tool_getparam.c
src/tool_listhelp.c

index ffc9169d3f0b98536fd4fc70ee2c4c4190c76d65..208a66718c7f553d6b41eed23c3192de3971d791 100644 (file)
@@ -178,6 +178,7 @@ DPAGES = \
   proxy-crlfile.d \
   proxy-digest.d \
   proxy-header.d \
+  proxy-http2.d \
   proxy-insecure.d \
   proxy-key-type.d \
   proxy-key.d \
diff --git a/docs/cmdline-opts/proxy-http2.d b/docs/cmdline-opts/proxy-http2.d
new file mode 100644 (file)
index 0000000..3edadb2
--- /dev/null
@@ -0,0 +1,18 @@
+c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+SPDX-License-Identifier: curl
+Long: proxy-http2
+Tags: Versions HTTP/2
+Protocols: HTTP
+Added: 8.1.0
+Mutexed:
+Requires: HTTP/2
+See-also: proxy
+Help: Use HTTP/2 with HTTPS proxy
+Category: http proxy
+Example: --proxy-http2 -x proxy $URL
+Multi: boolean
+---
+Tells curl to try negotiate HTTP version 2 with a HTTPS proxy. The proxy might
+still only offer HTTP/1 and then curl will stick to using that version.
+
+This has no effect for any other kinds of proxies.
index 039837320692f8ab2fe1e4a98c46fbf19aeedcd8..d34dd33f01a413c26666e6d2d424ca93fc9f3523 100644 (file)
 --proxy-crlfile                      7.52.0
 --proxy-digest                       7.12.0
 --proxy-header                       7.37.0
+--proxy-http2                        8.1.0
 --proxy-insecure                     7.52.0
 --proxy-key                          7.52.0
 --proxy-key-type                     7.52.0
index 6d6cac3dbd0443f09457a1001571d6c6945c7476..b33e60300a0907bb815be06fea4e837015cc3a72 100644 (file)
@@ -211,6 +211,7 @@ static const struct LongShort aliases[]= {
   {"04",  "http3",                   ARG_NONE},
   {"05",  "http3-only",              ARG_NONE},
   {"09",  "http0.9",                 ARG_BOOL},
+  {"0a",  "proxy-http2",             ARG_BOOL},
   {"1",  "tlsv1",                    ARG_NONE},
   {"10",  "tlsv1.0",                 ARG_NONE},
   {"11",  "tlsv1.1",                 ARG_NONE},
@@ -1449,6 +1450,10 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
         /* Allow HTTP/0.9 responses! */
         config->http09_allowed = toggle;
         break;
+      case 'a':
+        /* --proxy-http2 */
+        config->proxyver = CURLPROXY_HTTPS2;
+        break;
       }
       break;
     case '1': /* --tlsv1* options */
@@ -2373,7 +2378,8 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
       default:
         /* --proxy */
         GetStr(&config->proxy, nextarg);
-        config->proxyver = CURLPROXY_HTTP;
+        if(config->proxyver != CURLPROXY_HTTPS2)
+          config->proxyver = CURLPROXY_HTTP;
         break;
       }
       break;
index 7611cf6a0a011f5c6d8e68881d5eec41ae32744d..61550de72d90e37f17efc17801f0575379d086ea 100644 (file)
@@ -5,7 +5,7 @@
  *                            | (__| |_| |  _ <| |___
  *                             \___|\___/|_| \_\_____|
  *
- * Copyright (C) Daniel Stenberg, <daniel.se>, et al.
+ * Copyright (C) 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
@@ -498,6 +498,9 @@ const struct helptxt helptext[] = {
   {"    --proxy-header <header/@file>",
    "Pass custom header(s) to proxy",
    CURLHELP_PROXY},
+  {"    --proxy-http2",
+   "Use HTTP/2 with HTTPS proxy",
+   CURLHELP_HTTP | CURLHELP_PROXY},
   {"    --proxy-insecure",
    "Do HTTPS proxy connections without verifying the proxy",
    CURLHELP_PROXY | CURLHELP_TLS},