[Zope-Checkins] CVS: Zope3/lib/python/Zope/Publisher/HTTP - HTTPRequest.py:1.1.2.21.2.7 HTTPResponse.py:1.1.2.13.4.7

Jim Fulton jim@zope.com
Tue, 26 Mar 2002 13:00:24 -0500


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

Modified Files:
      Tag: Zope3-publisher-refactor-branch
	HTTPRequest.py HTTPResponse.py 
Log Message:
Modified the server to use the new request factory API and got all the
unit tests to pass.


=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPRequest.py 1.1.2.21.2.6 => 1.1.2.21.2.7 ===
 
 import re, time, whrandom
-from urllib import quote
+from urllib import quote, splitport
 from types import StringType
 
 from Zope.Publisher.BaseRequest import BaseRequest
@@ -151,6 +151,8 @@
         if environ.has_key('HTTP_AUTHORIZATION'):
             self._auth = environ['HTTP_AUTHORIZATION']
             del environ['HTTP_AUTHORIZATION']
+        else:
+            self._auth = None
 
         self._environ = environ
 
@@ -391,8 +393,8 @@
 
     def unauthorized(self, challenge):
         'See Zope.Publisher.HTTP.IHTTPCredentials.IHTTPCredentials'
-        self.response.setHeader("WWW-Authenticate", challenge, 1)
-        self.response.setStatus(401)
+        self._response.setHeader("WWW-Authenticate", challenge, 1)
+        self._response.setStatus(401)
 
     #
     ############################################################


=== Zope3/lib/python/Zope/Publisher/HTTP/HTTPResponse.py 1.1.2.13.4.6 => 1.1.2.13.4.7 ===
 
     __slots__ = (
-        '_header_output', # XXX what is this
+        '_header_output',       # Hook object to collaborate with a server
+                                # for header generation. 
         '_headers',
         '_cookies',
         '_accumulated_headers', # Headers that can have multiples
@@ -124,6 +125,10 @@
         self._reason = 'Ok'
 
 
+    def setHeaderOutput(self, header_output):
+        self._header_output = header_output
+        
+
     ############################################################
     # Implementation methods for interface
     # Zope.Publisher.HTTP.IHTTPResponse.IHTTPResponse
@@ -359,7 +364,7 @@
             header_output.setResponseStatus(self._status, self._reason)
             header_output.setResponseHeaders(headers)
             header_output.appendResponseHeaders(self._cookie_list())
-            header_output.appendResponseHeaders(self.__accumulated_headers)
+            header_output.appendResponseHeaders(self._accumulated_headers)
         else:
             # Write directly to outstream.
             headers_text = self.getHeaderText(headers)