urllib2 module in Python2.2, with SSL

Clarence Gardner clarence at netlojix.com
Mon Feb 18 18:25:06 EST 2002


I'm having a problem with the HTTPS (or HTTPSConnection)
classes in urllib2.

If I use the built-in SSL sockets and do writes and reads
myself, everything works fine, but if I try to use to higher-
level functionality (to the same URL), I get

  File "/usr/local/lib/python2.2/httplib.py", line 728, in getreply
    response = self._conn.getresponse()
  File "/usr/local/lib/python2.2/httplib.py", line 572, in getresponse
    response = self.response_class(self.sock)
  File "/usr/local/lib/python2.2/httplib.py", line 98, in __init__
    self.fp = sock.makefile('rb', 0)
  File "/usr/local/lib/python2.2/httplib.py", line 607, in makefile
    buf = self.__ssl.read()
socket.sslerror: (5, 'EOF occurred in violation of protocol')


This seems to point to a possible problem in the makefile method 
of the FakeSocket class (used to make an SSL socket look like a
plain socket).

Has anyone used urllib2 functions with SSL successfully?

-- 
Clarence Gardner
Software Engineer
NetLojix Communications
clarence at netlojix.com



More information about the Python-list mailing list