No Server Response when using Proxy

Open
#709 2 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
python
Domain
networking

Research direction

Start by reproducing the Discord request through an HTTP proxy using the shown httpx.Client configuration, recording the Python, httpx, proxy, and traceback details. Trace the request from the Client entry point to the proxy response handling; done means the request completes without the reported server-closed exception under the reproduced conditions.

Written by the indexing model from the issue text.

Description

Originally opened by @FuckingToasters on 2022-09-05 13:23:01 in encode/httpx

Describe the bug
Earlier, i had a read timeout error when using proxies which i solved by adding timeout=None in the httpx.Client() function.
Now, when choosing http proxies it work fine for some time but it randomly start crashing with a exception: Server closed without sending response
Don't tell me stuff like "that's a duplicate of ..." I've looked on other Answers on Stackoverflow & Github but none of these helped me to solve the issue i am facing.

To Reproduce
Do a http request to discord.com while using proxies:

    data1 = {"foo": "bar"}
    with httpx.Client(headers=HEADERS, timeout=timeout, proxies=proxyauth if proxytype != "" else None) as client:
        resp2 = client.post("https://discord.com/api/v9/users/`@me`", json=data1)
    lock.acquire()
    if resp2.status_code == 204: pystyle.Write.Print("\t[+] Successfully requested api!\n", pystyle.Colors.green, interval=0)
    lock.release()

Expected behavior
In case you use a proxy, it should request the api as usual without the traceback.

Dominant language
Python
Stars
1.6k
Forks
103
Avg merge
1d 19h
Merged PRs (30d)
25

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pydantic/httpx2

All issues in pydantic/httpx2

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.