Re: Cannot call HTTPS URL with httplib

Philip Aston <[email protected]>
Newsgroups gmane.comp.java.grinder.user
Message-ID <[email protected]>
Have you tried it (with the custom security provider)  from standalone
Jython?

- Phil

On 01/10/13 01:02, Annorax wrote:
> In standalone Python, I am able to call an HTTPS POST successfully with the
> following code:
>
> conn = httplib.HTTPSConnection(baseURL)
> conn.request('POST', url1)
> resp = conn.getresponse()
> resp.content = resp.read()
> conn.close()
> print resp.content
>
> However, the same code run through the Grinder gives the following error:
>
> net.grinder.scriptengine.jython.JythonScriptExecutionException: <class
> 'socket.sslerror'>: (-1, 'SSL handshake exception: Differences between the
> SSL socket behaviour of cpython vs. jython are explained on the wiki: 
> http://wiki.python.org/jython/NewSocketModule#SSL_Support')
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/socket.py",
> line 1710, in __init__
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/socket.py",
> line 1761, in ssl
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/httplib.py",
> line 1135, in connect
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/httplib.py",
> line 699, in send
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/httplib.py",
> line 732, in _send_output
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/httplib.py",
> line 860, in endheaders
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/httplib.py",
> line 889, in _send_request
> 	File
> "/app/grinder/grinder-3.11/lib/jython-standalone-2.5.3.jar/Lib/httplib.py",
> line 866, in request
> 	conn.request('POST', url1)
>
> With the error being at line:
>
> conn.request('POST', url1)
>
> When I do a similar HTTPS POST using the Grinder HTTP plugin as follows, it
> works:
>
> request1 = HTTPRequest()
> print url1
> result = request1.POST(url1)
> responseString = result.getText()
> print responseString
>
> >From what I've read (and the URL in the error) it seems that Jython uses
> Java's SSL encryption classes. At the link, I followed the example under "By
> installing your own Security Provider" to disable any SSL verification but I
> still get the same problem.
>
> I need to run using the first piece of code. Does anyone know how to get
> this to work?
>
>


------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134791&iu=/4140/ostg.clktrk
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.