pydantic / pydantic/httpx2

No Server Response when using Proxy

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

Nobody has claimed this yet.

Dominant language
Python
Stars
1.5k
Forks
76
Avg merge
8h 59m
Merged PRs (30d)
24

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.

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.