[Python-checkins] CVS: python/dist/src/Lib httplib.py,1.28,1.29

Guido van Rossum python-dev@python.org
Sun, 14 Jan 2001 13:03:03 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv11923

Modified Files:
	httplib.py 
Log Message:
SF Patch #103232 by dougfort: Preserve Nonstandard Port Number in Host
Header

Dougfort's comments: httplib does not include ':port ' in the HTTP 1.1
'Host:' header.  This causes problems if the server is not listening
on Port 80.  The test case I use is the login to /manage under Zope,
with Zope listening on port 8080. Zope returns a <frameset> with the
<frame> source URLs lacking the :8080.


Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -r1.28 -r1.29
*** httplib.py	2001/01/13 19:16:21	1.28
--- httplib.py	2001/01/14 21:03:01	1.29
***************
*** 442,446 ****
              # themselves. we should NOT issue it twice; some web servers (such
              # as Apache) barf when they see two Host: headers
!             self.putheader('Host', self.host)
  
              # note: we are assuming that clients will not attempt to set these
--- 442,451 ----
              # themselves. we should NOT issue it twice; some web servers (such
              # as Apache) barf when they see two Host: headers
! 
!             # if we need a non-standard port,include it in the header
!             if self.port == HTTP_PORT:
!                 self.putheader('Host', self.host)
!             else:
!                 self.putheader('Host', "%s:%s" % (self.host, self.port))
  
              # note: we are assuming that clients will not attempt to set these