fix: proxy/attempts truthiness bugs, stale text() cache, preview cookie order (v0.1.9)
_get_proxy() and request() checked proxies/proxy with truthiness instead of
is None, so a per-call proxies={} silently fell back to session proxies, and a
native proxy= kwarg was clobbered by resolved session proxies (unmasking the
caller's real IP) instead of raising on conflicting sources. Response.text()
cached the first decode regardless of a later explicit encoding= argument.
preview() computed the Cookie header from the pre-rewrite url instead of the
rewritten one actually used by request(). request_with_retries(attempts=0)
became DEFAULT_ATTEMPTS via truthiness instead of flooring to 1.
Also compresses docstrings/comments across the module (no behavior change).
Signed-off-by: disqualifier <dev@disqualifier.me>
This commit is contained in:
@@ -11,18 +11,18 @@ and swap the HTTP client while inheriting everything else.
|
||||
`requirements.txt`:
|
||||
|
||||
```
|
||||
aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.8
|
||||
aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.9
|
||||
```
|
||||
|
||||
Direct:
|
||||
|
||||
```bash
|
||||
pip install "aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.8"
|
||||
pip install "aioweb @ git+ssh://git@git.rethinkstudios.io/rethink-public/aioweb.git@v0.1.9"
|
||||
```
|
||||
|
||||
Requires `aiohttp` and `yarl` (pulled transitively).
|
||||
|
||||
Drop the `@v0.1.8` suffix from the line above to install the latest unpinned.
|
||||
Drop the `@v0.1.9` suffix from the line above to install the latest unpinned.
|
||||
|
||||
## Usage
|
||||
|
||||
@@ -144,6 +144,24 @@ Two changes can't be shimmed without re-introducing the bugs they fix:
|
||||
|
||||
## Changelog
|
||||
|
||||
### v0.1.9
|
||||
|
||||
- **`_get_proxy()`/`request()` proxy resolution now checks `is None`, not
|
||||
truthiness.** A per-call `proxies={}` previously fell back to the session's
|
||||
configured proxies instead of disabling them for that call. `request()` also no
|
||||
longer clobbers a native `proxy=` kwarg with the resolved session/`proxies=`
|
||||
value (a real IP-unmasking leak) — passing both now raises `ValueError` instead
|
||||
of silently picking one.
|
||||
- **`Response.text(encoding=...)` no longer returns a stale cached decode.** A
|
||||
second call with an explicit `encoding=` previously still returned the first
|
||||
(possibly differently-encoded) cached decode; an explicit encoding now bypasses
|
||||
the cache.
|
||||
- **`preview()` now rewrites the url before resolving cookies**, matching what
|
||||
`request()` actually sends — previously cookies were resolved against the
|
||||
pre-rewrite host, which could miss or misattribute host-bound cookies.
|
||||
- **`request_with_retries(attempts=0)` now floors to 1 attempt**, not silently
|
||||
`DEFAULT_ATTEMPTS` (3). `attempts` is checked with `is None`, not truthiness.
|
||||
|
||||
### v0.1.8
|
||||
|
||||
- **`request()` no longer flattens `aiohttp.ClientError` subtypes.** Every failure
|
||||
|
||||
Reference in New Issue
Block a user