150 Commits

Author SHA1 Message Date
wong2
250d98f48a fix for review 2015-03-14 23:28:24 +08:00
wong2
d03891a470 reloader should survive SyntaxError 2015-03-11 20:46:44 +08:00
Berker Peksag
d376b6f78a Raise TypeError instead of AssertionError.
assert statements will be removed if you run Python
in optimized mode (e.g. with -O flag).
2015-02-23 00:35:47 +02:00
Berker Peksag
56e7d15fb8 Use more Pythonic style in gunicorn/. 2014-11-24 18:43:21 +02:00
Randall Leeds
fcba1a6c1c Merge pull request #770 from dwagon/731-umask
731 - Avoid creating world writable files
2014-11-17 19:03:01 -08:00
Collin Anderson
bfae0c91de sys.stderr.write -> print(msg, file=sys.stderr) 2014-09-16 15:38:56 -04:00
Collin Anderson
0d3045bb41 cleaned some code 2014-09-10 20:34:22 -04:00
Paul J. Davis
fc364cca7d Fix check for file-like objects
The `is_fileobject()` function in utils.py would break when the respones
was a wrapped `HTTPResponse`'s `raw` attribute. This just adds the
`IOError` exception type to the `is_fileobject()` function so that the
response can be streamed normally.

Fixes #805
2014-06-26 14:31:40 -05:00
Philipp Saveliev
dcb9464bbe fix HTTP-violating excess whitespace in write_error output 2014-06-03 03:05:27 +04:00
Dougal Scott
1b047a7e7b Avoid creating world writable files 2014-06-02 08:07:43 +10:00
benoitc
b7cbb59bbc remove useless code 2014-05-31 07:18:39 +02:00
benoitc
5f0a329b58 add fdevents module
This module add a new cross platform event poller to gunicorn. It allows
you to listen on different fds in an efficient manner.

On linux it's using epoll, bsd/darwin kqueue...
2014-04-13 08:59:47 +02:00
Berker Peksag
5c78adf9b9 Use email.utils.formatdate in gunicorn.util.http_date.
There is a also an open issue for CPython:

http://bugs.python.org/issue747320
2014-02-14 02:26:09 +02:00
Levi Gross
e0d2930887 Removed the <p> tag from the base file and added it to the template 2014-02-05 19:45:30 -05:00
Levi Gross
791ea6ae53 Invalid user supplied messages should be escaped HTML entity escaped. 2014-02-04 10:57:15 -05:00
benoitc
fdccb61616 use import_module instead of our own hack to import the module 2013-12-26 11:51:18 +01:00
benoitc
a397d90774 don't depend on entry point for internal classes.
We don't have to depend on entry points when loading suppoorted workers
nad extensions, instead use the absolute path to load the class.

fix #259
2013-12-26 11:33:05 +01:00
benoitc
f886d86b46 deprecate gunicorn_django 2013-08-27 21:17:33 +02:00
benoitc
dc97e54412 handle io.BytesIO object with file_wrapper
fix #595
2013-08-27 11:45:32 +02:00
benoitc
82099deff2 remove stupid change.
fix #519
2013-04-24 23:49:50 +02:00
benoitc
160db1f521 nginx way to set unix addresses 2013-04-23 16:29:31 +02:00
benoitc
532d1fffaf document the use of PYTHONUNBUFFERED in config 2013-04-23 16:23:46 +02:00
Graham Dumpleton
32e4cf14df Ensure that detaching from controlling terminals, but allow for redirection to files. 2013-04-23 16:23:46 +02:00
benoitc
29aefcc1cf only close 0-2 fds when -R isn't specified
Following some discussion on IRC with @GrahamDumpleton this patch only
close stdios if -R isn't specified. It also let others fds open and
don't try to close them.

This should fix logging around and behave like other daemons. It should
also close #309.
2013-04-23 16:23:46 +02:00
benoitc
cc7f595adc Enable stdio inheritance.
Enable inheritance for stdio file descriptors in daemon mode. It allows
you in daemon mode to redirect the output to a file if needed.

By default in daemon mode gunicorn will close all file handle except if
you pass the "-R" options. In this cases STDIO will be preserved.

fix #309
2013-04-23 16:23:46 +02:00
benoitc
2e2432c91b Revert "add GUNICORN_INHERIT_FDS environment variable support"
This reverts commit c9fcb25f51db9ae67f9585c93924e5af8b8bb8b8.
2013-04-22 19:05:31 +02:00
benoitc
612f4125dd make sure we exit immediately if we fail to load the application.
While I'm here describe a more accurate error when it happens.

