Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout not respected with socks5 proxy #3422

Open
crinkytreadmill opened this issue Nov 28, 2024 Discussed in #2951 · 0 comments
Open

timeout not respected with socks5 proxy #3422

crinkytreadmill opened this issue Nov 28, 2024 Discussed in #2951 · 0 comments

Comments

@crinkytreadmill
Copy link

I am also experiencing this issue. The timeout property has no effect on reads with SOCKS5 proxies, while the same functionality works as expected with HTTP proxies.

Discussed in #2951

Originally posted by a14n November 20, 2023
With httpx[socks]==0.23.3and the following code an httpx.ReadTimeout is raised only with https proxy and not with socks5 proxy. Is it an known issue?

async def main():
   async_client = httpx.AsyncClient(
#        proxies="https://my-https-proxy:443",
       proxies="socks5://my-socks5-proxy:3128",
       follow_redirects=True,
       timeout=1,
   )
   start = time.time_ns()
   try:
       response = await async_client.get(
           "http://www.protesa.net/",
           follow_redirects=False,
       )
       print("status", response.status_code)
   except Exception as e:
       print("ex", type(e))
 #      traceback.print_exc()
   finally:
       print(f"{time.time_ns() - start}ns")
   await async_client.aclose()

if __name__ == '__main__':
   asyncio.run(main())

The output for socks5 proxy is:

ex <class 'socksio.exceptions.ProtocolError'>
59288033291ns

The output for http proxy is:

ex <class 'httpx.ReadTimeout'>
1345715709ns
```</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant