I need to post large text fragment to web-application beside gunicorn.
But gunicorn failed requests that large 8190 request line.
This constant hardcoded this https://github.com/benoitc/gunicorn/blob/master/gunicorn/http/message.py#L20
And used this line:
How can redefine behavior?
If you set the value to zero, Gunicorn treats it as unlimited. From the docs:
The maximum size of HTTP request line in bytes.
This parameter is used to limit the allowed size of a client's HTTP request-line. Since the request-line consists of the HTTP method, URI, and protocol version, this directive places a restriction on the length of a request-URI allowed for a request on the server. A server needs this value to be large enough to hold any of its resource names, including any information that might be passed in the query part of a GET request. Value is a number from 0 (unlimited) to 8190.
This parameter can be used to prevent any DDOS attack.
If you need to set it to some value higher than 8190, you'll have to change the source code or build a simple wrapper around Gunicorn's main script that patches the value (although since this uses an internal API, you risk breaking things when upgrading):
# patched_gunicorn_runner.py from gunicorn.http import message message.MAX_REQUEST_LINE = 2**16 - 2 from gunicorn.app.wsgiapp import run run()