Skip to content
Myr

Ensure that ASGI 'raw_path' does not include query component of URL. (#2999)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tom Christie · committed by GitHub · parent f8981f3 · Browse files · 3 files+15 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

3 files+15 added−1 removed

  • tests:+13 added−0 removed
  • other:+2 added−1 removed

3 files+15 added−1 removed

modified:httpx/_transports/asgi.py+1 added-1 removed
101 unmodified lines
102 "method": request.method,103 "headers": [(k.lower(), v) for (k, v) in request.headers.raw],104 "scheme": request.url.scheme,105 "path": request.url.path,106 "raw_path": request.url.raw_path,106 "raw_path": request.url.raw_path.split(b"?")[0],107 "query_string": request.url.query,108 "server": (request.url.host, request.url.port),109 "client": self.client,110 "root_path": self.root_path,
69 unmodified lines
modified:tests/test_asgi.py+13 added
119 unmodified lines
120 assert response.json() == {"raw_path": "/user@example.org"}121122123@pytest.mark.anyio124async def test_asgi_raw_path_should_not_include_querystring_portion():125 """126 See https://github.com/encode/httpx/issues/2810127 """128 async with httpx.AsyncClient(app=echo_raw_path) as client:129 url = httpx.URL("http://www.example.org/path?query")130 response = await client.get(url)131132 assert response.status_code == 200133 assert response.json() == {"raw_path": "/path"}134135136@pytest.mark.anyio137async def test_asgi_upload():138 async with httpx.AsyncClient(app=echo_body) as client:139 response = await client.post("http://www.example.org/", content=b"example")140
76 unmodified lines
modified:CHANGELOG.md+1 added
11 unmodified lines
1213### Fixed1415* Allow URLs where username or password contains unescaped '@'. (#2986)16* Ensure ASGI `raw_path` does not include URL query component. (#2999)1718## 0.25.2 (24th November, 2023)1920### Added
1045 unmodified lines