[Zope3-checkins] CVS: Zope3/src/zope/publisher - http.py:1.42
Stephan Richter
srichter at cosmos.phy.tufts.edu
Thu Mar 18 15:04:26 EST 2004
Update of /cvs-repository/Zope3/src/zope/publisher
In directory cvs.zope.org:/tmp/cvs-serv24927/src/zope/publisher
Modified Files:
http.py
Log Message:
Added support for encoded unicode-containing URLs.
=== Zope3/src/zope/publisher/http.py 1.41 => 1.42 ===
--- Zope3/src/zope/publisher/http.py:1.41 Sat Mar 6 12:48:56 2004
+++ Zope3/src/zope/publisher/http.py Thu Mar 18 15:03:55 2004
@@ -17,7 +17,7 @@
"""
import re, time, random
-from urllib import quote, splitport
+from urllib import quote, unquote, splitport
from types import StringTypes, ClassType
from cgi import escape
@@ -397,6 +397,18 @@
self._cookies = cookies
def __setupPath(self):
+ # The recommendation states that:
+ #
+ # Unless there is some compelling reason for a
+ # particular scheme to do otherwise, translating character sequences
+ # into UTF-8 (RFC 2279) [3] and then subsequently using the %HH
+ # encoding for unsafe octets is recommended.
+ #
+ # See: http://www.ietf.org/rfc/rfc2718.txt, Section 2.2.5
+ path = self.get("PATH_INFO", "/")
+ path = unquote(path)
+ path = path.decode('UTF-8')
+ self._environ["PATH_INFO"] = path
self._setupPath_helper("PATH_INFO")
def supportsRetry(self):
@@ -432,25 +444,6 @@
ob = super(HTTPRequest, self).traverse(ob)
return ob
-
- # This method is not part of the interface.
- def _splitPath(self, path):
- # Split and clean up the path.
- if path.startswith('/'):
- path = path[1:]
-
- if path.endswith('/'):
- path = path[:-1]
-
- clean = []
- for item in path.split('/'):
- if not item or item == '.':
- continue
- elif item == '..':
- del clean[-1]
- else: clean.append(item)
-
- return clean
def getHeader(self, name, default=None, literal=False):
'See IHTTPRequest'
More information about the Zope3-Checkins
mailing list