mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-04 03:37:17 +00:00
#### Description
Currently when an empty cookie attribute (`Secure`, `HttpOnly` ...) is
encountered while parsing a `Set-Cookie` header it will create a
`CookieAttrs` object containing a (key, value) pair with an empty string
for the attribute value ie:
```python
CookieAttrs[('Secure', ''), ('HttpOnly', ''), ('Path', '/')]
```
Resulting in an updated `Set-Cookie` header for the `Response` object
with invalid values for those empty attributes ie:
```python
(b'SetCookie', b'value=XYZ; Secure=; HttpOnly=; Path=/')
```
My browser (Firefox 95.0.1) does not pickup these attributes so the
cookie looses them.
______
This fix replaces the empty string attribute for empty cookie attributes
by the value `None` ie:
```python
CookieAttrs[('Secure', None), ('HttpOnly', None), ('Path', '/')]
```
So that they can be told apart from attributes with intentional empty
string values when setting the updated header, which results in a
properly formatted header:
```python
(b'SetCookie', b'value=XYZ; Secure; HttpOnly; Path=/')
```
#### Checklist
- [x] I have updated tests where applicable.
- [x] I have added an entry to the CHANGELOG.
Co-authored-by: Lucas FICHEUX <lficheux@corp.free.fr>
|
||
|---|---|---|
| .. | ||
| addons | ||
| completion | ||
| contentviews | ||
| coretypes | ||
| data | ||
| io | ||
| net | ||
| platform | ||
| proxy | ||
| script | ||
| tools | ||
| utils | ||
| __init__.py | ||
| test_addonmanager.py | ||
| test_certs.py | ||
| test_command.py | ||
| test_command_lexer.py | ||
| test_connection.py | ||
| test_ctx.py | ||
| test_dns.py | ||
| test_eventsequence.py | ||
| test_exceptions.py | ||
| test_flow.py | ||
| test_flowfilter.py | ||
| test_hooks.py | ||
| test_http.py | ||
| test_log.py | ||
| test_master.py | ||
| test_options.py | ||
| test_optmanager.py | ||
| test_proxy.py | ||
| test_taddons.py | ||
| test_tcp.py | ||
| test_tls.py | ||
| test_typemanager.py | ||
| test_types.py | ||
| test_udp.py | ||
| test_version.py | ||
| test_websocket.py | ||