1366 Commits

Author SHA1 Message Date
benoitc
d55ef38c8a reuse util.is_fileobject
is_fileobject usgae was removed due to the use of the `tell` method check.
This change remove this check wich allows us to completely test if
fileno() is usable. Also it handle most of the exceptions around created by
breaking changes across Python versions. Hopefully we are good now.

fix #1174
2015-12-31 14:50:48 +01:00
Benoit Chesneau
6439c3ba7a don't check if a file is writable using os.stat
Some systems edisable like SELINUX disable some flags so ignore the possible
error while chowning a log file. The error will be raised later anyway.

fix #1171
2015-12-29 15:01:23 +01:00
Benoit Chesneau
01cdd8b62a bump to 19.4.2
fix #1159
2015-12-29 01:32:53 +01:00
Randall Leeds
98c9e3b375 Catch sendfile failure from no file descriptor
If the filelike response object has no `fileno` attribute, then skip
trying to use sendfile rather than failing with an error.

Close #1160
2015-12-28 14:50:46 -08:00
Benoit Chesneau
9730978782 fix sendfile option validation
sendfile option don't set any default for now which makes the validation fail
(and then tests) since no boolean is given. For now just return when the value
is not set.
2015-12-28 20:39:45 +01:00
Benoit Chesneau
c805bd2960 check auth before trying to own a file
fix #1157
2015-12-28 13:00:44 +01:00
Benoit Chesneau
d199e76cea revert TCP__FASTOPEN change
on OSX socket.TCP_FASTOPEN is set but make the server enter in a loop while
trying to set the options which makes gunicorn unusable.

For now remove TCP_FASTOPEN option until we find a solution
2015-12-28 12:56:11 +01:00
Randall Leeds
2f8e7503fe Always send access log to syslog if syslog is on 2015-12-27 13:30:37 -08:00
Randall Leeds
d8b6f0afff Clarify --no-sendfile default
The --no-sendfile option had a confusing entry in the usage message.
Even though sendfile is enabled by default, the --no-sendfile flag
showed a true value as the default, which could be interpreted to
mean that by default sendfile support is disabled.

This change makes the default "None", meaning sendfile is not
disabled, which is hopefully slightly more clear.

Close #1156
2015-12-27 13:27:20 -08:00
Randall Leeds
2ac41c406b Merge pull request #1095 from danc86/handle-HaltServer-in-manage_workers
handle HaltServer in manage_workers
2015-12-26 14:35:55 -08:00
benoitc
0fbb94e8c6 Merge branch 'master' of github.com:benoitc/gunicorn 2015-12-24 09:52:59 +01:00
benoitc
c66a9722f6 Merge branch 'feature/tcp_fastopen' into tcp_fast 2015-12-24 09:51:18 +01:00
Randall Leeds
1f3bdddfb2 Do not rely on sendfile sending requested count
Close #1155
2015-11-29 11:14:04 -08:00
benoitc
6aba0680b9 document change 2015-11-25 16:59:37 +01:00
mtustin-handy
5c2cb816d0 Fix random outdent which makes gtornado worker unusable 2015-11-25 10:41:04 -05:00
benoitc
09e0d4c7fc encode fix test 2015-11-25 14:11:54 +01:00
benoitc
5f4ebd2eb2 don't return utf8 header in example
Since the updated RFC 7230 implys that new Headers Key and Value should be
sent as USASCII only don't try to test utf8 headers in examples.

We now only encode them to ascii. Gunicorn will fail if it's unable to encode
them letting the responsability to the application to correctly encode the
response. (we are just a gateway).

While i'm here simplify the code to not create an extra function only used at
one place.

NOTE: if anyone come to a better solution, i am happy to revisit it on the
next release.

fix #1151
2015-11-25 13:29:46 +01:00
Benoit Chesneau
6b92575e00 Merge pull request #1094 from benoitc/1038-sendfile-seek
Simplify sendfile logic
2015-11-23 09:24:46 +01:00
benoitc
45f008187b also ignore binascii error when decoding the user in access log 2015-11-21 11:27:27 +01:00
benoitc
38261b5235 check if the auth type is Basic before getting the user name
fix #1148
2015-11-21 11:27:27 +01:00
benoitc
5d902e2a07 prepare the 19.4 release.
update changelog, bump the version.
2015-11-20 11:00:00 +01:00
Benoit Chesneau
c8f820b95a Merge pull request #1136 from shrkw/1135-fix-ssl-options-for-tornado
fix-ssl-options-for-tornado
2015-11-16 15:37:09 +01:00
Randall Leeds
18d2b92146 Simplify sendfile logic
A safe and reliable check for whether a file descriptor supports mmap
is to directly check if it is seekable. However, some seekable file
descriptors may also report a zero size when calling fstat. If there
is no content length specified for the response and it cannot be
determined from the file descriptor then it is not possible to know
what chunk size to send to the client. In this case, is it necessary
to fall back to unwinding the body by iteration.

