summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Saddi <allan@saddi.com>2006-12-29 18:13:03 +0000
committerAllan Saddi <allan@saddi.com>2006-12-29 18:13:03 +0000
commit2c0357f8f3d4cd595c903a71eea1c1ff08e37660 (patch)
treef762d216301372ada35754a0c0bd70546099bd67
parent9f0cec20d584e40ae03728a1d3072e00a66fea1c (diff)
downloadflup-2c0357f8f3d4cd595c903a71eea1c1ff08e37660.tar.gz
Deprecate WSGI_SCRIPT_NAME and scriptName in scgi_base.
Modern versions of mod_scgi correctly set SCRIPT_NAME & PATH_INFO.
-rw-r--r--ChangeLog72
-rw-r--r--flup/server/scgi.py4
-rw-r--r--flup/server/scgi_base.py49
-rw-r--r--flup/server/scgi_fork.py4
4 files changed, 75 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index c6b467c..c9da87a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,14 @@
-2006-12-13 Allan Saddi <asaddi@sahara.flup.org>
+2006-12-29 Allan Saddi <allan@saddi.com>
+
+ * Deprecate WSGI_SCRIPT_NAME and scriptName in scgi_base.
+ Modern versions of mod_scgi correctly set SCRIPT_NAME &
+ PATH_INFO.
+
+2006-12-13 Allan Saddi <allan@saddi.com>
* Fix problem in session.py seen when optimization is on.
-2006-12-05 Allan Saddi <asaddi@sahara.flup.org>
+2006-12-05 Allan Saddi <allan@saddi.com>
* Update servers to default to an empty QUERY_STRING if
not present in the environ.
@@ -14,25 +20,25 @@
conventions. NB: mimeTypes keyword parameter is now
mime_types.
-2006-12-02 Allan Saddi <asaddi@europa.saddi.net>
+2006-12-02 Allan Saddi <allan@saddi.com>
* Change intra-package imports into absolute imports.
-2006-12-02 Allan Saddi <asaddi@sahara.flup.org>
+2006-12-02 Allan Saddi <allan@saddi.com>
* Add forceCookieOutput attribute to SessionService to
force Set-Cookie output for the current request.
-2006-12-01 Allan Saddi <asaddi@europa.saddi.net>
+2006-12-01 Allan Saddi <allan@saddi.com>
* Update setup script.
-2006-11-26 Allan Saddi <asaddi@europa.saddi.net>
+2006-11-26 Allan Saddi <allan@saddi.com>
* Don't attempt to install signal handlers under Windows
to improve compatibility.
-2006-11-24 Allan Saddi <asaddi@europa.saddi.net>
+2006-11-24 Allan Saddi <allan@saddi.com>
* Add *_thread egg entry-point aliases.
@@ -43,34 +49,34 @@
WSGI -> connector client implentations. (So far: FastCGI,
and SCGI.)
-2006-11-19 Allan Saddi <asaddi@europa.saddi.net>
+2006-11-19 Allan Saddi <allan@saddi.com>
* Change mime-type matching algorithm in GzipMiddleware.
Strip parameters (e.g. "encoding") and accept a list of
regexps. By default, compress 'text/.*' mime-types.
-2006-11-10 Allan Saddi <asaddi@europa.saddi.net>
+2006-11-10 Allan Saddi <allan@saddi.com>
* Add cookieAttributes to SessionService to make it easier
to customize the generated cookie's attributes.
-2006-08-28 Allan Saddi <asaddi@sahara.flup.org>
+2006-08-28 Allan Saddi <allan@saddi.com>
* Add support for FastCGI roles other than FCGI_RESPONDER.
Patch provided by Seairth Jacobs.
-2006-08-02 Allan Saddi <asaddi@kalahari.flup.org>
+2006-08-02 Allan Saddi <allan@saddi.com>
* Add cookieExpiration keyword to SessionService /
SessionMiddleware to adjust the session cookie's expiration.
Thanks to Blaise Laflamme for the suggestion.
-2006-06-27 Allan Saddi <asaddi@kalahari.flup.org>
+2006-06-27 Allan Saddi <allan@saddi.com>
* Set close-on-exec flag on all server sockets. Thanks to
Ralf Schmitt for reporting the problem.
-2006-06-18 Allan Saddi <asaddi@europa.saddi.net>
+2006-06-18 Allan Saddi <allan@saddi.com>
* Stop ignoring EPIPE exceptions, as this is probably the
wrong thing to do. (Application is unaware of disconnected
@@ -81,28 +87,28 @@
NB: Existing applications that use the flup servers may begin
seeing socket.error exceptions...
-2006-05-18 Allan Saddi <asaddi@kalahari.flup.org>
+2006-05-18 Allan Saddi <allan@saddi.com>
* Added umask keyword parameter to fcgi and fcgi_fork,
for use when binding to a UNIX socket.
-2006-05-03 Allan Saddi <asaddi@kalahari.flup.org>
+2006-05-03 Allan Saddi <allan@saddi.com>
* Fix illusive problem with AJP implementation. Thanks to
Moshe Van der Sterre for explaining the problem and
providing a fix.
-2006-04-06 Allan Saddi <asaddi@kalahari.flup.org>
+2006-04-06 Allan Saddi <allan@saddi.com>
* Catch a strange FieldStorage case. Seen in production.
Not quite sure what causes it.
-2006-03-21 Allan Saddi <asaddi@kalahari.flup.org>
+2006-03-21 Allan Saddi <allan@saddi.com>
* Add maxRequests option to PreforkServer. Patch provided by
Wojtek Sobczuk.
-2006-02-23 Allan Saddi <asaddi@kalahari.flup.org>
+2006-02-23 Allan Saddi <allan@saddi.com>
* Add paste.server_factory-compliant factories and respective
egg entry points. Thanks to Luis Bruno for the code.
@@ -110,25 +116,25 @@
Add debug option to servers, which is True by default.
Currently, only server-level error handling is affected.
-2006-01-15 Allan Saddi <asaddi@ganymede.saddi.net>
+2006-01-15 Allan Saddi <allan@saddi.com>
* Change the behavior of ImportingModuleResolver when dealing
with ImportErrors. Previously, it would act as if the module
did not exist. Now, it propagates the exception to another
level (outer middleware or WSGI). Reported by Scot Doyle.
-2006-01-05 Allan Saddi <asaddi@kalahari.flup.org>
+2006-01-05 Allan Saddi <allan@saddi.com>
* Improve Windows compatibility by conditionally installing
SIGHUP handler. Thanks to Brad Miller for pointing out the
problem and providing a fix.
-2005-12-19 Allan Saddi <asaddi@kalahari.flup.org>
+2005-12-19 Allan Saddi <allan@saddi.com>
* Fix socket leak in eunuchs socketpair() wrapper. Thanks to
Georg Bauer for pointing this out.
-2005-12-16 Allan Saddi <asaddi@kalahari.flup.org>
+2005-12-16 Allan Saddi <allan@saddi.com>
* Switch to setuptools for egg support.
* Add higher-level 404 error page support. Thanks to Scot Doyle
@@ -137,17 +143,17 @@
is now broken. It will have to be massaged to fit the new
calling convention.
-2005-11-28 Allan Saddi <asaddi@kalahari.flup.org>
+2005-11-28 Allan Saddi <allan@saddi.com>
* Fix issue with FCGI_GET_VALUES handling. Thanks to
Timothy Wright for pointing this out.
-2005-11-18 Allan Saddi <asaddi@kalahari.flup.org>
+2005-11-18 Allan Saddi <allan@saddi.com>
* When running under Python < 2.4, attempt to use socketpair()
from eunuchs module.
-2005-09-07 Allan Saddi <asaddi@europa.saddi.net>
+2005-09-07 Allan Saddi <allan@saddi.com>
* Python 2.3 doesn't define socket.SHUT_WR, which affected
the closing of the FastCGI socket with the server. This would
@@ -155,25 +161,25 @@
the problem to my attention and going out of his way to help
me debug it!
-2005-07-03 Allan Saddi <asaddi@europa.saddi.net>
+2005-07-03 Allan Saddi <allan@saddi.com>
* Ensure session identifiers only contain ASCII characters when
using a non-ASCII locale. Thanks to Ksenia Marasanova for the
the fix.
-2005-06-12 Allan Saddi <asaddi@europa.saddi.net>
+2005-06-12 Allan Saddi <allan@saddi.com>
* Cleanly close connection socket to avoid sending a TCP RST to
the web server. (fcgi_base) Fix suggested by Dima Barsky.
-2005-05-31 Allan Saddi <asaddi@ganymede.saddi.net>
+2005-05-31 Allan Saddi <allan@saddi.com>
* Take scriptName from the WSGI_SCRIPT_NAME environment variable
passed from the web server, if present.
* Check if scriptName is None, and if so, don't modify SCRIPT_NAME
& PATH_INFO. For better compatibility with cgi2scgi. (scgi_base)
-2005-05-18 Allan Saddi <asaddi@ganymede.saddi.net>
+2005-05-18 Allan Saddi <allan@saddi.com>
* Change default allowedServers for ajp and scgi to ['127.0.0.1'].
* Accept PATH_INFO from environment for scgi servers, in case
@@ -182,20 +188,18 @@
Allow it to be changed by keyword argument.
* Fix wsgi.multiprocess for scgi_fork. (Set to True.)
-2005-05-15 Allan Saddi <asaddi@ganymede.saddi.net>
+2005-05-15 Allan Saddi <allan@saddi.com>
* Prevent possible deadlock related to DiskSessionStore locking.
* Add logic to SessionStore so that it will block if attempting to
check out a Session that's already been checked out.
-2005-05-14 Allan Saddi <asaddi@ganymede.saddi.net>
+2005-05-14 Allan Saddi <allan@saddi.com>
* Convert the use of decorators in session.py to something
compatible with Python <2.4.
-2005-04-23 Allan Saddi <asaddi@ganymede.saddi.net>
+2005-04-23 Allan Saddi <allan@saddi.com>
* Ensure that SessionStore.checkOutSession() never returns an
invalidated Session. Reported by Rene Dudfield.
-
-
diff --git a/flup/server/scgi.py b/flup/server/scgi.py
index ee9d769..ada352e 100644
--- a/flup/server/scgi.py
+++ b/flup/server/scgi.py
@@ -66,7 +66,7 @@ __version__ = '$Revision$'
import logging
import socket
-from flup.server.scgi_base import BaseSCGIServer, Connection
+from flup.server.scgi_base import BaseSCGIServer, Connection, NoDefault
from flup.server.threadedserver import ThreadedServer
__all__ = ['WSGIServer']
@@ -87,7 +87,7 @@ class WSGIServer(BaseSCGIServer, ThreadedServer):
of preforking to be quite superior. So if your application really doesn't
mind running in multiple processes, go use SWAP. ;)
"""
- def __init__(self, application, scriptName='', environ=None,
+ def __init__(self, application, scriptName=NoDefault, environ=None,
multithreaded=True, multiprocess=False,
bindAddress=('localhost', 4000), umask=None,
allowedServers=None,
diff --git a/flup/server/scgi_base.py b/flup/server/scgi_base.py
index a1d4d86..0bcb652 100644
--- a/flup/server/scgi_base.py
+++ b/flup/server/scgi_base.py
@@ -36,6 +36,7 @@ import cStringIO as StringIO
import signal
import datetime
import os
+import warnings
# Threads are required. If you want a non-threaded (forking) version, look at
# SWAP <http://www.idyll.org/~t/www-tools/wsgi/>.
@@ -273,7 +274,7 @@ class BaseSCGIServer(object):
# What Request class to use.
requestClass = Request
- def __init__(self, application, scriptName='', environ=None,
+ def __init__(self, application, scriptName=NoDefault, environ=None,
multithreaded=True, multiprocess=False,
bindAddress=('localhost', 4000), umask=None,
allowedServers=NoDefault,
@@ -471,29 +472,45 @@ class BaseSCGIServer(object):
def _sanitizeEnv(self, environ):
"""Fill-in/deduce missing values in environ."""
- # Namely SCRIPT_NAME/PATH_INFO
+ # Ensure QUERY_STRING exists
+ if not environ.has_key('QUERY_STRING'):
+ environ['QUERY_STRING'] = ''
+
+ # Check WSGI_SCRIPT_NAME
scriptName = environ.get('WSGI_SCRIPT_NAME')
if scriptName is None:
scriptName = self.scriptName
- elif scriptName.lower() == 'none':
- scriptName = None
+ else:
+ warnings.warn('WSGI_SCRIPT_NAME environment variable for scgi '
+ 'servers is deprecated',
+ DeprecationWarning)
+ if scriptName.lower() == 'none':
+ scriptName = None
if scriptName is None:
# Do nothing (most likely coming from cgi2scgi)
return
- value = environ['SCRIPT_NAME']
- # Pull PATH_INFO from environ, if it exists. (cgi2scgi actually
- # passes it in.)
- value += environ.get('PATH_INFO', '')
- if not value.startswith(scriptName):
- self.logger.warning('scriptName does not match request URI')
-
- environ['PATH_INFO'] = value[len(scriptName):]
- environ['SCRIPT_NAME'] = scriptName
-
- if not environ.has_key('QUERY_STRING'):
- environ['QUERY_STRING'] = ''
+ if scriptName is NoDefault:
+ # Pull SCRIPT_NAME/PATH_INFO from environment, with empty defaults
+ if not environ.has_key('SCRIPT_NAME'):
+ environ['SCRIPT_INFO'] = ''
+ if not environ.has_key('PATH_INFO'):
+ environ['PATH_INFO'] = ''
+ else:
+ # Configured scriptName
+ warnings.warn('Configured SCRIPT_NAME is deprecated\n'
+ 'Do not use WSGI_SCRIPT_NAME or the scriptName\n'
+ 'keyword parameter -- they will be going away',
+ DeprecationWarning)
+
+ value = environ['SCRIPT_NAME']
+ value += environ.get('PATH_INFO', '')
+ if not value.startswith(scriptName):
+ self.logger.warning('scriptName does not match request URI')
+
+ environ['PATH_INFO'] = value[len(scriptName):]
+ environ['SCRIPT_NAME'] = scriptName
def error(self, request):
"""
diff --git a/flup/server/scgi_fork.py b/flup/server/scgi_fork.py
index 46cb1e0..ce04899 100644
--- a/flup/server/scgi_fork.py
+++ b/flup/server/scgi_fork.py
@@ -66,7 +66,7 @@ __version__ = '$Revision$'
import logging
import socket
-from flup.server.scgi_base import BaseSCGIServer, Connection
+from flup.server.scgi_base import BaseSCGIServer, Connection, NoDefault
from flup.server.preforkserver import PreforkServer
__all__ = ['WSGIServer']
@@ -87,7 +87,7 @@ class WSGIServer(BaseSCGIServer, PreforkServer):
of preforking to be quite superior. So if your application really doesn't
mind running in multiple processes, go use SWAP. ;)
"""
- def __init__(self, application, scriptName='', environ=None,
+ def __init__(self, application, scriptName=NoDefault, environ=None,
bindAddress=('localhost', 4000), umask=None,
allowedServers=None,
loggingLevel=logging.INFO, debug=True, **kw):