[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - HTTPRequest.py:1.1.2.21.2.6 HTTPResponse.py:1.1.2.13.4.6 cgi_names.py:NONE

Jim Fulton jim@zope.com
Tue, 26 Mar 2002 11:54:39 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/Publisher/HTTP
In directory cvs.zope.org:/tmp/cvs-serv4886/Zope/Publisher/HTTP

Modified Files:
      Tag: Zope3-publisher-refactor-branch
	HTTPRequest.py HTTPResponse.py 
Removed Files:
      Tag: Zope3-publisher-refactor-branch
	cgi_names.py 
Log Message:
Got the BrowserPublisher to pass tests.

The remaining task (aside from writing more tests) is to get the
new server setup working.  This should also get the server tests to pass.


=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.1.2.21.2.5 => 1.1.2.21.2.6 ===
 """
 
-import re, sys, os, time, whrandom, cgi
-from urllib import quote, unquote
+import re, time, whrandom
+from urllib import quote
 from types import StringType
 
 from Zope.Publisher.BaseRequest import BaseRequest
 from Zope.Publisher.Browser.IBrowserPublisher import IBrowserPublisher 
 
 from HTTPResponse import HTTPResponse
-from cgi_names import isCGI_NAME, hide_key
 from IHTTPCredentials import IHTTPCredentials
 from IHTTPRequest import IHTTPRequest
 from IHTTPApplicationRequest import IHTTPApplicationRequest
@@ -76,9 +75,6 @@
 DEFAULT_PORTS = {'http': '80', 'https': '443'}
 STAGGER_RETRIES = 1
 
-URLmatch=re.compile('URL(PATH)?([0-9]+)$').match
-BASEmatch=re.compile('BASE(PATH)?([0-9]+)$').match
-
 class HTTPRequest(BaseRequest):
     """
     Model HTTP request data.
@@ -136,11 +132,11 @@
         '_path_suffix',   # Extra traversal steps after normal traversal   
         '_retry_count',   # How many times the request has been retried    
         '_app_url',       # The application URL                            
-        '_app_path',      # The path part of the application URL           
         '_app_names',     # The application path as a sequence             
         '_app_base',      # The application URL without the last name      
         '_app_server',    # The server path of the application url
         '_orig_env',      # The original environment
+        '_endswithslash'  # Does the given path end with /
         )
 
     retry_max_count = 3    # How many times we're willing to retry
@@ -173,7 +169,6 @@
 
         # _script and the other _names are meant for URL construction
         self._app_names = app_names = filter(None, script.split('/'))
-        self._app_path = map(quote, app_names)
 
         # Remove trailing /'s
         while base and base.endswith('/'):
@@ -269,6 +264,8 @@
         if path.endswith('/'):
             path = path[:-1] # XXX Why? Not sure
             self._endswithslash = 1
+        else:
+            self._endswithslash = 0
         
         if path.startswith('/'):
             path = path[1:] # XXX Why? Not sure
@@ -411,7 +408,7 @@
             if level > len(names):
                 raise IndexError, level 
             names = names[:-level]
-        names = map(quote, names)
+        names = [quote(name, safe='/;') for name in names]
 
         if path_only:
             if not names: return '/'
@@ -429,7 +426,7 @@
         else:
             names = self._app_names
             
-        names = map(quote, names)
+        names =  [quote(name, safe='/;') for name in names]
 
         if path_only:
             return names and ('/' + '/'.join(names)) or '/'


=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPResponse.py 1.1.2.13.4.5 => 1.1.2.13.4.6 ===
     def getHeaderText(self, m):
         lst = ['Status: %s %s' % (self._status, self._reason)]
-        lst.extend(map(lambda x: '%s: %s' % x, m.items()))
+        items = m.items()
+        items.sort()
+        lst.extend(map(lambda x: '%s: %s' % x, items))
         lst.extend(self._cookie_list())
         lst.extend(self._accumulated_headers)
         return ('%s\r\n\r\n' % '\r\n'.join(lst))

=== Removed File Zope3/lib/python/Zope/Publisher/HTTP/cgi_names.py ===