[Python-bugs-list] [ python-Bugs-531616 ] HTTPS not working

noreply@sourceforge.net noreply@sourceforge.net
Mon, 18 Mar 2002 15:12:47 -0800


Bugs item #531616, was opened at 2002-03-18 17:29
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=531616&group_id=5470

Category: Python Library
Group: Python 2.2.1 candidate
>Status: Closed
>Resolution: Fixed
Priority: 7
Submitted By: A.M. Kuchling (akuchling)
>Assigned to: A.M. Kuchling (akuchling)
Summary: HTTPS not working 

Initial Comment:
Opening https:// URLs doesn't work for me with 2.2.1.  If I drop back to 
rev. 1.43 of httplib.py, it works again, so something happened with 
the big sendall() patch to break HTTPS.  

To see the bug, try running 
urllib.py with the -t switch:


---------- https://synergy.as.cmu.edu/~geek/ ----------

Traceback (most recent call last):
  File "urllib.py", line 1453, in ?
    
main()
  File "urllib.py", line 1444, in main
    test(args)
  File 
"urllib.py", line 1406, in test
    fn, h = urlretrieve(url, None, 
reporthook)
  File "urllib.py", line 80, in urlretrieve
    return 
_urlopener.retrieve(url, filename, reporthook, data)
  File 
"urllib.py", line 210, in retrieve
    fp = self.open(url, data)
  File 
"urllib.py", line 178, in open
    return getattr(self, name)(url)
  File 
"urllib.py", line 373, in open_https
    errcode, errmsg, headers = 
h.getreply()
  File "/data/python2/dist/src/Lib/httplib.py", line 
727, in getreply
    response = self._conn.getresponse()
  File 
"/data/python2/dist/src/Lib/httplib.py", line 572, in getresponse
    
response = self.response_class(self.sock)
  File 
"/data/python2/dist/src/Lib/httplib.py", line 98, in __init__
    
self.fp = sock.makefile('rb', 0)
  File 
"/data/python2/dist/src/Lib/httplib.py", line 607, in makefile
    
buf = self.__ssl.read()
socket.sslerror: (1, 'error:1408F10B:SSL 
routines:SSL3_GET_RECORD:wrong version
number')
ute 
Lib>



----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2002-03-18 18:12

Message:
Logged In: YES 
user_id=11375

The httplib inspection took less time than I thought, and there don't seem to 
be any other methods that are necessary.
(The makefile() method of 
FakeSocket is rather frightening, though, and I wonder if it would work 
correctly in the face of pipelining, but that's not related to this 
bug.)

Marking as closed, ending this dialogue with myself.


----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2002-03-18 17:54

Message:
Logged In: YES 
user_id=11375

Fixed in revision 1.47 of httplib.py.  

The FakeSocket class needed a 
sendall method.  Without it, the sendall() call got the method on the 
underlying socket object, and that messed up SSL.

That fixes this 
particular bug.  httplib may use other methods of sockets that FakeSocket 
doesn't support; I'll try to scan the code and check.  (I'll leave this bug open 
until that's done.)



----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=531616&group_id=5470