[PYTHON-CRYPTO] httpslib.HTTPSConnection problem.

Terry Kerr terry at BIZARSOFTWARE.COM.AU
Wed Jul 21 10:58:59 CEST 2004


I have discovered that this problem is related to a work around
implemented in openssl 0.9.6d and the work around can be switched on/off
in openssl-0.9.6e and above.  To do this, I need to be able to
SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS option in the ssl context of the
socket created my HTTPSConnection.

I don't see a way of doing this using the current API?  I think I
essentially need access to the openssl methods SSL_set_options() or
maybe SSL_CTX_set_options(). Does anyone know how I can set this context
option from python?


Terry Kerr wrote:
> Hi,
> I have a python app that posts info to a cc payment gateway.  The code is
> very simple, and works fine with with M2Crypto 0.07 and python 2.1.3.
> from M2Crypto import httpslib, SSL
> ctx = SSL.Context('sslv3')
> h = httpslib.HTTPSConnection("merchant.ematters.com.au", 443,
>         ssl_context=ctx)
> h.request('POST', path, params, headers)
> resp = h.getresponse()
> f = resp.fp
> resp = resp.read()
> f.close()
> h.close()
> Now I have upgraded to M2Crypto 0.13 and python 2.3.3 and the code no longer
> works.  I am running with exactly the same path, params and headers, but the
> response I get now is:
> <HTML>
> <HEAD>
> <BODY TEXT="000000">
> <H1>Error 500</H1>HTTP Web Server: Invalid POST Request Exception</BODY>
> </HTML>
> I placed a debug print in SSL/Connection.py::Connection._write_bio() and
> verified that the data being send is the same for both python/M2Crypto
> versions, so I am not sure what else could be incorrect.
> Does anyone have an suggestions?
> terry

Terry Kerr (terry at bizarsoftware.com.au)
Chief Technical Officer
Bizar Software Pty Ltd (www.bizarsoftware.com.au)
+61 3 9530 9182

More information about the python-crypto mailing list