[CalendarServer-changes] [81] CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.server.patch

source_changes at macosforge.org source_changes at macosforge.org
Wed Aug 30 08:20:39 PDT 2006


Revision: 81
Author:   cdaboo at apple.com
Date:     2006-08-30 08:20:37 -0700 (Wed, 30 Aug 2006)

Log Message:
-----------
Handle escaped URIs (e.g. %20) by unquoting them during the path segment scanning, and then
quoting them when registering the resource->URI mapping. Note this is not ideal: what we really
should do is leave URIs quoted all the time, and then in the static.py files do the unquoting
of the segment path to generate the actual file path - or perhaps not even both with that - i.e.
allow the files to be stored with the quoted characters in place. That may be better because it
avoids issues of unicode normalization etc that can occur with an arbitrary file system if we
ever get to support IRIs.

Modified Paths:
--------------
    CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.server.patch

Modified: CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.server.patch
===================================================================
--- CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.server.patch	2006-08-30 14:41:01 UTC (rev 80)
+++ CalendarServer/branches/users/cdaboo/acl-merge/patches/Twisted/twisted.web2.server.patch	2006-08-30 15:20:37 UTC (rev 81)
@@ -2,12 +2,21 @@
 ===================================================================
 --- twisted/web2/server.py	(revision 17932)
 +++ twisted/web2/server.py	(working copy)
+@@ -11,7 +11,7 @@
+ import cStringIO as StringIO
+ 
+ import cgi, time, urlparse
+-from urllib import unquote
++from urllib import quote, unquote
+ from urlparse import urlsplit
+ 
+ import weakref
 @@ -316,7 +316,7 @@
          if newpath is StopTraversal:
              # We need to rethink how to do this.
              #if newres is res:
 -                self._rememberURLForResource(path, res)
-+                self.rememberURLForResource(path, res)
++                self.rememberURLForResource(quote(path), res)
                  return res
              #else:
              #    raise ValueError("locateChild must not return StopTraversal with a resource other than self.")
@@ -16,7 +25,7 @@
  
          child = self._getChild(None, newres, newpath, updatepaths=updatepaths)
 -        self._rememberURLForResource(url, child)
-+        self.rememberURLForResource(url, child)
++        self.rememberURLForResource(quote(url), child)
  
          return child
  
@@ -29,3 +38,11 @@
          """
          Remember the URL of visited resources.
          """
+@@ -404,6 +404,7 @@
+         segments = path.split("/")
+         assert segments[0] == "", "URL path didn't begin with '/': %s" % (path,)
+         segments = segments[1:]
++        segments = map(unquote, segments)
+ 
+         def notFound(f):
+             f.trap(http.HTTPError)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20060830/3dea7e87/attachment.html


More information about the calendarserver-changes mailing list