httplib drops ssl connection to MS IIS Server

Marco Caamano mvcc_cr at yahoo.com
Sat Apr 13 19:37:12 EDT 2002


Hi, I am new to Python and new to the list.

I've been experiencing some problems with ssl connections using httplib.
I have the following function:
----------------
def testurl2():
        print '\n\nUsing HTTPS request'
        body='\202test'
        host=("209.154.200.218:443")
        hs=httplib.HTTPS()
        hs.set_debuglevel(4)
        hs.connect(host)
        hs.putrequest('POST','/scripts/gateway.dll?Transact')
        hs.putheader('Content-Type','x-Visa-II/x-auth')
        hs.putheader('Content-Length', str(len(body)))
        hs.endheaders()
        hs.send(body)
        status, reason, header= hs.getreply()
        data=hs.getfile().read()
        print data
        print status
        return
----------------

When executed it connects to the server and then drops on the following 
error:

----------------
Using HTTPS request
send: 'POST /scripts/gateway.dll?Transact HTTP/1.0\r\n'
send: 'Content-Type: x-Visa-II/x-auth\r\n'
send: 'Content-Length: 5\r\n'
send: '\r\n'
send: '\x82test'
Traceback (most recent call last):
  File "test.py", line 4, in ?
    misc_func.testurl2()
  File "misc_func.py", line 180, in testurl2
    status, reason, header= hs.getreply()
  File "/usr/lib/python2.2/httplib.py", line 728, in getreply
    response = self._conn.getresponse()
  File "/usr/lib/python2.2/httplib.py", line 570, in getresponse
    response = self.response_class(self.sock, self.debuglevel)
  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')
----------------

I like to note that this happens when I try to connect to this specific
server, it is a MS IIS Server. When I use the same funtion on my local
Apache server it works fine. Since I don't have access to the IIS Server
changing it is not an option.

I've searched the web for similar situations but have found no
references so far. 

I'll really apreciate a pointer here, what I am doing wrong? what should
I try next?

thanks!


Marco Caamaño C.





_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com






More information about the Python-list mailing list