fix #508
2013-04-22 18:43:20 +02:00
benoitc
c9fcb25f51 add GUNICORN_INHERIT_FDS environment variable support
You can now pass a list of file descriptors to Gunicorn that won't be
closed when it starts. Allows someone to pass any stream to gunicorn or
set some redirection.
2013-04-21 11:57:38 +02:00
benoitc
9acafc25f0 catch ValueError when ipv6 isn't not supported on the platform
fix #479
2013-04-21 07:47:19 +02:00
Chris Streeter
e908ec3359 Consistently get CWD across apps and arbiter.
The Arbiter is smart about getting the CWD; first it checks the CWD
environment (which doesn't resolve symlinks), then it falls back to the
python os.getcwd() (which does resolve symlinks). However, the Arbiter
is the only place that does this, which will then do the right thing
when we reexec. However, when reloading the Arbiter, it won't pick up
changes if the symlink has changed.

By changing the *app.py entry points to also use the same method for
determining the CWD, we'll insert a symlink path into the first location
in sys.path. Then our reloaded app will correctly pull in any new
changes.
2013-04-03 11:15:53 +02:00
Kenneth Reitz
a314f5adb1 Merge pull request #485 from mahmoud/master
Remove ctypes dependency in util
2013-03-18 13:54:51 -07:00
Mahmoud Hashemi
22dccb3349 remove ctypes dependency for unsigned integer math related to setgid. this should re-enable selinux usage (and usage on other systems without ctypes). 2013-02-12 23:01:56 -08:00
Mahmoud Hashemi
318b365b8a fixed unreachable code surrounding 'unix://' addresses. 2013-02-12 22:58:05 -08:00
Dmitry Medvinsky
25e22e31df Use getattr with default instead of if hasattr/else 2013-01-08 18:23:14 +04:00
benoitc
eb73681181 make import errors more visible
fix #461
2013-01-06 12:47:06 +01:00
benoitc
dae4d38705 add syslog support.
Add options to setup logging to syslog:

- `--log-syslog`: enable syslog. It default to `/var/run/syslog` on darwin,
  `/var/run/log` on freebsd, `/dev/log` on openbsd and udp://localhost:514 for
  other platforms.
- `--log-syslog-prefix: Pass the parameter to use as the program name
- `--log-syslog-to`: Setup the syslog address to send message. Address startinf
  by udp:// will send to udp, unix:// to a unix socket and tcp:// to tcp (useful
  for rsyslog)

fix #452 .
2012-12-25 06:19:06 +01:00
Adnane Belmadiaf
20cd49595a PEP8 fixes 2012-12-24 09:53:03 +01:00
benoitc
77251d9d30 make sure we don't prematuraly close the fd of the worker tmp file.
fix #407
2012-12-21 15:43:26 +01:00
benoitc
91e7d138dc fix header encoding 2012-11-16 10:05:26 +01:00
benoitc
e4fbc805b6 fix error spotted by @andrewsg 2012-10-28 06:56:00 +01:00
benoitc
8d453fb341 all tests pass under python 3 2012-10-24 22:07:35 +02:00
benoitc
60644b12af miscellaneous fixes 2012-10-24 14:24:19 +02:00
benoitc
003c474fe2 handle bytes & native strings
This patch makes sure that we now handle correctly bytes and native
strings on python 3:

- In python 3, sockets are now taking and returning bytes.
- according to PEP3333, headers should be native strings and body in
  bytes.
2012-10-24 13:51:35 +02:00
benoitc
53ce50bc7b obvious syntax fixes preparing python3 support 2012-10-24 12:11:15 +02:00
benoitc
40d705c5d6 Revert "drops suplemental groups when droping privileges."
This reverts commit 634ccba7c3f9f72f7aedbe4690c18ebdbdf8b2e1.

doesn't work on OSX for some reason
2012-10-18 21:27:05 +02:00
benoitc
634ccba7c3 drops suplemental groups when droping privileges.
fix issue spotted by Vangelis Koukis
2012-10-18 18:31:28 +02:00
benoitc
12a0e55bcf Revert "fix issue #348 ."
This reverts commit da637dfd13b520fc190b86967dfecc06bf97a2b4.
2012-06-19 10:31:06 +02:00
benoitc
118c571898 fix issue #348 .
Rather than testing the parent pd, test if the parent pid is still
alive. Only use it in gevent for now.
2012-06-04 21:17:11 +02:00
Benoit Chesneau
4b59fc351f fix typo 2012-04-26 18:30:01 +02:00
Benoit Chesneau
5f11713678 log HTTP errors in access log. close #317 2012-04-26 18:17:55 +02:00