129 Commits

Author SHA1 Message Date
Benno Rice
a4461ba158 RequestParser takes two parameters. 2017-07-12 16:17:50 +03: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
70947bb96a Skip test if WSGIServerHttpProtocol isn't available 2017-04-15 00:55:13 +03:00
Hasan Ramezni
31fed6b470 add tests for umask config. 2017-02-19 13:33:47 +03:30
Mark Adams
bc20bea7d9 Add support for --reload-engine
Currently, gunicorn automatically uses the preferred reloader (inotify
if present with fallback to polling). However, it would be useful in
some scenarios if users could force polling.

The solution for this is to add a new configuration option called
'reload_engine' which takes one of three options: ['auto', 'poll',
'inotify'].

Fixes #1459
2017-02-14 19:49:37 +03:00
Berker Peksag
31b8e48a78 Silence prospector warnings 2017-02-07 09:05:43 +03:00
Berker Peksag
5559f27ea2 Fix test_ssl 2017-02-06 09:18:41 +03:00
Berker Peksag
577c3eb030 Use the best available reloader when --reload is passed
Fixes #1422
2017-02-06 07:32:14 +03:00
Benoit Chesneau
bd19be1b61 Merge pull request #1414 from benoitc/fix/1091-pidfile-eperm
Fix/1091 pidfile eperm
2017-02-01 14:14:13 +01:00
Benoit Chesneau
21ffa92be1 Merge pull request #1394 from jonashaag/master
Add child_exit() callback to configuration
2017-01-27 16:00:58 +01:00
Hasan Ramezni
e9a00b75c5 add empty line after some tests. 2017-01-17 20:37:02 +03:00
Hasan Ramezni
e007601f0d test error message in test_invalid_enviroment_variables_config test. 2017-01-17 00:55:45 +03:00
Hasan Ramezni
bb2496db7b test_cmd_line_invalid_setting added. 2017-01-15 23:34:23 +03:00
Randall Leeds
22de9c5693 add pidfile validate tests 2017-01-11 19:52:15 -08:00
Saeed Gharedaghi
ab444eed50 change __dict__ to vars function
Back gunicorn/argparse_compat.py gunicorn/six.py files changes

