Python seg faults with M2Crypto

Jeff Johnson usenet at
Fri Nov 16 16:15:39 CET 2001

The following script causes "Segmentation fault (core dumped)" on
FreeBSD 4.3, Python 2.1.1, M2Crypto all from the ports tree.  Can
anyone else reproduce this?


class X:
    def _submit(self, dict, headers=[]):
        Given a dict of form variables, make the HTTPS POST.
        import urllib
        from M2Crypto import httpslib, SSL ## only until python 2
comes out
        data = urllib.urlencode(dict)

        h = httpslib.HTTPS(self._secureServer)
        h.putrequest('POST', "/" + self._securePage)
        h.putheader('Content-length', '%d' % len(data))
        for head in headers:

        errcode, errmsg, headers = h.getreply()
        assert errcode==200, \
               "problem reading from %s: %s, %s" \
               % (self._secureServer, errcode, errmsg)
        fp = h.getfile()

        content = ""
        chunk = "start"
        while len(chunk) != 0:
            chunk =
            content += chunk

        return content

x = X()
x._secureServer = ""
x._securePage = "gateway/transact.dll"

d={"x_Test_Request": "TRUE"}

#for i in  range(20):
print x._submit(d, h)

More information about the Python-list mailing list