122 Commits

Author SHA1 Message Date
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
Wojtek
62ee0859bc fixed random number generation in case of urandom absence 2012-04-12 13:46:51 +02:00
Maxim Kamenkov
16eb657584 Added "validate_class" option validator.
Now you able to use existed type instance or factory method to create and customize class during in-code configuration.

E.g.:
>>> settings.set('worker_class', MyWorkerClass)
>>> settings.set('worker_class', lambda: MyWorkerClass)

All other formats still valid.
2012-03-16 05:52:25 +01:00
benoitc
8e185d38d0 shouldn't be here. 2012-02-19 22:11:39 +01:00
benoitc
cc43f89ef5 compatibility with django 1.4 and more related fixes.
- handle new way to launch applications in django 1.4
- simplify the way we discover the project path and settings
- add --pythonpath & --settings options for django applications
- still compatible with older versions (>=1.1)
-handle DJANGO_SETTINGS_MODULE env.

close #283, #275, #274, #241
2012-02-19 21:56:41 +01:00
benoitc
cc99181cee logging.fileConfig support is back. 2012-02-19 17:07:42 +01:00
benoitc
f168a21dae fix whitespaces 2012-02-19 11:27:46 +01:00
Randall Leeds
0c4021d169 fix #262: typo krange -> xrange 2011-09-22 14:09:33 -04:00
Randall Leeds
6bac0216aa add util.closerange using os module or fallback 2011-09-19 13:42:07 -07:00
benoitc
824801d017 make the Logger pluggable. Allows people to use their own logger by
giving to gunicorn an entry point or a module path.
2011-09-09 00:43:00 +02:00
Paul J. Davis
7ffa097cf7 Use split (not rsplit) to separate MOD:APP info. 2011-06-02 09:17:59 -04:00
Dan Sully
4f96ccedc1 Catch ctypes import errors. 2011-03-23 07:37:40 +01:00
Alex Robbins
974698671a Moved the random seed method into a function.
Added a try/except block to catch NotImplementedErrors for platforms
that don't support urandom.
2011-03-14 23:10:09 -04:00
benoitc
c21578df40 ctypes triggers selinux execmem denial
https://bugzilla.redhat.com/show_bug.cgi?id=488396

fix issue #168. Thanks!
2011-03-06 10:14:52 +01:00
benoitc
7dd7b71523 patch from @davisp, ease the code. 2011-02-25 08:47:46 +01:00
Paul J. Davis
885b530e1a Always log exceptions during request handling.
* Always log the exception locally
  * Still only pass the exception in the HTTP response if
    debug is turned on.
  * Slight cosmetic changes to the actual HTML of the error
    response.
2011-01-29 14:43:18 -05:00
benoitc
cd726f6d8c fix issue #142. Thanks 2011-01-04 09:42:49 +01:00
benoitc
a8e34ac16c send appropriate error status on http parsing. Fix issue #132. 2010-12-12 14:16:31 +01:00
benoitc
53ec6b02a5 split is enough 2010-11-20 22:01:12 +01:00
benoitc
09e243d6f6 ipv6 support in gunicorn. fix ticket #107. 2010-11-20 21:04:03 +01:00
benoitc
bc2d0112a8 use only git shorttag with 'develop' command, also don'ty load it each
time. spotted by @davisp .
2010-11-10 19:28:18 +01:00
benoitc
2ad2a61f0c fix issue #104. 2010-10-29 05:58:09 +02:00
Paul J. Davis
006a8b6e9d Drop Server and Date headers in start_response.
We now treat Server and Date headers as hop-by-hop headers (ie, drop them)
so that they aren't repeated. While not technically hop-by-hop, the WSGI
spec says we should take the role of an origin server.

Fixes #79
2010-08-12 16:11:45 -04:00
benoitc
5108a720f2 use a specific release number for dev depending on git tag 2010-07-31 16:18:13 +02:00
Benoit Chesneau
aca70fbec8 allows worker_class uri shortcut. It's now possible to do :
gunicorn -w 3 -k gevent test:app

ie. removing the need of using egg:gunicorn before.
2010-07-23 10:57:21 +02:00
Paul J. Davis
3ad7c1b395 Make WSGI app names are now evaled in the module namespace.
This allows people to pass info from the command line to a WSGI
application. See examples/alt_spec.py for code that uses this
method. Example invocation:

    $ gunicorn 'alt_spec:load("my arg here")'

Notice the single quotes to avoid shell escape semantics.

Closes #56
Closes #40
2010-07-08 00:12:15 -04:00
benoitc
f8fac58d73 some fixes discovered with pyflakes 2010-05-23 00:44:53 +02:00
Paul J. Davis
036f8b50d9 Major refactor of the configuration mechanics.
* All configuration and bootup is handled by the Application objects.

* There is now a strict ordering on the precedence of configuration
settings:

  1. Each option is given a default value of some sort in options.ini

  2. Any detectable framework configuration settings override the hard
     coded defaults for options. Currently, only Paster applications
     have support for this.

  3. Anything that is specified in a Gunicorn configuration file (by
     default gunicorn.conf.py) overrides what was possibly set by a
     framework specific configuration source.

  4. Anything specified on the command line reins supreme. The command
     line is the final authority on a given configuration option.
     Though, not all configuration options are available via command
     line.

* Configuration metadata is pulled from an options.ini. In the future I'll
use this to build the example gunicorn.conf.py and the config.rst file
in docs/site/config.rst.

I haven't tested the differences thoroughly. The next item on my agenda
is to figure out a way to start testing Gunicorn that doesn't make my
eyes bleed.
2010-05-19 13:39:37 -04:00
Paul J. Davis
0c935d06c7 Got the Sync and Eventlet workers running. 2010-04-15 21:20:17 -04:00