#### 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>
|
||
|---|---|---|
| .github | ||
| docs | ||
| examples | ||
| mitmproxy | ||
| release | ||
| test | ||
| web | ||
| .gitattributes | ||
| .gitignore | ||
| CHANGELOG.md | ||
| codecov.yml | ||
| CONTRIBUTING.md | ||
| LICENSE | ||
| MANIFEST.in | ||
| pyproject.toml | ||
| README.md | ||
| SECURITY.md | ||
| setup.cfg | ||
mitmproxy
mitmproxy is an interactive, SSL/TLS-capable intercepting proxy with a console
interface for HTTP/1, HTTP/2, and WebSockets.
mitmdump is the command-line version of mitmproxy. Think tcpdump for HTTP.
mitmweb is a web-based interface for mitmproxy.
Installation
The installation instructions are here. If you want to install from source, see CONTRIBUTING.md.
Documentation & Help
General information, tutorials, and precompiled binaries can be found on the mitmproxy website.
The documentation for mitmproxy is available on our website:
If you have questions on how to use mitmproxy, please use GitHub Discussions!
Contributing
As an open source project, mitmproxy welcomes contributions of all forms.
Also, please feel free to join our developer Slack! However, please note that the primary purpose of our Slack is direct communication between maintainers and contributors. If you have questions where the answer might be valuable to others, please use GitHub Discussions and not Slack.