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:
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
Here's the exception output:
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)
Description
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:
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
Here's the exception output:
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)