|
[Webware-checkins] r8049 - Webware/branches/Branch-1_0/WebKit
From: <updates@we...> - 2009-08-02 15:19
|
Author: chrisz
Date: Sun Aug 2 09:19:15 2009
New Revision: 8049
Modified:
Webware/branches/Branch-1_0/WebKit/URLParser.py
Log:
For bad URLs, let URLParser raise HTTPNotFound instead of raising an AssertionError.
Modified: Webware/branches/Branch-1_0/WebKit/URLParser.py
==============================================================================
--- Webware/branches/Branch-1_0/WebKit/URLParser.py (original)
+++ Webware/branches/Branch-1_0/WebKit/URLParser.py Sun Aug 2 09:19:15 2009
@@ -384,11 +384,12 @@
if result is not None:
return result
- assert not requestPath or requestPath.startswith('/'), \
- "Not what I expected: %s" % repr(requestPath)
if not requestPath or requestPath == '/':
return self.parseIndex(trans, requestPath)
+ if not requestPath.startswith('/'):
+ raise HTTPNotFound("Invalid path info: %s" % requestPath)
+
parts = requestPath[1:].split('/', 1)
nextPart = parts[0]
restPart = len(parts) > 1 and '/' + parts[1] or ''
@@ -415,8 +416,8 @@
req._extraURLPath = restPart
- if not self._extraPathInfo and req._extraURLPath:
- raise HTTPNotFound("Invalid extra path info: %s")
+ if not self._extraPathInfo and restPart:
+ raise HTTPNotFound("Invalid extra path info: %s" % restPart)
req._serverSidePath = name
|
| Thread | Author | Date |
|---|---|---|
| [Webware-checkins] r8049 - Webware/branches/Branch-1_0/WebKit | <updates@we...> |