Changeset 826
- Timestamp:
- 11/16/05 12:46:17
- Files:
-
- trunk/cherrypy/_cphttptools.py (modified) (1 diff)
- trunk/cherrypy/lib/httptools.py (modified) (1 diff)
- trunk/cherrypy/test/test_objectmapping.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/cherrypy/_cphttptools.py
r823 r826 219 219 page_handler, object_path, virtual_path = self.mapPathToObject(path) 220 220 221 # Decode any leftover %2F in the virtual_path atoms. 222 virtual_path = [x.replace("%2F", "/") for x in virtual_path] 223 221 224 # Remove "root" from object_path and join it to get objectPath 222 225 self.objectPath = '/' + '/'.join(object_path[1:]) trunk/cherrypy/lib/httptools.py
r819 r826 311 311 # Unquote the path (e.g. "/this%20path" -> "this path"). 312 312 # http://www.w3.org/Protocols/rfc2616/rfc2616-sec5.html#sec5.1.2 313 # Note that cgi.parse_qs will decode the querystring for us. 314 path = urllib.unquote(path) 313 # 314 # But note that "...a URI must be separated into its components 315 # before the escaped characters within those components can be 316 # safely decoded." http://www.ietf.org/rfc/rfc2396.txt, sec 2.4.2 317 # 318 # Note also that cgi.parse_qs will decode the querystring for us. 319 atoms = [urllib.unquote(x) for x in re.split("(?i)%2F", path)] 320 path = "%2F".join(atoms) 315 321 316 322 return method, path, qs, protocol trunk/cherrypy/test/test_objectmapping.py
r795 r826 145 145 self.assertBody("ID is 14") 146 146 147 # Test that %2F in the path doesn't get unquoted too early; 148 # that is, it should not be used to separate path components. 149 # See ticket #393. 150 self.getPage("/page%2Fname") 151 self.assertBody("default:('page/name',)") 152 147 153 def testPositionalParams(self): 148 154 self.getPage("/dir1/dir2/posparam/18/24/hut/hike")

