StopIteration is simply propogated, so there's no reason to catch it.
The catch-all exception is also caught and logged in handle(), but
broken pipe errors are ignored. The redundant catch here was generating
excess logging by calling handle_error for a broken pipe which fails to
send the error because the client has already disconnected.
Instead of hardcoding X-Forwarded-Protocol and X-Forwarded-SSL, make the
header and value configurable, with no default that would enable a
client to spoof secure requests if the reverse proxy is not configured
to strip the header used.
aren't correctly reloaded. First attempt to remove it from sys.modules
introduced more problem than it solved.
This new attempt, just get the module, reload it and populate currently
loaded settings with new values.
Its possible that when iterating Arbiter.WORKERS in manage_workers we
get interupted to handle a SIGCHLD which will pop the child PID from
the dict which results in a "dict changed size while iterating
error. Reported on IRC. Simple fix is to just copy the dict into a
list that we iterate.
Move "import gevent.wsgi" into a separate module, which is not
imported if pywsgi worker is requested. (The gevent.wsgi currently
not provided by gevent trunk but pywsgi works fine.)
mange.py have to use USR2 signal if they want to upgrade the django
version instread of HUP. On the other hand, upgrading django version
with HUP is possible with gunicorn_django command.
If an app iterator attempts to send an empty string to the client
while using chunked transfer encoding it incorrectly signals the
end of the transfer. This patch just ignores empty strings that
are yielded by the application.
change remove it from loaded modules on reload. While we are here we
remove any django module preloaded so we can upgrade django version to
on HUP. fix issue #197.
Validate models before allowing connections via gunicorn_django
This prevents issues where the site is accepting connections but not all
of the models have loaded yet. If your model importing has side effects
(monkey-patching, etc) this can results in errors about missing attributes
or features simply because the code that enables those features as not been
run yet.
This issue does not affect the "run_gunicorn" management command as that
performs it's own model validation before allowing connections, so we are
simply making this consistent here.
Signed-off-by: Chris Lamb <lamby@debian.org>
* 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.