SSL exception trying to open non-HTTPS URL with SSL on
------------------------------------------------------
Key: JRUBY-2185
URL: http://jira.codehaus.org/browse/JRUBY-2185
Project: JRuby
Issue Type: Bug
Components: OpenSSL
Affects Versions: JRuby 1.1RC2
Reporter: Charles Oliver Nutter
Priority: Critical
Fix For: JRuby 1.1
This is rather odd, and should be fixed. The following script tries to open a
non-SSL URL with SSL enabled and blows up in a pretty ugly way:
{code}
require 'rubygems'
require 'openssl'
require 'net/https'
uri = URI.parse('http://www.paypal.com')
http = Net::HTTP.new(uri.host, uri.port)
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
http.use_ssl = true
response = http.start do |s|
#p s.get(uri.request_uri).length
end
{code}
Here's the exception output:
{noformat}
javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
at
com.sun.net.ssl.internal.ssl.EngineInputRecord.bytesInCompletePacket(EngineInputRecord.java:152)
at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(SSLEngineImpl.java:748)
at
com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(SSLEngineImpl.java:663)
at javax.net.ssl.SSLEngine.unwrap(SSLEngine.java:566)
at org.jruby.ext.openssl.SSLSocket.readAndUnwrap(SSLSocket.java:339)
at org.jruby.ext.openssl.SSLSocket.doHandshake(SSLSocket.java:248)
at org.jruby.ext.openssl.SSLSocket.connect(SSLSocket.java:174)
at org.jruby.ext.openssl.SSLSocketInvoker$connect_F0.call(Unknown
Source)
at
org.jruby.runtime.callback.FastInvocationCallback.execute(FastInvocationCallback.java:55)
at
org.jruby.internal.runtime.methods.SimpleCallbackMethod.call(SimpleCallbackMethod.java:67)
at
org.jruby.internal.runtime.methods.DynamicMethod.call(DynamicMethod.java:66)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.cacheAndCall(CallSite.java:101)
at
org.jruby.runtime.CallSite$InlineCachingCallSite.call(CallSite.java:236)
at org.jruby.evaluator.ASTInterpreter.callNode(ASTInterpreter.java:657)
at
org.jruby.evaluator.ASTInterpreter.evalInternal(ASTInterpreter.java:308)
{noformat}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email