[Python-bugs-list] [ python-Bugs-494762 ] urllib2 on python2.2 ssl bug

noreply@sourceforge.net noreply@sourceforge.net
Fri, 28 Dec 2001 14:37:52 -0800


Bugs item #494762, was opened at 2001-12-18 13:34
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=494762&group_id=5470

Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Marcus Felipe Pereira (makim)
Assigned to: Jeremy Hylton (jhylton)
Summary: urllib2 on python2.2 ssl bug

Initial Comment:
urllib2 on python 2.2 can´t get some SSL pages.

It seams that it´s dependent of the server and the 
issuer of the key.

The server showed below (https://wwws.task.com.br) 
uses IIS 5.0 and 128 bits key issued by Thawte.

I´ve tested on python 2.1 and it's OK.

******** Code *************
import os,urllib2
os.environ["http_proxy"]=''
f = urllib2.urlopen("https://wwws.task.com.br/i.htm")
print f.read()


******** Output ************
Traceback (most recent call last):
  File "./httpstest", line 6, in ?
    f = urllib2.urlopen
("https://wwws.task.com.br/i.htm")
  File "/usr/lib/python2.2/urllib2.py", line 138, in 
urlopen
    return _opener.open(url, data)
  File "/usr/lib/python2.2/urllib2.py", line 322, in 
open
    '_open', req)
  File "/usr/lib/python2.2/urllib2.py", line 301, in 
_call_chain
    result = func(*args)
  File "/usr/lib/python2.2/urllib2.py", line 792, in 
https_open
    return self.do_open(httplib.HTTPS, req)
  File "/usr/lib/python2.2/urllib2.py", line 774, in 
do_open
    code, msg, hdrs = h.getreply()
  File "/usr/lib/python2.2/httplib.py", line 728, in 
getreply
    response = self._conn.getresponse()
  File "/usr/lib/python2.2/httplib.py", line 572, in 
getresponse
    response = self.response_class(self.sock)
  File "/usr/lib/python2.2/httplib.py", line 98, in 
__init__
    self.fp = sock.makefile('rb', 0)
  File "/usr/lib/python2.2/httplib.py", line 607, in 
makefile
    buf = self.__ssl.read()
socket.sslerror: (5, 'EOF occurred in violation of 
protocol')

*****************************************


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

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-28 14:37

Message:
Logged In: YES 
user_id=6380

BTW it's not specific to urllib2, regular old urllib has the
same problem on 2.2 but not on 2.1.1.


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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-12-28 14:37

Message:
Logged In: YES 
user_id=6380

Hm, I do get the same outcome: Python 2.1.1 gives a valid
result, while Python 2.2 gives socket.sslerror: (5, 'EOF
occurred in violation of protocol').

There have been a few changes in the SSL support in 2.2. I'm
assigning this to Jeremy Hylton, who made some of those
changes thinking they were for the better. :-)

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

Comment By: Marcus Felipe Pereira (makim)
Date: 2001-12-19 14:40

Message:
Logged In: YES 
user_id=405476

Strange is that the same code works in python 2.1 on the 
same machine.

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

Comment By: Martin v. Löwis (loewis)
Date: 2001-12-19 12:38

Message:
Logged In: YES 
user_id=21627

If OpenSSL says the server violates the protocol, I'm pretty
sure OpenSSL is right. So I fail to see the problem in Python.

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

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