Changeset 57:79ae9ca6d617

Show
Ignore:
Timestamp:
12/29/06 10:13:03 (2 years ago)
Author:
Allan Saddi <allan@saddi.com>
branch:
default
convert_revision:
svn:46762da8-4eb7-0310-94e9-d918b60927c8/flup/trunk@2304
Message:

Deprecate WSGI_SCRIPT_NAME and scriptName in scgi_base.
Modern versions of mod_scgi correctly set SCRIPT_NAME &
PATH_INFO.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • ChangeLog

    r56 r57  
    1 2006-12-13  Allan Saddi  <asaddi@sahara.flup.org> 
     12006-12-29  Allan Saddi  <allan@saddi.com> 
     2 
     3        * Deprecate WSGI_SCRIPT_NAME and scriptName in scgi_base. 
     4          Modern versions of mod_scgi correctly set SCRIPT_NAME & 
     5          PATH_INFO. 
     6 
     72006-12-13  Allan Saddi  <allan@saddi.com> 
    28 
    39        * Fix problem in session.py seen when optimization is on. 
    410 
    5 2006-12-05  Allan Saddi  <asaddi@sahara.flup.org
     112006-12-05  Allan Saddi  <allan@saddi.com
    612 
    713        * Update servers to default to an empty QUERY_STRING if 
     
    1521          mime_types. 
    1622 
    17 2006-12-02  Allan Saddi  <asaddi@europa.saddi.net
     232006-12-02  Allan Saddi  <allan@saddi.com
    1824 
    1925        * Change intra-package imports into absolute imports. 
    2026 
    21 2006-12-02  Allan Saddi  <asaddi@sahara.flup.org
     272006-12-02  Allan Saddi  <allan@saddi.com
    2228 
    2329        * Add forceCookieOutput attribute to SessionService to 
    2430          force Set-Cookie output for the current request. 
    2531 
    26 2006-12-01  Allan Saddi  <asaddi@europa.saddi.net
     322006-12-01  Allan Saddi  <allan@saddi.com
    2733 
    2834        * Update setup script. 
    2935 
    30 2006-11-26  Allan Saddi  <asaddi@europa.saddi.net
     362006-11-26  Allan Saddi  <allan@saddi.com
    3137 
    3238        * Don't attempt to install signal handlers under Windows 
    3339          to improve compatibility. 
    3440 
    35 2006-11-24  Allan Saddi  <asaddi@europa.saddi.net
     412006-11-24  Allan Saddi  <allan@saddi.com
    3642 
    3743        * Add *_thread egg entry-point aliases. 
     
    4450          and SCGI.) 
    4551 
    46 2006-11-19  Allan Saddi  <asaddi@europa.saddi.net
     522006-11-19  Allan Saddi  <allan@saddi.com
    4753 
    4854        * Change mime-type matching algorithm in GzipMiddleware. 
     
    5056          regexps. By default, compress 'text/.*' mime-types. 
    5157 
    52 2006-11-10  Allan Saddi  <asaddi@europa.saddi.net
     582006-11-10  Allan Saddi  <allan@saddi.com
    5359 
    5460        * Add cookieAttributes to SessionService to make it easier 
    5561          to customize the generated cookie's attributes. 
    5662 
    57 2006-08-28  Allan Saddi  <asaddi@sahara.flup.org
     632006-08-28  Allan Saddi  <allan@saddi.com
    5864 
    5965        * Add support for FastCGI roles other than FCGI_RESPONDER. 
    6066          Patch provided by Seairth Jacobs. 
    6167 
    62 2006-08-02  Allan Saddi  <asaddi@kalahari.flup.org
     682006-08-02  Allan Saddi  <allan@saddi.com
    6369 
    6470        * Add cookieExpiration keyword to SessionService / 
     
    6672          Thanks to Blaise Laflamme for the suggestion. 
    6773 
    68 2006-06-27  Allan Saddi  <asaddi@kalahari.flup.org
     742006-06-27  Allan Saddi  <allan@saddi.com
    6975 
    7076        * Set close-on-exec flag on all server sockets. Thanks to 
    7177          Ralf Schmitt for reporting the problem. 
    7278 
    73 2006-06-18  Allan Saddi  <asaddi@europa.saddi.net
     792006-06-18  Allan Saddi  <allan@saddi.com
    7480 
    7581        * Stop ignoring EPIPE exceptions, as this is probably the 
     
    8288          seeing socket.error exceptions... 
    8389 
    84 2006-05-18  Allan Saddi  <asaddi@kalahari.flup.org
     902006-05-18  Allan Saddi  <allan@saddi.com
    8591 
    8692        * Added umask keyword parameter to fcgi and fcgi_fork, 
    8793          for use when binding to a UNIX socket. 
    8894 
    89 2006-05-03  Allan Saddi  <asaddi@kalahari.flup.org
     952006-05-03  Allan Saddi  <allan@saddi.com
    9096 
    9197        * Fix illusive problem with AJP implementation. Thanks to 
     
    9399          providing a fix. 
    94100 
    95 2006-04-06  Allan Saddi  <asaddi@kalahari.flup.org
     1012006-04-06  Allan Saddi  <allan@saddi.com
    96102 
    97103        * Catch a strange FieldStorage case. Seen in production. 
    98104          Not quite sure what causes it. 
    99105 
    100 2006-03-21  Allan Saddi  <asaddi@kalahari.flup.org
     1062006-03-21  Allan Saddi  <allan@saddi.com
    101107 
    102108        * Add maxRequests option to PreforkServer. Patch provided by 
    103109          Wojtek Sobczuk. 
    104110 
    105 2006-02-23  Allan Saddi  <asaddi@kalahari.flup.org
     1112006-02-23  Allan Saddi  <allan@saddi.com
    106112 
    107113        * Add paste.server_factory-compliant factories and respective 
     
    111117          Currently, only server-level error handling is affected. 
    112118         
    113 2006-01-15  Allan Saddi  <asaddi@ganymede.saddi.net
     1192006-01-15  Allan Saddi  <allan@saddi.com
    114120 
    115121        * Change the behavior of ImportingModuleResolver when dealing 
     
    118124          level (outer middleware or WSGI). Reported by Scot Doyle. 
    119125 
    120 2006-01-05  Allan Saddi  <asaddi@kalahari.flup.org
     1262006-01-05  Allan Saddi  <allan@saddi.com
    121127 
    122128        * Improve Windows compatibility by conditionally installing 
     
    124130          problem and providing a fix. 
    125131 
    126 2005-12-19  Allan Saddi  <asaddi@kalahari.flup.org
     1322005-12-19  Allan Saddi  <allan@saddi.com
    127133 
    128134        * Fix socket leak in eunuchs socketpair() wrapper. Thanks to 
    129135          Georg Bauer for pointing this out. 
    130136 
    131 2005-12-16  Allan Saddi  <asaddi@kalahari.flup.org
     1372005-12-16  Allan Saddi  <allan@saddi.com
    132138 
    133139        * Switch to setuptools for egg support. 
     
    138144          calling convention. 
    139145 
    140 2005-11-28  Allan Saddi  <asaddi@kalahari.flup.org
     1462005-11-28  Allan Saddi  <allan@saddi.com
    141147 
    142148        * Fix issue with FCGI_GET_VALUES handling. Thanks to 
    143149          Timothy Wright for pointing this out. 
    144150 
    145 2005-11-18  Allan Saddi  <asaddi@kalahari.flup.org
     1512005-11-18  Allan Saddi  <allan@saddi.com
    146152 
    147153        * When running under Python < 2.4, attempt to use socketpair() 
    148154          from eunuchs module. 
    149155 
    150 2005-09-07  Allan Saddi  <asaddi@europa.saddi.net
     1562005-09-07  Allan Saddi  <allan@saddi.com
    151157 
    152158        * Python 2.3 doesn't define socket.SHUT_WR, which affected 
     
    156162          me debug it! 
    157163 
    158 2005-07-03  Allan Saddi  <asaddi@europa.saddi.net
     1642005-07-03  Allan Saddi  <allan@saddi.com
    159165 
    160166        * Ensure session identifiers only contain ASCII characters when 
     
    162168          the fix. 
    163169 
    164 2005-06-12  Allan Saddi  <asaddi@europa.saddi.net
     1702005-06-12  Allan Saddi  <allan@saddi.com
    165171 
    166172        * Cleanly close connection socket to avoid sending a TCP RST to 
    167173          the web server. (fcgi_base) Fix suggested by Dima Barsky. 
    168174 
    169 2005-05-31  Allan Saddi  <asaddi@ganymede.saddi.net
     1752005-05-31  Allan Saddi  <allan@saddi.com
    170176 
    171177        * Take scriptName from the WSGI_SCRIPT_NAME environment variable 
     
    174180          & PATH_INFO. For better compatibility with cgi2scgi. (scgi_base) 
    175181 
    176 2005-05-18  Allan Saddi  <asaddi@ganymede.saddi.net
     1822005-05-18  Allan Saddi  <allan@saddi.com
    177183 
    178184        * Change default allowedServers for ajp and scgi to ['127.0.0.1']. 
     
    183189        * Fix wsgi.multiprocess for scgi_fork. (Set to True.) 
    184190 
    185 2005-05-15  Allan Saddi  <asaddi@ganymede.saddi.net
     1912005-05-15  Allan Saddi  <allan@saddi.com
    186192 
    187193        * Prevent possible deadlock related to DiskSessionStore locking. 
     
    189195          check out a Session that's already been checked out. 
    190196 
    191 2005-05-14  Allan Saddi  <asaddi@ganymede.saddi.net
     1972005-05-14  Allan Saddi  <allan@saddi.com
    192198 
    193199        * Convert the use of decorators in session.py to something 
    194200          compatible with Python <2.4. 
    195201 
    196 2005-04-23  Allan Saddi  <asaddi@ganymede.saddi.net
     2022005-04-23  Allan Saddi  <allan@saddi.com
    197203 
    198204        * Ensure that SessionStore.checkOutSession() never returns an 
    199205          invalidated Session. Reported by Rene Dudfield. 
    200  
    201  
  • flup/server/scgi.py

    r54 r57  
    6767import socket 
    6868 
    69 from flup.server.scgi_base import BaseSCGIServer, Connection 
     69from flup.server.scgi_base import BaseSCGIServer, Connection, NoDefault 
    7070from flup.server.threadedserver import ThreadedServer 
    7171 
     
    8888    mind running in multiple processes, go use SWAP. ;) 
    8989    """ 
    90     def __init__(self, application, scriptName='', environ=None, 
     90    def __init__(self, application, scriptName=NoDefault, environ=None, 
    9191                 multithreaded=True, multiprocess=False, 
    9292                 bindAddress=('localhost', 4000), umask=None, 
  • flup/server/scgi_base.py

    r54 r57  
    3737import datetime 
    3838import os 
     39import warnings 
    3940 
    4041# Threads are required. If you want a non-threaded (forking) version, look at 
     
    274275    requestClass = Request 
    275276 
    276     def __init__(self, application, scriptName='', environ=None, 
     277    def __init__(self, application, scriptName=NoDefault, environ=None, 
    277278                 multithreaded=True, multiprocess=False, 
    278279                 bindAddress=('localhost', 4000), umask=None, 
     
    472473    def _sanitizeEnv(self, environ): 
    473474        """Fill-in/deduce missing values in environ.""" 
    474         # Namely SCRIPT_NAME/PATH_INFO 
     475        # Ensure QUERY_STRING exists 
     476        if not environ.has_key('QUERY_STRING'): 
     477            environ['QUERY_STRING'] = '' 
     478 
     479        # Check WSGI_SCRIPT_NAME 
    475480        scriptName = environ.get('WSGI_SCRIPT_NAME') 
    476481        if scriptName is None: 
    477482            scriptName = self.scriptName 
    478         elif scriptName.lower() == 'none': 
    479             scriptName = None 
     483        else: 
     484            warnings.warn('WSGI_SCRIPT_NAME environment variable for scgi ' 
     485                          'servers is deprecated', 
     486                          DeprecationWarning) 
     487            if scriptName.lower() == 'none': 
     488                scriptName = None 
    480489 
    481490        if scriptName is None: 
     
    483492            return 
    484493 
    485         value = environ['SCRIPT_NAME'] 
    486         # Pull PATH_INFO from environ, if it exists. (cgi2scgi actually 
    487         # passes it in.) 
    488         value += environ.get('PATH_INFO', '') 
    489         if not value.startswith(scriptName): 
    490             self.logger.warning('scriptName does not match request URI') 
    491  
    492         environ['PATH_INFO'] = value[len(scriptName):] 
    493         environ['SCRIPT_NAME'] = scriptName 
    494  
    495         if not environ.has_key('QUERY_STRING'): 
    496             environ['QUERY_STRING'] = '' 
     494        if scriptName is NoDefault: 
     495            # Pull SCRIPT_NAME/PATH_INFO from environment, with empty defaults 
     496            if not environ.has_key('SCRIPT_NAME'): 
     497                environ['SCRIPT_INFO'] = '' 
     498            if not environ.has_key('PATH_INFO'): 
     499                environ['PATH_INFO'] = '' 
     500        else: 
     501            # Configured scriptName 
     502            warnings.warn('Configured SCRIPT_NAME is deprecated\n' 
     503                          'Do not use WSGI_SCRIPT_NAME or the scriptName\n' 
     504                          'keyword parameter -- they will be going away', 
     505                          DeprecationWarning) 
     506 
     507            value = environ['SCRIPT_NAME'] 
     508            value += environ.get('PATH_INFO', '') 
     509            if not value.startswith(scriptName): 
     510                self.logger.warning('scriptName does not match request URI') 
     511 
     512            environ['PATH_INFO'] = value[len(scriptName):] 
     513            environ['SCRIPT_NAME'] = scriptName 
    497514 
    498515    def error(self, request): 
  • flup/server/scgi_fork.py

    r54 r57  
    6767import socket 
    6868 
    69 from flup.server.scgi_base import BaseSCGIServer, Connection 
     69from flup.server.scgi_base import BaseSCGIServer, Connection, NoDefault 
    7070from flup.server.preforkserver import PreforkServer 
    7171 
     
    8888    mind running in multiple processes, go use SWAP. ;) 
    8989    """ 
    90     def __init__(self, application, scriptName='', environ=None, 
     90    def __init__(self, application, scriptName=NoDefault, environ=None, 
    9191                 bindAddress=('localhost', 4000), umask=None, 
    9292                 allowedServers=None,