Merge pull request #3996 from MrNbaYoh/master

First step to fix #848 by adding a relax_http_form_validation option.
This commit is contained in:
Maximilian Hils 2020-07-22 18:33:29 +02:00 committed by GitHub
commit ac7f05efe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -181,5 +181,11 @@ class Options(optmanager.OptManager):
TLS key size for certificates and CA.
"""
)
self.add_option(
"relax_http_form_validation", bool, False,
"""
Disable HTTP form validation.
"""
)
self.update(**kwargs)

View File

@ -281,10 +281,12 @@ class HttpLayer(base.Layer):
self.send_error_response(400, msg)
return False
validate_request_form(self.mode, request)
if not self.config.options.relax_http_form_validation:
validate_request_form(self.mode, request)
self.channel.ask("requestheaders", f)
# Re-validate request form in case the user has changed something.
validate_request_form(self.mode, request)
if not self.config.options.relax_http_form_validation:
validate_request_form(self.mode, request)
if request.headers.get("expect", "").lower() == "100-continue":
# TODO: We may have to use send_response_headers for HTTP2