[Python-checkins] python/dist/src/Lib httplib.py,1.74,1.75

jhylton@users.sourceforge.net jhylton@users.sourceforge.net
Mon, 05 May 2003 09:13:59 -0700


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

Modified Files:
	httplib.py 
Log Message:
SF bug 622042: Don't expect response body from HEAD request.

Bug fix candidate.


Index: httplib.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/httplib.py,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** httplib.py	18 Apr 2003 10:39:51 -0000	1.74
--- httplib.py	5 May 2003 16:13:56 -0000	1.75
***************
*** 209,216 ****
      # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details.
  
!     def __init__(self, sock, debuglevel=0, strict=0):
          self.fp = sock.makefile('rb', 0)
          self.debuglevel = debuglevel
          self.strict = strict
  
          self.msg = None
--- 209,217 ----
      # See RFC 2616 sec 19.6 and RFC 1945 sec 6 for details.
  
!     def __init__(self, sock, debuglevel=0, strict=0, method=None):
          self.fp = sock.makefile('rb', 0)
          self.debuglevel = debuglevel
          self.strict = strict
+         self._method = method
  
          self.msg = None
***************
*** 327,331 ****
          if (status == 204 or            # No Content
              status == 304 or            # Not Modified
!             100 <= status < 200):       # 1xx codes
              self.length = 0
  
--- 328,333 ----
          if (status == 204 or            # No Content
              status == 304 or            # Not Modified
!             100 <= status < 200 or      # 1xx codes
!             self._method == 'HEAD'):
              self.length = 0
  
***************
*** 498,501 ****
--- 500,504 ----
          self.__response = None
          self.__state = _CS_IDLE
+         self._method = None
  
          self._set_hostport(host, port)
***************
*** 627,630 ****
--- 630,635 ----
              raise CannotSendRequest()
  
+         # Save the method we use, we need it later in the response phase
+         self._method = method
          if not url:
              url = '/'
***************
*** 764,770 ****
          if self.debuglevel > 0:
              response = self.response_class(self.sock, self.debuglevel,
!                                            strict=self.strict)
          else:
!             response = self.response_class(self.sock, strict=self.strict)
  
          response.begin()
--- 769,777 ----
          if self.debuglevel > 0:
              response = self.response_class(self.sock, self.debuglevel,
!                                            strict=self.strict, 
!                                            method=self._method)
          else:
!             response = self.response_class(self.sock, strict=self.strict,
!                                            method=self._method)
  
          response.begin()