Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 1254

Show
Ignore:
Timestamp:
08/20/06 15:25:26
Author:
fumanchu
Message:

Better to delay 404 due to unknown script name.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cprequest.py

    r1248 r1254  
    164164                # Some interfaces (like WSGI) may have already set self.app. 
    165165                # If not, look up the app for this path. 
    166                 self.script_name = r = cherrypy.tree.script_name(self.path) 
    167                 if r is None: 
    168                     raise cherrypy.NotFound() 
    169                 self.app = cherrypy.tree.apps[r] 
     166                self.script_name = sn = cherrypy.tree.script_name(self.path) 
     167                if sn is None: 
     168                    # No app was found to handle this path. Rather than 
     169                    # abort here, we leave self.app == None so NotFound 
     170                    # can be raised later (with proper error handling 
     171                    # and response finalization). See self.respond. 
     172                    self.script_name = "" 
     173                else: 
     174                    self.app = cherrypy.tree.apps[sn] 
    170175            else: 
    171176                self.script_name = self.app.script_name 
     
    213218                if cherrypy.response.timed_out: 
    214219                    raise cherrypy.TimeoutError() 
     220                 
     221                if self.app is None: 
     222                    raise cherrypy.NotFound() 
    215223                 
    216224                self.hooks = HookMap(self.hookpoints) 
     
    702710            # but allow user code to set Content-Length if desired. 
    703711            if (dict.get(headers, 'Content-Length') is None 
    704                 and code not in (304,)): 
     712                    and code not in (304,)): 
    705713                content = self.collapse_body() 
    706714                dict.__setitem__(headers, 'Content-Length', len(content)) 

Hosted by WebFaction

Log in as guest/cpguest to create tickets