When updating the response content for a response, avoid adding the
'content-length' header if the response contains a 'transfer-encoding'
header, from the spec [1]:
> When a message does not have a Transfer-Encoding header field, a
Content-Length header field can provide the anticipated size, as a
decimal number of octets, for a potential payload body
Note the 'transfer-encoding' header is not used with HTTP/2
https://httpwg.org/specs/rfc7230.html#header.content-length
We accidentally reused the value for SSL3 here.
This is not as a bad as a it looks: First, neither version
is enabled by default. Second, because of how Python enums
work, this simply made the `TLS1` version unavailable
as an option (which is how I detected it).
* Make it possible to set sequence options
Attempts to fix#3015 through looking at whether or not the option is
of the type Sequence[str].
Treat all deferred options as potentially Sequence options, by making the
deferred dict values a list.
* Add full test coverage to optmanager again
* Document how to set sequence options
* minor improvements
* update changelog
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
* Add `json()` method for HTTP Request and Response classes.
* Raise errors when fetching content to decode as json.
* Update http.py
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
* Fix for issue #4613
* Adding tests
* Updated CHANGELOG.md
* Restoring contentviews
* Reverting contentview tests
* Adding boundary generation and tests
* Extra newline for flake8
* Janky byte fix
* Revert "Extra newline for flake8"
This reverts commit 683ba167de2264d29f318e2bab83e13cbfb8812d.
* Reverting a commit that was supposed to go to dev branch
* Update CHANGELOG.md
* Update test_http.py
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
* Add `flow.comment` command and keybinding to add a comment to a flow.
* Store comment in Flow().comment. Add ~comment flowfilter syntax.
* resolve: Pythonic flow.comment
* Be consistent and use comment variable.
* keyinfo typing
* Fix parsing of certificate issuer/subject with escaped special characters
* tests
* rfc4514_attribute_name and multi value test
* pyca version + mypy happy dance
* aT lEaSt tTO sPAceS BeFOre iNLinE cOMment
* fix coverage
Co-authored-by: Maximilian Hils <github@maximilianhils.com>
* Add block_list Option which returns a set HTTP status for a blocked flow filter:URL
* Add changelog entry
* Add blocklist to default AddOns
* Add Nginx 444 status code to list, so it is available for validation
* Add overview of blocklists
* Add allow-only, and more tests
* Fix mypy tox issue
* Finish test coverage with test for invalid filter
* Add PR feedback
* Fix type/scope error
* Fix stray blank line
* Delete concepts-blocklist.md
* Feature in overview
* Add flag to metadata for blocklisted flows.
* minor improvements
Co-authored-by: Maximilian Hils <git@maximilianhils.com>
Use original flow host instead of IP when exporting to curl/httpie.
Unless this is done, the SNI server name will not be sent, often making
the curl/httpie command have different behaviour than the original
request (most often in the form of failing to establish a TLS
connection).
With this change, we always use the original host, fixing this failure.
However, if the original host is a domain, it may sometimes resolve to
a different IP address later on. In curl, we solve this problem by
forcing it to connect to the original IP using `--resolve`. For httpie
there is currently no easy solution (see:
https://github.com/httpie/httpie/issues/414).
* Extract port from authority before IDNA decode
A UnicodeError exception may be raised if the port is present
* Update Changelog
* Test for badly formed byte input
* [#4235] Automatic view based on should_render method instead of content_types property
* [#4235] Update CHENGELOG
* [#4235] Fix linter warnings
* Add an explicit test for the new forward-compatible behaviour
* wip
* contentviews: introduce render_priority (2/2)
* coverage++, lint!
* minor fixes
Co-authored-by: Maximilian Hils <git@maximilianhils.com>