[Zope-CVS] CVS: Packages/FunctionalTests/FunctionalTests -
Request.py:1.7.2.1
Karl Anderson
cvs-admin at zope.org
Mon Nov 3 19:15:43 EST 2003
Update of /cvs-repository/Packages/FunctionalTests/FunctionalTests
In directory cvs.zope.org:/tmp/cvs-serv27630
Modified Files:
Tag: kra-misc-branch
Request.py
Log Message:
HTTPRequest._initURLParts():
Set port to None unless explicitly given, rather than 80.
HTTPRequest.__call__():
Moved default port 80 for connection here from _initURLParts().
Only set port in the Host: header when given by the request object.
In practice, this makes a difference, which we can now test. See comment.
=== Packages/FunctionalTests/FunctionalTests/Request.py 1.7 => 1.7.2.1 ===
--- Packages/FunctionalTests/FunctionalTests/Request.py:1.7 Sun Jun 15 06:01:25 2003
+++ Packages/FunctionalTests/FunctionalTests/Request.py Mon Nov 3 19:15:42 2003
@@ -198,7 +198,7 @@
self._host, self._port = hp[0], int( hp[1] )
else:
self._host = self._netloc
- self._port = 80 # XXX s.b. default for scheme?
+ self._port = None
self._path, self._params, self._query, self._fragment = parts[2:]
#
@@ -428,11 +428,22 @@
invocation.beginRequest()
host, port = self.getHost(), self.getPort()
+ if port:
+ conport = port
+ else:
+ conport = 80 # XXX s.b. default for scheme
try:
- connection = httplib.HTTP( host, port )
+ connection = httplib.HTTP( host, conport )
connection.putrequest( self.getMethod(), self.getURI() )
- connection.putheader( 'Host', '%s:%d' % ( host, port ) )
-
+ if port:
+ connection.putheader( 'Host', '%s:%d' % ( host, port ) )
+ else:
+ # Port could be set to 80, or the default for the scheme,
+ # RFC2616 says that giving no port is equivalent to giving the
+ # default. However, in practice (Apache multihosting), a port
+ # 80 URI is sometimes redirected to the portless URI, so we
+ # give what the config file asked.
+ connection.putheader( 'Host', '%s' % host )
token = self.getAuthenticationToken()
if token:
scrambled = base64.encodestring( token )
More information about the Zope-CVS
mailing list