Re: httplib.HTTPSConnection problem

Discussion in 'Python' started by Terry Kerr, Jul 20, 2004.

  1. Terry Kerr

    Terry Kerr Guest

    I have since discovered that the problem must be with openssl 0.9.7d
    because I tried recompiling Python 2.3.3 with openssl 0.9.6a and the
    https POST worked fine.

    Has anybody else had the same problem? I guess I will start going
    though the openssl forums for a solution.

    terry

    Terry Kerr wrote:
    > Hi,
    >
    > I have an app that makes a https POST to a remote server that I have no
    > control over. The app runs fine in python 2.1.3 with socket.ssl
    > compiled with openssl-0.9.6, however it will not run in python 2.3.3
    > compiled with openssl-0.9.7d. The script below demonstrates the problem.
    >
    > ============================================
    > import httplib
    > path = "/cmaonline.nsf/ePayForm?OpenForm"
    > body =
    > '''Desc=&Bank=National&email=&creditcardholdername=fgfgg&creditcardtype=VISA&creditcardnumber=4557013000314262&ReturnHTTP=%2A&SendeMail=No&UID=0407151706104&MultiBank=No&FinalPrice=35.00&MerchantID=36&CompanyName=Bizar+Software&Mode=Test&Platform=PlainText&__Click=0&ABN=ABN+xx+xxx+xxx+xxx&Returnemail=&creditcardexpiryyear=2004&CVV=&Name=fgfgg&readers=MEL0036&creditcardexpirymonth=7&Principal='''
    >
    >
    > h = httplib.HTTPSConnection("merchant.ematters.com.au", 443)
    > h.debuglevel=1
    > h.request('POST', path, body)
    > resp = h.getresponse()
    > f = resp.fp
    > resp = resp.read()
    > f.close()
    > h.close()
    > print resp
    > ============================================
    >
    > With python 2.1, the server accepts the request correctly and has a
    > proper response:
    >
    > &payment_number==end
    > <br>&payment_reference=0407151706104=end
    > <br>&bank_reference==end
    > <br>&summary_code=707=end
    > <br>&response_code=707=end
    > <br>&response_text=GATEWAY BLOCKED=end
    > <br>&rcode=707=end
    >
    > However, with python 2.3 I get:
    >
    > <HTML>
    > <HEAD>
    > <TITLE>Error</TITLE></HEAD>
    > <BODY TEXT="000000">
    > <H1>Error 500</H1>HTTP Web Server: Invalid POST Request Exception</BODY>
    > </HTML>
    >
    > The debuglevel printouts show that python2.1 sends the request and
    > headers one at a time, where as python 2.3 sends the request and all the
    > headers at once, although the actual data send is identical, so I don't
    > see this as the problem. I actually hacked httplib in my python 2.3
    > installion to get _output() to send immediately rather than buffer, so
    > that the debug output is identical to the python2.1 output, and that
    > gives me a different error:
    >
    > <HTML><HEAD><TITLE>Error</TITLE></HEAD><BODY><H1>Error 400</H1>Invalid
    > request -- HOST header was not sent</BODY></HTML>
    >
    > So I am suspicious that the debug output is not showing what is actually
    > sent? I am really tearing my hair out with this problem because I really
    > need this app to work with pyton 2.3.3, and I cannot see what else it is
    > doing differently to cause this problem.
    >
    > Are there any httplib/socket/ssl gurus out there that have any suggestions?
    >
    > terry
    >
    >


    --
    Terry Kerr ()
    Chief Technical Officer
    Bizar Software Pty Ltd (www.bizarsoftware.com.au)
    +61 3 9530 9182
     
    Terry Kerr, Jul 20, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Glista

    HTTPSConnection Problems

    John Glista, Feb 5, 2004, in forum: Python
    Replies:
    2
    Views:
    1,313
    John J. Lee
    Feb 7, 2004
  2. Terry Kerr

    httplib.HTTPSConnection problem

    Terry Kerr, Jul 16, 2004, in forum: Python
    Replies:
    0
    Views:
    804
    Terry Kerr
    Jul 16, 2004
  3. =?iso-8859-1?Q?Marc_Poulhi=E8s?=

    Using HTTPSConnection and verifying server's CRT

    =?iso-8859-1?Q?Marc_Poulhi=E8s?=, Jan 31, 2005, in forum: Python
    Replies:
    4
    Views:
    758
    Ng Pheng Siong
    Feb 1, 2005
  4. Replies:
    0
    Views:
    404
  5. Chris Down
    Replies:
    0
    Views:
    163
    Chris Down
    Aug 26, 2013
Loading...

Share This Page