]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
pytest: test negotiate with http proxy
authorStefan Eissing <stefan@eissing.org>
Fri, 31 Jan 2025 10:25:15 +0000 (11:25 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Sat, 1 Mar 2025 17:40:40 +0000 (18:40 +0100)
Fixes #14973
Reported-by: stevenpackardblp on github
When curl negotiated with a http: proxy for a https: request, it
wrongly believed there must be an SSL filter present, which during
CONNECT, there is not.

25b445e fixed this. This PR adds a pytest case for the setup.

Closes #16136

tests/http/test_13_proxy_auth.py

index 7d7293bdcc8f979ab87e3fd33794d4e42d3ccc49..07926e376a804c6dc1dc22bb80073c7ddae54a08 100644 (file)
@@ -25,6 +25,7 @@
 ###########################################################################
 #
 import logging
+import os
 import re
 import pytest
 
@@ -152,3 +153,15 @@ class TestProxyAuth:
                          protocol='HTTP/2' if proto == 'h2' else 'HTTP/1.1')
         assert self.get_tunnel_proto_used(r) == 'HTTP/2' \
             if tunnel == 'h2' else 'HTTP/1.1'
+
+    @pytest.mark.skipif(condition=not Env.curl_has_feature('SPNEGO'),
+                        reason='curl lacks SPNEGO support')
+    def test_13_09_negotiate_http(self, env: Env, httpd):
+        run_env = os.environ.copy()
+        run_env['https_proxy'] = f'http://127.0.0.1:{env.proxy_port}'
+        curl = CurlClient(env=env, run_env=run_env)
+        url = f'https://localhost:{env.https_port}/data.json'
+        r1 = curl.http_download(urls=[url], alpn_proto='http/1.1', with_stats=True, extra_args=[
+            '--negotiate', '--proxy-user', 'proxy:proxy'
+        ])
+        r1.check_response(count=1, http_status=200)