History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: JRUBY-2185
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Ola Bini
Reporter: Charles Oliver Nutter
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
JRuby

SSL exception trying to open non-HTTPS URL with SSL on

Created: 27/Feb/08 10:26 AM   Updated: 14/Aug/08 04:51 AM
Component/s: OpenSSL
Affects Version/s: JRuby 1.1RC2
Fix Version/s: JRuby 1.1+

Time Tracking:
Not Specified


 Description  « Hide
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)


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Thomas E Enebo - 17/Mar/08 06:34 PM
Not enough time. Bumping.

Ola Bini - 13/Aug/08 08:25 AM
This test now results in the same exception as MRI exhibits. Consider that closed.