{
 "recorded_at": "2026-10-06T07:21:12Z",
 "python": "3.14.4",
 "platform": "Linux-7.0.0-30-generic-x86_64-with-glibc2.43",
 "versions": {
  "aiohttp": "3.14.4",
  "aiohttp-socks": "0.12.0",
  "python-socks": "3.1.1",
  "yarl": "1.25.1",
  "multidict": "6.9.1"
 },
 "ports": {
  "http_target": 8080,
  "https_target": 8443,
  "echo_target": 8444,
  "proxy": 8888,
  "socks": 1080
 },
 "prelude": "import asyncio, os, ssl\nimport aiohttp\n\nHTTP_URL = \"http://127.0.0.1:8080/\"\nHTTPS_URL = \"https://127.0.0.1:8443/\"\nECHO_URL = \"https://127.0.0.1:8444/\"  # answers with the names of the headers it received\nPROXY = \"http://127.0.0.1:8888\"\nTLS = ssl.create_default_context(cafile=os.environ[\"LAB_CA\"])  # trusts the lab's self-signed target\n\n\ndef run(main):\n    try:\n        asyncio.run(main())\n    except Exception as exc:\n        print(f\"EXCEPTION {type(exc).__module__}.{type(exc).__qualname__}: {exc}\")\n\n\nasync def show(response):\n    body = (await response.text()).strip()\n    print(f\"status={response.status} body={body!r} proxy_authenticate={response.headers.get('Proxy-Authenticate')!r}\")\n\n",
 "cases": [
  {
   "case": "auth-basicauth-http",
   "env": {},
   "command": "python -W always auth-basicauth-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "auth-basicauth-http.py:25: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:",
    "auth-basicauth-http.py:25: DeprecationWarning: The 'proxy_auth' parameter is deprecated and will be removed in v4; pass proxy_headers={'Proxy-Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-basicauth-https",
   "env": {},
   "command": "python -W always auth-basicauth-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "auth-basicauth-https.py:25: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:",
    "auth-basicauth-https.py:25: DeprecationWarning: The 'proxy_auth' parameter is deprecated and will be removed in v4; pass proxy_headers={'Proxy-Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-headers-http",
   "env": {},
   "command": "python -W always auth-headers-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 body='' proxy_authenticate='Basic realm=\"lab\"'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-headers-https",
   "env": {},
   "command": "python -W always auth-headers-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-url-http",
   "env": {},
   "command": "python -W always auth-url-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=\"http://user:pass@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-url-https",
   "env": {},
   "command": "python -W always auth-url-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=\"http://user:pass@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-request-header-http",
   "env": {},
   "command": "python -W always auth-request-header-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-request-header-https",
   "env": {},
   "command": "python -W always auth-request-header-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientHttpProxyError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8888'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-both-headers-http",
   "env": {},
   "command": "python -W always auth-both-headers-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}, headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-both-headers-https",
   "env": {},
   "command": "python -W always auth-both-headers-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}, headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-proxy-headers-authorization-http",
   "env": {},
   "command": "python -W always auth-proxy-headers-authorization-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, proxy_headers={\"Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "auth-proxy-headers-authorization-https",
   "env": {},
   "command": "python -W always auth-proxy-headers-authorization-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_headers={\"Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "proxy-headers-custom-http",
   "env": {},
   "command": "python -W always proxy-headers-custom-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=\"http://user:pass@127.0.0.1:8888\", proxy_headers={\"X-Lab\": \"1\"}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "proxy-headers-custom-https",
   "env": {},
   "command": "python -W always proxy-headers-custom-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=\"http://user:pass@127.0.0.1:8888\", proxy_headers={\"X-Lab\": \"1\"}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "<sys>:0: ResourceWarning: unclosed <socket.socket fd=6, family=2, type=1, proto=6, laddr=('127.0.0.1', 33792)>",
    "ResourceWarning: Enable tracemalloc to get the object allocation traceback",
    "/usr/lib/python3.14/asyncio/selector_events.py:873: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=6>",
    "  _warn(f\"unclosed transport {self!r}\", ResourceWarning, source=self)",
    "ResourceWarning: Enable tracemalloc to get the object allocation traceback"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent",
      "X-Lab"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "proxy-headers-https-at-target",
   "env": {},
   "command": "python -W always proxy-headers-https-at-target.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(ECHO_URL, ssl=TLS, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='{\"target_received\": [\"Accept\", \"Accept-Encoding\", \"Host\", \"User-Agent\"]}' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8444",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "request-header-https-at-target",
   "env": {},
   "command": "python -W always request-header-https-at-target.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(ECHO_URL, ssl=TLS, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}, headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='{\"target_received\": [\"Accept\", \"Accept-Encoding\", \"Host\", \"Proxy-Authorization\", \"User-Agent\"]}' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8444",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "wrong-url-https",
   "env": {},
   "command": "python -W always wrong-url-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=\"http://user:wrong@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientHttpProxyError: 407, message='Proxy Authentication Required', url='http://user:wrong@127.0.0.1:8888'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "wrong-url-https-status-and-message",
   "env": {},
   "command": "python -W always wrong-url-https-status-and-message.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        try:\n            async with session.get(HTTPS_URL, ssl=TLS, proxy=\"http://user:wrong@127.0.0.1:8888\") as response:\n                await show(response)\n        except aiohttp.ClientHttpProxyError as exc:\n            print(f\"status={exc.status} message={exc.message!r}\")\n            print(\"subclass of ClientResponseError:\", isinstance(exc, aiohttp.ClientResponseError))\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 message='Proxy Authentication Required'",
    "subclass of ClientResponseError: True"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "wrong-headers-https",
   "env": {},
   "command": "python -W always wrong-headers-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"wrong\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientHttpProxyError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8888'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "wrong-basicauth-https",
   "env": {},
   "command": "python -W always wrong-basicauth-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"wrong\")) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientHttpProxyError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8888'"
   ],
   "stderr": [
    "wrong-basicauth-https.py:25: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"wrong\")) as response:",
    "wrong-basicauth-https.py:25: DeprecationWarning: The 'proxy_auth' parameter is deprecated and will be removed in v4; pass proxy_headers={'Proxy-Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"wrong\")) as response:"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "wrong-url-http",
   "env": {},
   "command": "python -W always wrong-url-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=\"http://user:wrong@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 body='' proxy_authenticate='Basic realm=\"lab\"'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "wrong-url-http-raise",
   "env": {},
   "command": "python -W always wrong-url-http-raise.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(raise_for_status=True) as session:\n        async with session.get(HTTP_URL, proxy=\"http://user:wrong@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8080/'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "noauth-http",
   "env": {},
   "command": "python -W always noauth-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 body='' proxy_authenticate='Basic realm=\"lab\"'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "noauth-https",
   "env": {},
   "command": "python -W always noauth-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=PROXY) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientHttpProxyError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8888'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "noauth-http-session-raise",
   "env": {},
   "command": "python -W always noauth-http-session-raise.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(raise_for_status=True) as session:\n        async with session.get(HTTP_URL, proxy=PROXY) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8080/'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "noauth-http-request-raise",
   "env": {},
   "command": "python -W always noauth-http-request-raise.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, raise_for_status=True) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8080/'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "noauth-http-method-raise",
   "env": {},
   "command": "python -W always noauth-http-method-raise.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY) as response:\n            print(f\"status={response.status} ok={response.ok}\")\n            response.raise_for_status()\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 ok=False",
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8080/'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "session-proxy-request-headers-http",
   "env": {},
   "command": "python -W always session-proxy-request-headers-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(proxy=PROXY) as session:\n        async with session.get(HTTP_URL, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 body='' proxy_authenticate='Basic realm=\"lab\"'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "session-proxy-request-headers-https",
   "env": {},
   "command": "python -W always session-proxy-request-headers-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(proxy=PROXY) as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "session-proxy-url-credentials-http",
   "env": {},
   "command": "python -W always session-proxy-url-credentials-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(proxy=\"http://user:pass@127.0.0.1:8888\") as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "session-proxy-url-credentials-https",
   "env": {},
   "command": "python -W always session-proxy-url-credentials-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(proxy=\"http://user:pass@127.0.0.1:8888\") as session:\n        async with session.get(HTTPS_URL, ssl=TLS) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "<sys>:0: ResourceWarning: unclosed <socket.socket fd=6, family=2, type=1, proto=6, laddr=('127.0.0.1', 37714)>",
    "ResourceWarning: Enable tracemalloc to get the object allocation traceback",
    "/usr/lib/python3.14/asyncio/selector_events.py:873: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=6>",
    "  _warn(f\"unclosed transport {self!r}\", ResourceWarning, source=self)",
    "ResourceWarning: Enable tracemalloc to get the object allocation traceback"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "session-proxy-auth",
   "env": {},
   "command": "python -W always session-proxy-auth.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "session-proxy-auth.py:24: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with aiohttp.ClientSession(proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as session:",
    "session-proxy-auth.py:24: DeprecationWarning: The 'proxy_auth' parameter is deprecated and will be removed in v4; pass proxy_headers={'Proxy-Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with aiohttp.ClientSession(proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as session:"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "session-proxy-headers",
   "env": {},
   "command": "python -W always session-proxy-headers.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(proxy=PROXY, proxy_headers={\"Proxy-Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION builtins.TypeError: ClientSession.__init__() got an unexpected keyword argument 'proxy_headers'. Did you mean 'max_headers'?"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "basicauth-construct",
   "env": {},
   "command": "python -W always basicauth-construct.py",
   "code": "print(aiohttp.BasicAuth(\"user\", \"pass\"))",
   "exit_code": 0,
   "stdout": [
    "BasicAuth(login='user', password='pass', encoding='latin1')"
   ],
   "stderr": [
    "basicauth-construct.py:22: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  print(aiohttp.BasicAuth(\"user\", \"pass\"))"
   ],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "encode-basic-auth",
   "env": {},
   "command": "python -W always encode-basic-auth.py",
   "code": "print(aiohttp.encode_basic_auth(\"user\", \"pass\"))",
   "exit_code": 0,
   "stdout": [
    "Basic dXNlcjpwYXNz"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "server-auth-basicauth",
   "env": {},
   "command": "python -W always server-auth-basicauth.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "server-auth-basicauth.py:25: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with session.get(HTTP_URL, auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:",
    "server-auth-basicauth.py:25: DeprecationWarning: The 'auth' parameter is deprecated and will be removed in v4; pass headers={'Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with session.get(HTTP_URL, auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:"
   ],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "server-auth-header",
   "env": {},
   "command": "python -W always server-auth-header.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, headers={\"Authorization\": aiohttp.encode_basic_auth(\"user\", \"pass\")}) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "encoding-defaults",
   "env": {},
   "command": "python -W always encoding-defaults.py",
   "code": "print(aiohttp.encode_basic_auth(\"user\", \"päss\"))\nprint(aiohttp.BasicAuth(\"user\", \"päss\").encode())\nprint(aiohttp.encode_basic_auth(\"user\", \"päss\", encoding=\"latin1\"))",
   "exit_code": 0,
   "stdout": [
    "Basic dXNlcjpww6Rzcw==",
    "Basic dXNlcjpw5HNz",
    "Basic dXNlcjpw5HNz"
   ],
   "stderr": [
    "encoding-defaults.py:23: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  print(aiohttp.BasicAuth(\"user\", \"päss\").encode())"
   ],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "basicauth-default-warnings",
   "env": {},
   "command": "python basicauth-default-warnings.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "basicauth-default-warnings.py:25: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:",
    "basicauth-default-warnings.py:25: DeprecationWarning: The 'proxy_auth' parameter is deprecated and will be removed in v4; pass proxy_headers={'Proxy-Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "basicauth-in-module-default-warnings",
   "env": {},
   "command": "python basicauth-in-module-default-warnings.py",
   "code": "import pathlib\n\npathlib.Path(\"legacy_client.py\").write_text(\"\\n\".join([\n    \"import aiohttp\",\n    \"\",\n    \"async def fetch(url, proxy):\",\n    \"    async with aiohttp.ClientSession() as session:\",\n    \"        async with session.get(url, proxy=proxy, proxy_auth=aiohttp.BasicAuth('user', 'pass')) as response:\",\n    \"            return response.status\",\n    \"\",\n]))\nimport legacy_client\n\n\nasync def main():\n    print(\"status\", await legacy_client.fetch(HTTP_URL, PROXY))\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status 200"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "basicauth-in-module-warnings-always",
   "env": {},
   "command": "python -W always basicauth-in-module-warnings-always.py",
   "code": "import pathlib\n\npathlib.Path(\"legacy_client.py\").write_text(\"\\n\".join([\n    \"import aiohttp\",\n    \"\",\n    \"async def fetch(url, proxy):\",\n    \"    async with aiohttp.ClientSession() as session:\",\n    \"        async with session.get(url, proxy=proxy, proxy_auth=aiohttp.BasicAuth('user', 'pass')) as response:\",\n    \"            return response.status\",\n    \"\",\n]))\nimport legacy_client\n\n\nasync def main():\n    print(\"status\", await legacy_client.fetch(HTTP_URL, PROXY))\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status 200"
   ],
   "stderr": [
    "legacy_client.py:5: DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead",
    "  async with session.get(url, proxy=proxy, proxy_auth=aiohttp.BasicAuth('user', 'pass')) as response:",
    "legacy_client.py:5: DeprecationWarning: The 'proxy_auth' parameter is deprecated and will be removed in v4; pass proxy_headers={'Proxy-Authorization': aiohttp.encode_basic_auth(login, password)} instead",
    "  async with session.get(url, proxy=proxy, proxy_auth=aiohttp.BasicAuth('user', 'pass')) as response:"
   ],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "basicauth-warnings-as-errors",
   "env": {},
   "command": "python -W error basicauth-warnings-as-errors.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=PROXY, proxy_auth=aiohttp.BasicAuth(\"user\", \"pass\")) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION builtins.DeprecationWarning: BasicAuth is deprecated and will be removed in aiohttp 4.0; use aiohttp.encode_basic_auth() with headers={'Authorization': ...} instead"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "env-default-session",
   "env": {
    "HTTP_PROXY": "http://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-default-session.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "env-trust-env",
   "env": {
    "HTTP_PROXY": "http://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-trust-env.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-trust-env-lowercase",
   "env": {
    "http_proxy": "http://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-trust-env-lowercase.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-trust-env-https",
   "env": {
    "HTTPS_PROXY": "http://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-trust-env-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTPS_URL, ssl=TLS) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-trust-env-https-wrong-password",
   "env": {
    "HTTPS_PROXY": "http://user:wrong@127.0.0.1:8888"
   },
   "command": "python -W always env-trust-env-https-wrong-password.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTPS_URL, ssl=TLS) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientHttpProxyError: 407, message='Proxy Authentication Required', url='http://127.0.0.1:8888'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "CONNECT",
     "target": "127.0.0.1:8443",
     "auth": "wrong",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-http-var-https-url",
   "env": {
    "HTTP_PROXY": "http://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-http-var-https-url.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTPS_URL, ssl=TLS) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "env-all-proxy",
   "env": {
    "ALL_PROXY": "http://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-all-proxy.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "env-no-credentials",
   "env": {
    "HTTP_PROXY": "http://127.0.0.1:8888"
   },
   "command": "python -W always env-no-credentials.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=407 body='' proxy_authenticate='Basic realm=\"lab\"'"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "missing",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-no-proxy",
   "env": {
    "HTTP_PROXY": "http://user:pass@127.0.0.1:8888",
    "NO_PROXY": "127.0.0.1"
   },
   "command": "python -W always env-no-proxy.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "env-no-proxy-other-host",
   "env": {
    "HTTP_PROXY": "http://user:pass@127.0.0.1:8888",
    "NO_PROXY": "example.com"
   },
   "command": "python -W always env-no-proxy-other-host.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-no-proxy-explicit-proxy",
   "env": {
    "NO_PROXY": "127.0.0.1"
   },
   "command": "python -W always env-no-proxy-explicit-proxy.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL, proxy=\"http://user:pass@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-explicit-proxy-wins",
   "env": {
    "HTTP_PROXY": "http://127.0.0.1:9"
   },
   "command": "python -W always env-explicit-proxy-wins.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL, proxy=\"http://user:pass@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "request",
     "method": "GET",
     "target": "http://127.0.0.1:8080/",
     "auth": "ok",
     "header_names": [
      "Accept",
      "Accept-Encoding",
      "Host",
      "Proxy-Authorization",
      "User-Agent"
     ]
    }
   ],
   "socks_log": []
  },
  {
   "case": "env-dead-proxy",
   "env": {
    "HTTP_PROXY": "http://127.0.0.1:9"
   },
   "command": "python -W always env-dead-proxy.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientProxyConnectionError: Cannot connect to host 127.0.0.1:9 ssl:default [Connect call failed ('127.0.0.1', 9)]"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "env-https-scheme-proxy",
   "env": {
    "HTTP_PROXY": "https://user:pass@127.0.0.1:8888"
   },
   "command": "python -W always env-https-scheme-proxy.py",
   "code": "async def main():\n    async with aiohttp.ClientSession(trust_env=True) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [
    "HTTPS proxies https://127.0.0.1:8888 are not supported, ignoring"
   ],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "socks-scheme-http",
   "env": {},
   "command": "python -W always socks-scheme-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=\"socks5://127.0.0.1:1080\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 400, message=\"Bad status line:\\n  Expected HTTP/, RTSP/ or ICE/:\\n\\n  b'\\\\x05\\\\x00'\\n    ^\", url='http://127.0.0.1:8080/'"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=99 dest=6570:742d:456e:636f:6469:6e67:3a20:677a:26992"
   ]
  },
  {
   "case": "socks-scheme-https",
   "env": {},
   "command": "python -W always socks-scheme-https.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=\"socks5://127.0.0.1:1080\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 400, message=\"Bad status line:\\n  Expected HTTP/, RTSP/ or ICE/:\\n\\n  b'\\\\x05\\\\x00\\\\x05\\\\x07\\\\x00\\\\x01\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00\\\\x00'\\n    ^\", url='socks5://127.0.0.1:1080'"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=32 dest=677a:6970:2c20:6465:666c:6174:652c:207a:29556"
   ]
  },
  {
   "case": "socks5h-scheme-http",
   "env": {},
   "command": "python -W always socks5h-scheme-http.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=\"socks5h://127.0.0.1:1080\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientResponseError: 400, message=\"Bad status line:\\n  Expected HTTP/, RTSP/ or ICE/:\\n\\n  b'\\\\x05\\\\x00'\\n    ^\", url='http://127.0.0.1:8080/'"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=99 dest=6570:742d:456e:636f:6469:6e67:3a20:677a:26992"
   ]
  },
  {
   "case": "aiohttp-socks-http",
   "env": {},
   "command": "python -W always aiohttp-socks-http.py",
   "code": "from aiohttp_socks import ProxyConnector\n\n\nasync def main():\n    connector = ProxyConnector.from_url(\"socks5://127.0.0.1:1080\")\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=IPv4 dest=127.0.0.1:8080"
   ]
  },
  {
   "case": "aiohttp-socks-https",
   "env": {},
   "command": "python -W always aiohttp-socks-https.py",
   "code": "from aiohttp_socks import ProxyConnector\n\n\nasync def main():\n    connector = ProxyConnector.from_url(\"socks5://127.0.0.1:1080\")\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(HTTPS_URL, ssl=TLS) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=IPv4 dest=127.0.0.1:8443"
   ]
  },
  {
   "case": "aiohttp-socks-socks5h",
   "env": {},
   "command": "python -W always aiohttp-socks-socks5h.py",
   "code": "from aiohttp_socks import ProxyConnector\n\n\nasync def main():\n    connector = ProxyConnector.from_url(\"socks5h://127.0.0.1:1080\")\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(HTTP_URL) as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION builtins.ValueError: Invalid scheme component: socks5h"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": []
  },
  {
   "case": "aiohttp-socks-hostname",
   "env": {},
   "command": "python -W always aiohttp-socks-hostname.py",
   "code": "from aiohttp_socks import ProxyConnector\n\n\nasync def main():\n    connector = ProxyConnector.from_url(\"socks5://127.0.0.1:1080\")\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(\"http://localhost:8080/\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=DOMAIN dest=localhost:8080"
   ]
  },
  {
   "case": "aiohttp-socks-hostname-rdns",
   "env": {},
   "command": "python -W always aiohttp-socks-hostname-rdns.py",
   "code": "from aiohttp_socks import ProxyConnector\n\n\nasync def main():\n    connector = ProxyConnector.from_url(\"socks5://127.0.0.1:1080\", rdns=True)\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(\"http://localhost:8080/\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=DOMAIN dest=localhost:8080"
   ]
  },
  {
   "case": "aiohttp-socks-hostname-rdns-false",
   "env": {},
   "command": "python -W always aiohttp-socks-hostname-rdns-false.py",
   "code": "from aiohttp_socks import ProxyConnector\n\n\nasync def main():\n    connector = ProxyConnector.from_url(\"socks5://127.0.0.1:1080\", rdns=False)\n    async with aiohttp.ClientSession(connector=connector) as session:\n        async with session.get(\"http://localhost:8080/\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "status=200 body='lab target ok' proxy_authenticate=None"
   ],
   "stderr": [],
   "proxy_log": [],
   "socks_log": [
    "CONNECT atyp=IPv4 dest=127.0.0.1:8080"
   ]
  },
  {
   "case": "https-proxy-url-http-target",
   "env": {},
   "command": "python -W always https-proxy-url-http-target.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTP_URL, proxy=\"https://user:pass@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host 127.0.0.1:8888 ssl:default [[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1081)]"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "not_http",
     "first_bytes": "1603010607010006"
    }
   ],
   "socks_log": []
  },
  {
   "case": "https-proxy-url-https-target",
   "env": {},
   "command": "python -W always https-proxy-url-https-target.py",
   "code": "async def main():\n    async with aiohttp.ClientSession() as session:\n        async with session.get(HTTPS_URL, ssl=TLS, proxy=\"https://user:pass@127.0.0.1:8888\") as response:\n            await show(response)\n\nrun(main)",
   "exit_code": 0,
   "stdout": [
    "EXCEPTION aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host 127.0.0.1:8888 ssl:<ssl.SSLContext object at 0x7e7adbb39f30> [[SSL: RECORD_LAYER_FAILURE] record layer failure (_ssl.c:1081)]"
   ],
   "stderr": [],
   "proxy_log": [
    {
     "event": "not_http",
     "first_bytes": "16030105f8010005"
    }
   ],
   "socks_log": []
  }
 ]
}
