proxy: credentials of an earlier request not inherited by the next
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI Linux / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI MacOS / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI Windows / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (macos-15) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-24.04-arm) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (ubuntu-latest) (push) Has been cancelled
C/C++ CI cmake / ${{ matrix.target }} (windows-2022) (push) Has been cancelled
C/C++ CI cmake / ubuntu-latest (wolfSSL) (push) Has been cancelled

This commit is contained in:
Vladimir Dubrovin committed 2026-11-13 17:56:26 +03:00
1 parent cc7274d2b5
commit e18cd526bc
2 files changed
+26

No files matched your search

+17
View File
@@ -4,6 +4,8 @@ Access rules accumulate until "flush", so each service section here starts
from a clean list.
"""
import base64
def run(t):
if not t.skip_unless("httpsrv"):
@@ -108,3 +110,18 @@ def run(t):
t.eq(407, t.http(origin + "/echo", proxy=needs_auth,
proxy_auth=("alice", "wrong")).status,
"wrong proxy credentials are refused")
# credentials do not outlive the request which carried them: a second
# request on the same connection, without them, is asked again
creds = base64.b64encode(b"alice:secret").decode()
text, closed = t.raw_session(auth,
f"GET {origin}/echo HTTP/1.1\r\nHost: 127.0.0.1:{srv}\r\n"
f"Proxy-Authorization: Basic {creds}\r\n\r\n"
f"GET {origin}/echo HTTP/1.1\r\nHost: 127.0.0.1:{srv}\r\n"
f"Connection: close\r\n\r\n")
parts = text.split("HTTP/1.")
t.eq(3, len(parts), "the kept connection answers both requests")
t.eq(True, parts[1].startswith("1 200"),
"the request with credentials is allowed")
t.eq(True, parts[2].startswith("0 407"),
"the request after it, without credentials, is refused")