The above conditions together reveal a straightforward and reliable
way to check for sendfile support. This patch modifies the Response
class to assert these conditions using a try/catch block as part of
a new, simplified sendfile method. This method returns False if it
is not possible to serve the response using sendfile. Otherwise, it
serves the response and returns True. By returning False when SSL is
in use, the code is made even simpler by removing the special support
for SSL, which is served well enough by the iteration protocol.

Fix #1038
2015-11-10 17:57:56 -08:00
Berker Peksag
eb29a449aa Merge pull request #1137 from abesto/doc/graceful_timeout
Clarify documentation of graceful_timeout
2015-11-02 12:15:38 +02:00
Zoltán Nagy
f1bb0342ec Clarify documentation of graceful_timeout 2015-11-02 08:49:13 +01:00
Benoit Chesneau
d922df3902 make sure the users can access to the logs
make sure that a user is able to access to the logs after dropping a
privilege.

fix #1116
2015-10-31 09:17:43 +01:00
Hiroyuki Shirakawa
b4e86ad73f Fixes #1135 2015-10-28 12:04:08 +09:00
Randall Leeds
821123d48f Merge pull request #1128 from NextThought/1126-gevent-time
Make the gevent workers handle the quit signal by deferring to a new greenlet
2015-10-26 10:41:21 -07:00
Randall Leeds
50a40b52b6 Merge pull request #1132 from bungoume/add-accesslog-params
Add accesslog params
2015-10-22 11:37:05 -07: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
umezaki
03cd031b06 Fix accesslog params description 2015-10-22 02:02:13 +09:00
Jason Madden
fb96a9ae69 Make the gevent workers handle the quit signal by deferring to a new greenlet. Fixes #1126. 2015-10-15 18:13:35 -05:00
Nick Stenning
b135c0570f Respect defaults when running a paster application
The values of both the 'workers' and 'umask' settings have global
defaults. In the case of 'workers', this global default can be
overridden by the WEB_CONCURRENCY environment variable, which prior to
this commit is ignored by `gunicorn --paste`.

Removing this duplication of defaults allows `gunicorn --paste` to
respect settings from:

- the environment (WEB_CONCURRENCY)
- the paste configuration file
- CLI flags
2015-10-15 14:10:49 +02:00
Benoit Chesneau
44ac4e457f inherit from Exception where it needs to be
inherit from Exception where it needs to be and document why we use BaseException.

fix #997
2015-10-09 07:48:18 +09:00
keakon
5708d1d23b remove checking timeouts 2015-10-08 12:20:43 +08:00
benoitc
2221225969 makes sure that file handles are correctly reopened on HUP
This change makes sure we don't recreate the Logger class here so we
don't reinitialise the log handlers.

fix #627
2015-09-23 14:00:35 -07:00
Jochen Wersdörfer
338721ac56 encode http headers as latin1 RFC 2616 2015-08-29 11:16:58 +02:00
tumb1er
21c7e106a3 SSL support for gaiohttp worker
Initialize and pass `SSLContext` to `asyncio.loop.create_server` to enable ssl support.
2015-08-25 16:15:46 +03:00
Benoit Chesneau
a132ca97c8 Merge pull request #1078 from preo/reduce-arbiter-noise
Only log '[num] workers' message when it changes.
2015-08-19 21:02:52 +02:00
Dan Callaghan
d6429233d9 handle HaltServer in manage_workers 2015-08-11 17:10:12 +10:00
Robert Estelle
e028710872 Make last logged worker count an explicit instance var. 2015-07-23 18:14:02 -04:00
benoitc
64a5b5cdf3 don't close the unix socket when the worker exit
When the worker was exiting, eventlet is closing the listening socket in th
worker. Since the socket instances are shared, this was also removing the unix
socket on close. This change make sure that the socket can only be closed by
its parent (where the socket have been bound).

While I'm here, also make sure we don't use any blocking function in eventlet
while switching).

fix #965
2015-07-22 06:22:24 +02:00
Robert Estelle
6f6ec92c4e Store last logged worker count.
This is easier and safer than only logging when we detect that
self.WORKERS has changed or that `spawn_worker` or `kill_worker` has
been done.
2015-07-19 16:09:27 -04:00
Robert Estelle
09357ed3c4 Only log '[num] workers' message when it changes.
Otherwise when debug logging is on, the message prints every second even
with no system activity.
2015-07-19 15:56:58 -04:00
Slava Shklyaev
0d86a9094d Improve markup of settings.rst 2015-07-15 04:10:15 +03:00
Mark Lee
a33f6ea602 Clarify pythonpath setting description
Show that setting multiple paths requires using a comma-separated list.
2015-07-12 18:13:17 -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
Randall Leeds
d971eb4464 Merge pull request #1042 from brijeshb42/master
Updated gunicorn/pidfile.py
2015-07-08 23:33:31 -07:00
Brijesh Bittu
db786ce90e Removed or 0
Removed `or 0` to raise `ValueError` for empty pidfile or pidfile with invalid contents.
2015-07-09 11:44:14 +05:30
Brijesh Bittu
68a944088e Update pidfile.py
Return directly in the `except` instead of checking again for zero (as suggested by @benoitc and @tilgovi)
2015-07-09 10:38:14 +05:30