65 Commits

Author SHA1 Message Date
benoitc
f80ddf368c fix tests 2014-08-16 12:26:04 +02:00
Randall Leeds
42ff88bbbd Merge pull request #838 from mgood/statsd-timing
Send statsd timing metrics in milliseconds
2014-08-05 00:26:40 -07:00
Matt Good
59bf9b5867 Fix statsd test for millisecond times 2014-08-03 14:39:34 -07:00
Alexis Le-Quoc
bc2e132bce Rework logging to allow for empty log message while pushing metrics 2014-08-03 17:15:13 -04:00
Andrew Svetlov
2b2725dddb Support UNIX sockets in gaiohttp worker 2014-07-23 07:33:18 +03:00
Benoit Chesneau
ceda9c597c Merge pull request #748 from alq666/statsd-logger
gunicorn instrumentation via statsD and a new logger class
2014-06-28 16:45:54 +02:00
Thomas Grainger
2bde8eb103 Support loading config from module 2014-06-20 09:20:37 +01:00
Alexis Le-Quoc
05051aa8b2 Simpler statsd integration
No need to specify a logger class.
--statsd-to is enough to trigger the Statsd logger automatically
2014-06-18 21:33:04 -04:00
Alexis Le-Quoc
c3421a833d Merge branch 'master' of https://github.com/benoitc/gunicorn into statsd-logger 2014-06-18 11:23:36 -04:00
Andrew Svetlov
e9518383da Fix gaiohttp tests for Python 2.5 2014-06-09 19:31:52 +03:00
Andrew Svetlov
e1d97f1bea Add tests for gaiohttp worker 2014-06-09 18:36:46 +03:00
Alexis Le-Quoc
3c3c52fb6a Fix failing test and reorder logging to always log 2014-05-31 13:14:05 -04:00
Alexis Le-Quoc
89a3c96700 Incorporate feedback from PR
Use extra keyword in logger, more pythonic
capture response code as a rate metric
2014-05-31 00:10:51 -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
Nick Pillitteri
9c1b46f998 Move setting of environmental variables before preload_app start.
Move setting of env vars from Arbiter.start to Arbiter.setup so that they are available during application start up when 'preload_app' is used.

Closes #735
2014-05-13 15:46:06 -04:00
Stephen Holsapple
c353828351 Define Ciphers config conditionally
We only expose the `Ciphers` config parameter in versions of Python that
support it (i.e., >= Python 2.7).
2014-04-22 12:21:01 -07:00
W. Trevor King
2277901a72 Deprecate the --debug setting
"Limits the number of worker processes to 1" hasn't been true since
06a4dc6 (fix one error in gunicorn_paster, global conf was ignored,
2010-06-22), although it was true when the line was added in 3c7d532
(Large refactor of the documentation and website, 2010-05-22).

"changes some error handling that's sent to clients" hasn't been true
since feb86d3 (don't display the traceback in the HTTP response,
2013-09-27).

The only remaining actions that --debug had were disabling --preload
and hiding debug-level config logging.  The former seems useless (just
disable --preload directly) and the latter at doesn't seem useful
enough for a new setting (just turn down --log-level).  With this
commit, --preload always works and you always get debug-level config
logging.

I left a stub Debug entry in gunicorn.config, which we can leave in
place while folks convert any gunicorn scripts and configurations to
drop --debug.  When the time comes, we can just remove that entry.  I
also the boolean-config tests to use --preload, since that will still
be around after we remove the dummy Debug entry.

Fixes #700.
2014-02-13 12:40:41 -08:00
Benoit Chesneau
26a796f200 Merge pull request #670 from gnotaras/bugfix-request-line-check
Fixed the request line length check.
2014-01-01 07:48:44 -08: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
Dariusz Suchojad
5fb61cb841 Added support for more options to ssl.wrap_socket 2013-12-26 14:21:38 +01:00
Jorge Niedbalski R
a716285ed0 Added coverage for get_default_config_file, also a test for default config overrides 2013-06-22 07:14:08 -07:00
benoitc
5e08c27495 improve STDOUT/STDERR logging redirection.
Instead of faking STDIN/STDERR to a fake object that we close on reopen,
simply redirect them to a file and reopen this one when need.

Should fix most of the issues on #309
2013-04-21 11:31:58 +02:00
jean-philippe serafin
87474ffce1 add test_atom_defaults() 2013-04-18 15:58:55 +02:00
benoitc
ac1af72922 s/optparse/argparse 2012-12-25 06:19:06 +01:00
Qiangning Hong
174c34ec9c add nworkers_changed hook
This hook will be called whenever the number of workers is set.
2012-12-21 15:43:26 +01:00
Konstantin Enchant
aac56c9d55 Added response arg for post_request hook. 2012-12-16 10:21:01 +01:00
benoitc
b7b51adf13 allows gunicorn to bind to multiple address
Allows gunicorn to listen on different interface. It can be either ipv6,
unix or ipv4 sockets.

Ex:

    gunicorn -w3 -b 127.0.0.1:8001 -b 127.0.0.1:8000 -b [::1]:8000 test:app

fix #444
2012-12-14 10:18:39 +01:00
Eric Shull
e58f8b59b7 Add isatty method to LazyWriter. 2012-11-16 07:59:55 +01: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
Konstantin Enchant
8f4edfa0bf Callable hooks for paster config. 2012-09-27 19:14:41 +02:00
Konstantin Kapustin
70534acde8 Implantation proxy protocol 2012-09-27 19:14:40 +02:00
Konstantin Kapustin
4be3282440 Check Content-Length header.
For not chunked request do validation Content-Length header and return 400 if invalid.
2012-09-27 19:14:40 +02:00
Konstantin Kapustin
d28366a683 Add ForwardedAllowIPS option. 2012-08-26 22:28:34 +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
Djoume Salvetti
9e308e317f Improves performance of http.body.Body.readline() 2012-05-10 11:24:54 +02:00
benoitc
be19f414ae close #294 .
Thanks for the patch
2012-02-20 11:23:58 +01:00
benoitc
7a1c58f236 test number of headers fields and size.
Add --limit-request-fields (limit_request_fields) and
--limit-request-field-size (limit-request-field-size) options.

- limit_request_fields:

    Value is a number from 0 (unlimited) to 32768. This parameter is
    used to limit the number of headers in a request to prevent DDOS
    attack. Used with the `limit_request_field_size` it allows more
    safety.

- limit_request_field_size:

    Value is a number from 0 (unlimited) to 8190. to set the limit
    on the allowed size of an HTTP request header field.
2012-02-20 10:36:13 +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
benoitc
c89ce5f5ad debug behavior has changed. 2010-07-01 07:20:36 +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
benoitc
dd620a5788 add missing license header 2010-05-22 11:59:41 +02:00
Paul J. Davis
6ffbe54734 Added unit tests for new Config code. 2010-05-21 22:54:22 -04:00
benoitc
c785be0780 new parser using StringIO, faster than concatenate strings. Lot of fixes
in TeeInput.
2010-03-06 20:47:39 +01:00
jbergstroem
e5e6b70895 Fix failed tests due to lack of passing config to a Request 2010-03-03 15:44:54 +08:00
benoitc
ea02c5e073 this seems to fix problem with upload. Tested with the django app 2010-02-28 22:46:35 +01:00