Back run_gunicorn.py file changes
2017-01-11 23:07:20 +03:00
Hasan Ramezani
3f9eace246 Add ability to pass settings to GUNICORN_CMD_ARGS. (#1385) 2017-01-08 16:41:28 +03:00
Randall Leeds
0be7996885 Refactor socket activation and fd inheritance (#1310)
Track the use of systemd socket activation and gunicorn socket inheritance
in the arbiter. Unify the logic of creating gunicorn sockets from each of
these sources to always use the socket name to determine the type rather
than checking the configured addresses. The configured addresses are only
used when there is no inheritance from systemd or a parent arbiter.

Fix #1298
2016-12-27 14:01:20 -08:00
Jonas Haag
53fd1c1071 Add child_exit() callback
This is similar to worker_exit() in that it is called just after a
worker has terminated, but it's called in the Gunicorn *master* process,
not the *child* process.
2016-11-25 12:16:23 +01:00
Jonas Haag
b3c4260706 Add test for worker_exit() 2016-11-25 12:16:23 +01:00
Your Name
a912e305c9 Reject requests like "GET / HTTP/1a1"
Numbers must be separated by dot. This makes life
a little bit harder for attackers who would like to inject specially crafted packets after GET / (e.g. in nginx there are sometimes regular expressions like (?P<action>[^.]).html
2016-11-04 21:16:01 +03:00
Roy Williams
b4c41481e2 Fix leak of duplicate file descriptor for bound sockets.
`socket.fromfd` does not close the original file descriptor, so we have to explicitly close it to avoid a leak.

See also:
http://bugs.python.org/issue10099
2016-10-18 00:15:40 +03:00
Tobias Gustafsson
70cfb0d818 Remove upper limit on max header size config (#1313)
Fixes #1306
2016-09-17 12:49:05 +03:00
benoitc
418f140445 remove file locking
This changes improve the binary upgrade behaviour using USR2:

- only one binary upgrade can happen at a time: the old arbiter needs to be
  killed to promote the new arbiter.
- if a new arbiter is already spawned, until one is killed USR2 has no action
- if a new arbiter has been spawned, the unix socket won't be unlinked
- until the old arbiter have been killed the newly created pidfile has the name
  <pidfile>.2 and the name Master.2 .

Note: there is no dialog between both arbiters to handle this features.
Instead they will supervise each others until one is killed. So isolation is
still guaranted.

fix #1267
2016-05-20 15:42:55 +02:00
benoitc
8a6748ee65 fix unix socket locking
This change add proper file locking to gunicorn. By default "gunicorn.lock" is created in the temporary directory when a unix socket is bound.  In case someone want to fix the lock file path or use multiple gunicorn instance the "--lock-file" setting can be used to set the path of this file.

fix #1259
2016-05-14 22:03:40 +02:00
Eugene Obukhov
a04b5f0975 Add tests for reader classes (#1241)
* Fix FakeSocket.recv method

* Add tests for Unreader and its subclasses

* Add tests for EOFReader and LengthReader
2016-04-15 00:49:00 +03:00
Berker Peksag
31fd844333 Fix test_http on Python 2 2016-03-20 08:16:05 +02:00
Berker Peksag
b17f1bc305 Fix typo in test name 2016-03-20 07:52:59 +02:00
Berker Peksag
33924a8649 Use more pytest.raises() in test_http.py
Signed-off-by: Berker Peksag <berker.peksag@gmail.com>
2016-03-20 07:52:13 +02:00
benoitc
1e10a02e73 check if the header contains control characters
fix #1227
2016-03-19 19:16:59 +01:00
Randall Leeds
b6afc28528 Merge pull request #1221 from benoitc/fix/922-arbiter-close-on-shutdown
[arbiter] close sockets on shutdown
2016-03-13 16:59:02 -07:00
Randall Leeds
39cecbc8e9 [arbiter] close sockets on shutdown
Close all the listeners when the arbiter shuts down. By doing so,
workers can close the socket at the beginning of a graceful shut
down thereby informing the operating system that the socket can
be cleaned up. With this change, graceful exits with such workers
will refuse new connections while draining, allowing load balancers
to respond more quickly and avoiding leaving connections dangling
in the listen backlog, unaccepted.

Ref #922
2016-03-13 16:47:23 -07:00
Randall Leeds
d4e1abd84b Merge pull request #1220 from benoitc/fix/host-restart-uds
Fix/host restart uds
2016-03-13 16:28:52 -07:00
Randall Leeds
452cd550d2 add tests for arbiter unix socket locking 2016-03-13 15:56:22 -07:00
bloodearnest
34b595e817 Always use the the user configured logger class.
Previously, configuring statsd_host would override the configured class
2016-02-19 13:09:58 +00:00
Benoit Chesneau
3fdc113d81 fix gaiohttp test
fix #1164
2015-12-28 20:22:03 +01:00
benoitc
09e0d4c7fc encode fix test 2015-11-25 14:11:54 +01:00
y.umezaki
7dd8a53c8c Add accesslog params
Fix KeyError

Update access logger tests

Update settings.rst docs
2015-10-22 02:28:35 +09:00
Jochen Wersdörfer
338721ac56 encode http headers as latin1 RFC 2616 2015-08-29 11:16:58 +02:00
Slava Shklyaev
0d86a9094d Improve markup of settings.rst 2015-07-15 04:10:15 +03:00
Randall Leeds
ec84c80c75 On pypy3 IOError is not OSError 2015-07-13 14:32:01 -07:00
Berker Peksag
ec3664dd30 Merge pull request #1068 from slava-sh/836-add-config-type-prefix
Prefix config file with its type

Fixes #836
2015-07-09 10:59:29 +03:00
Berker Peksag
da37bcfebe Adda test case for #1069. 2015-07-08 12:16:09 +03:00
Slava Shklyaev
531133615e Prefix config file with its type 2015-07-08 09:21:32 +03:00
Berker Peksag
31ea81f19b Rename statsd test file to test_statsd.py. 2015-07-03 07:51:04 +03:00
Berker Peksag
9475e2625e Rename test files. 2015-07-03 07:46:22 +03:00
Berker Peksag
295ca8ccaf Use six.StringIO in test_statsd.py. 2015-07-03 07:43:44 +03:00
Berker Peksag
7fff5afa39 Minor cosmetic fixes. 2015-07-03 07:43:22 +03:00
Berker Peksag
436c9872a2 Use a pytest fixture in test_default_config_file. 2015-07-03 07:42:56 +03:00
Berker Peksag
a0f05555aa Silence a py.test warning. 2015-07-03 07:41:53 +03:00
Berker Peksag
2af9468940 Parametrize valid request tests. 2015-07-03 07:41:24 +03:00