troubleshooting.md
This file
Path
docs/troubleshooting.md
63 lines · 2.1 KiB · Markdown
Last changed by
Fix sections references (#3058)Kar Petrosyanbefore adoption73e6888
History of this fileTake it
The walk stopped after 200 commits: lines older than 9d022c0 point at it.
Bump ruff from 0.0.260 to 0.0.275 (#2753)dependabot[bot]before adoption9d022c0
lines 1–21why, one step back1# Troubleshooting23This page lists some common problems or issues you could encounter while developing with HTTPX, as well as possible solutions.45## Proxies67---89### "`The handshake operation timed out`" on HTTPS requests when using a proxy1011**Description**: When using a proxy and making an HTTPS request, you see an exception looking like this:1213```console14httpx.ProxyError: _ssl.c:1091: The handshake operation timed out15```1617**Similar issues**: [encode/httpx#1412](https://github.com/encode/httpx/issues/1412), [encode/httpx#1433](https://github.com/encode/httpx/issues/1433)1819**Resolution**: it is likely that you've set up your proxies like this...2021```pythonAdd the 'proxy' parameter and deprecate 'proxies'. (#2879)Kar Petrosyanbefore adoptionf8981f3
lines 22–24why, one step back22mounts = {23 "http://": httpx.HTTPTransport(proxy="http://myproxy.org"),24 "https://": httpx.HTTPTransport(proxy="https://myproxy.org"),Bump ruff from 0.0.260 to 0.0.275 (#2753)dependabot[bot]before adoption9d022c0
lines 25–29why, one step back25}26```2728Using this setup, you're telling HTTPX to connect to the proxy using HTTP for HTTP requests, and using HTTPS for HTTPS requests.29Fix sections references (#3058)Kar Petrosyanbefore adoption73e6888
line 30why, one step back30But if you get the error above, it is likely that your proxy doesn't support connecting via HTTPS. Don't worry: that's a [common gotcha](advanced/proxies.md#http-proxies).Bump ruff from 0.0.260 to 0.0.275 (#2753)dependabot[bot]before adoption9d022c0
lines 31–34why, one step back3132Change the scheme of your HTTPS proxy to `http://...` instead of `https://...`:3334```pythonAdd the 'proxy' parameter and deprecate 'proxies'. (#2879)Kar Petrosyanbefore adoptionf8981f3
lines 35–37why, one step back35mounts = {36 "http://": httpx.HTTPTransport(proxy="http://myproxy.org"),37 "https://": httpx.HTTPTransport(proxy="http://myproxy.org"),Bump ruff from 0.0.260 to 0.0.275 (#2753)dependabot[bot]before adoption9d022c0
lines 38–43why, one step back38}39```4041This can be simplified to:4243```pythonAdd the 'proxy' parameter and deprecate 'proxies'. (#2879)Kar Petrosyanbefore adoptionf8981f3
lines 44–46why, one step back44proxy = "http://myproxy.org"45with httpx.Client(proxy=proxy) as client:46 ...Bump ruff from 0.0.260 to 0.0.275 (#2753)dependabot[bot]before adoption9d022c0
lines 47–48why, one step back47```48Fix sections references (#3058)Kar Petrosyanbefore adoption73e6888
line 49why, one step back49For more information, see [Proxies: FORWARD vs TUNNEL](advanced/proxies.md#forward-vs-tunnel).Bump ruff from 0.0.260 to 0.0.275 (#2753)dependabot[bot]before adoption9d022c0
lines 50–63why, one step back5051---5253### Error when making requests to an HTTPS proxy5455**Description**: your proxy _does_ support connecting via HTTPS, but you are seeing errors along the lines of...5657```console58httpx.ProxyError: [SSL: PRE_MAC_LENGTH_TOO_LONG] invalid alert (_ssl.c:1091)59```6061**Similar issues**: [encode/httpx#1424](https://github.com/encode/httpx/issues/1424).6263**Resolution**: HTTPX does not properly support HTTPS proxies at this time. If that's something you're interested in having, please see [encode/httpx#1434](https://github.com/encode/httpx/issues/1434) and consider lending a hand there.