27 Commits

Author SHA1 Message Date
Paul J. Dorn
422b18acea class Name(object): -> class Name: 2024-04-22 03:33:30 +02:00
Paul J. Dorn
ac29c9b0a7 fail-safe on unsupported request framing
If we promise wsgi.input_terminated, we better get it right - or not at all.
* chunked encoding on HTTP <= 1.1
* chunked not last transfer coding
* multiple chinked codings
* any unknown codings (yes, this too! because we do not detect unusual syntax that is still chunked)
* empty coding (plausibly harmless, but not see in real life anyway - refused, for the moment)
2023-12-15 13:33:31 +01:00
Paul J. Dorn
559caf9205 pytest: raise on malformed test fixtures
and unbreak test depending on backslash escape
2023-12-15 13:33:31 +01:00
Randall Leeds
3573fd38d0 Capture peer name from accept
Avoid calls to getpeername by capturing the peer name returned by
accept.
2020-12-17 22:13:02 -05:00
Brett Randall
b014fa78ee Various code improvements contributed by dilyanpalauzov.
These were originally based on 19.9.0 code and were rebased
with conflicts resolved.

Fixed #1690.

Co-Authored-By: dilyanpalauzov <git-dpa@aegee.org>
Signed-off-by: Brett Randall <javabrett@gmail.com>
2019-07-17 07:32:11 +10:00
Masashi SHIBATA
a13a2096ed Use SourceFileLoader instead instead of execfile_ (#2046) 2019-05-26 22:09:52 +03:00
Hugo
e974f30517 Drop support for Python 2
Co-Authored-By: Dustin Ingram <di@users.noreply.github.com>
Co-Authored-By: Berker Peksag <berker.peksag@gmail.com>
2018-08-01 15:31:17 +03:00
YuppY
5953148573 Do not strip leading slash from path (#1511)
Fixes #1512
2017-12-28 11:32:47 +03:00
Raphaël Slinckx
ccfb29871c tests: Fix send_bytes for testing requests 2017-08-25 10:44:00 +02:00
Benno Rice
032271a030 Empty sequences are false, there's no need to check the len. 2017-07-12 16:15:42 +03:00
Berker Peksag
31b8e48a78 Silence prospector warnings 2017-02-07 09:05:43 +03:00
Hasan Ramezni
e9a00b75c5 add empty line after some tests. 2017-01-17 20:37:02 +03:00
Berker Peksag
337900037f Convert tests to use py.test assertions.
Closes #950
2015-07-03 07:38:36 +03:00
Berker Peksag
7ce90373a8 Remove unused imports. 2014-12-01 07:00:02 +02:00
Collin Anderson
f2ba62bc10 six 1.8.0 and gunicorn._compat
closes #904 and #905
2014-10-02 17:00:03 -04:00
Berker Peksag
829e8d32d4 Remove __future__.with_statement imports.
Gunicorn requires Python 2.6 or newer now:

http://docs.gunicorn.org/en/latest/install.html#requirements
2014-05-15 00:34:02 +03:00
George Notaras
2d7eb3dc04 Added extra valid request (099) and test (send_special_chunks).
``send_special_chunks`` sends the request data in two chunks, one having a length of 1 byte, which ensures there is no CRLF, and a second chunk containing the rest of the request data. Practically, this forces ``gunicorn.http.message.Request.read_line()`` to get the full request data with two buffer reads and reveal possible bugs related to the internal buffer mechanism. See #670 for more information.
2013-12-30 00:14:46 +02:00
benoitc
bb00d41ff9 fixes for py27 2012-10-24 23:08:15 +02:00
benoitc
8d453fb341 all tests pass under python 3 2012-10-24 22:07:35 +02:00
benoitc
d79ff999ce fix multiple issues with request limit
patch from Djoume Salvetti . address the following issues in gunicorn:

* Gunicorn does not limit the size of a request header (the
* limit_request_field_size configuration parameter is not used)

* When the configured request limit is lower than its maximum value, the
* maximum value is used instead. For instance if limit_request_line is
* set to 1024, gunicorn will only limit the request line to 4096 chars
* (this issue also affects limit_request_fields)

* Request limits are not limited to their maximum authorized values. For
* instance it is possible to set limit_request_line to 64K (this issue
* also affects limit_request_fields)

* Setting limit_request_fields and limit_request_field_size to 0 does
* not make them unlimited. The following patch allows limit_request_line
* and limit_request_field_size to be unlimited. limit_request_fields can
* no longer be unlimited (I can't imagine 32K fields to not be enough
* but I have a use case where 8K for the request line is not enough).

* Parsing errors (premature client disconnection) are not reported

* When request line limit is exceeded the configured value is reported
* instead of the effective value.
2012-05-24 12:13:34 +02:00
benoitc
be19f414ae close #294 .
Thanks for the patch
2012-02-20 11:23:58 +01:00
benoitc
b7b0979ad9 check if Request Line is too large.
You can now pass the parameter --limit-request-line or set the
limit_request_line in your configuration file to set the max size of the
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. By default this value is 4094 and can't be larger than
8190.

This parameter can be used to prevent any DDOS attack.
2012-02-20 09:56:06 +01:00
benoitc
9631c2ab5a with_statement. spotted by @jbergstroem on irc 2010-07-05 17:06:17 +02:00
Randall Leeds
4e20f606f1 fix inconsistencies with urlparse lib 2010-07-01 13:15:15 +08:00
Paul J. Davis
2763fe8e9f Added tests for invalid requests.
Need to flesh out more error cases.
2010-06-03 16:11:18 -04:00
Paul J. Davis
5af1273fc2 Added more valid request tests.
Found and fixed a couple read and readline related bugs.
2010-06-03 16:11:18 -04:00
Paul J. Davis
27cc404f1f Imported simplehttp request tests. 2010-06-03 16:11:17 -04:00