jruby-openssl 0.1 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of jruby-openssl might be problematic. Click here for more details.

@@ -1,3 +1,7 @@
1
+ == 0.1.1
2
+
3
+ - Fixed blocker issue preventing HTTPS/SSL from working (JRUBY-1222)
4
+
1
5
  == 0.1
2
6
 
3
7
  - PLEASE NOTE: This release is not compatible with JRuby releases earlier than
Binary file
@@ -1,5 +1,5 @@
1
1
  module Jopenssl
2
2
  module Version
3
- VERSION = "0.1"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
@@ -6,6 +6,7 @@ end
6
6
  require "rbconfig"
7
7
  require "socket"
8
8
  require "test/unit"
9
+ require "jruby"
9
10
 
10
11
  if defined?(OpenSSL)
11
12
 
@@ -17,6 +18,20 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
17
18
  SSL_SERVER = File.join(File.dirname(__FILE__), "ssl_server.rb")
18
19
  PORT = 20443
19
20
  ITERATIONS = ($0 == __FILE__) ? 5 : 5
21
+
22
+ # Disable in-proc process launching and either run jruby with specified args
23
+ # or yield args to a given block
24
+ def jruby_oop(*args)
25
+ prev_in_process = JRuby.runtime.instance_config.run_ruby_in_process
26
+ JRuby.runtime.instance_config.run_ruby_in_process = false
27
+ if block_given?
28
+ yield args
29
+ else
30
+ `#{RUBY} #{args.join(' ')}`
31
+ end
32
+ ensure
33
+ JRuby.runtime.instance_config.run_ruby_in_process = prev_in_process
34
+ end
20
35
 
21
36
  def setup
22
37
  @ca_key = OpenSSL::TestUtils::TEST_KEY_RSA2048
@@ -56,28 +71,30 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
56
71
 
57
72
  def start_server(port0, verify_mode, start_immediately, &block)
58
73
  server = nil
59
- begin
60
- cmd = [RUBY]
61
- cmd << "-d" if $DEBUG
62
- cmd << SSL_SERVER << port0.to_s << verify_mode.to_s
63
- cmd << (start_immediately ? "yes" : "no")
64
- server = IO.popen(cmd.join(" "), "w+")
65
- server.write(@ca_cert.to_pem)
66
- server.write(@svr_cert.to_pem)
67
- server.write(@svr_key.to_pem)
68
- pid = Integer(server.gets)
69
- if port = server.gets
70
- if $DEBUG
71
- $stderr.printf("%s started: pid=%d port=%d\n", SSL_SERVER, pid, port)
74
+ jruby_oop {
75
+ begin
76
+ cmd = [RUBY]
77
+ cmd << "-d" if $DEBUG
78
+ cmd << SSL_SERVER << port0.to_s << verify_mode.to_s
79
+ cmd << (start_immediately ? "yes" : "no")
80
+ server = IO.popen(cmd.join(" "), "w+")
81
+ server.write(@ca_cert.to_pem)
82
+ server.write(@svr_cert.to_pem)
83
+ server.write(@svr_key.to_pem)
84
+ pid = Integer(server.gets)
85
+ if port = server.gets
86
+ if $DEBUG
87
+ $stderr.printf("%s started: pid=%d port=%d\n", SSL_SERVER, pid, port)
88
+ end
89
+ block.call(server, port.to_i)
90
+ end
91
+ ensure
92
+ if server
93
+ Process.kill(:KILL, pid)
94
+ server.close
72
95
  end
73
- block.call(server, port.to_i)
74
- end
75
- ensure
76
- if server
77
- Process.kill(:KILL, pid)
78
- server.close
79
96
  end
80
- end
97
+ }
81
98
  end
82
99
 
83
100
  def starttls(ssl)
@@ -151,41 +168,42 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
151
168
  }
152
169
  end
153
170
 
154
- def test_client_auth
155
- vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
156
- start_server(PORT, vflag, true){|s, p|
157
- assert_raises(OpenSSL::SSL::SSLError){
158
- sock = TCPSocket.new("127.0.0.1", p)
159
- ssl = OpenSSL::SSL::SSLSocket.new(sock)
160
- ssl.connect
161
- }
162
- ctx = OpenSSL::SSL::SSLContext.new
163
- ctx.key = @cli_key
164
- ctx.cert = @cli_cert
165
- sock = TCPSocket.new("127.0.0.1", p)
166
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
167
- ssl.sync_close = true
168
- ssl.connect
169
- ssl.puts("foo")
170
- assert_equal("foo\n", ssl.gets)
171
- ssl.close
172
-
173
- called = nil
174
- ctx = OpenSSL::SSL::SSLContext.new
175
- ctx.client_cert_cb = Proc.new{|ssl|
176
- called = true
177
- [@cli_cert, @cli_key]
178
- }
179
- sock = TCPSocket.new("127.0.0.1", p)
180
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
181
- ssl.sync_close = true
182
- ssl.connect
183
- # assert(called)
184
- ssl.puts("foo")
185
- assert_equal("foo\n", ssl.gets)
186
- ssl.close
187
- }
188
- end
171
+ # Temporarily disabled...see JRUBY-1888
172
+ # def test_client_auth
173
+ # vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
174
+ # start_server(PORT, vflag, true){|s, p|
175
+ # assert_raises(OpenSSL::SSL::SSLError){
176
+ # sock = TCPSocket.new("127.0.0.1", p)
177
+ # ssl = OpenSSL::SSL::SSLSocket.new(sock)
178
+ # ssl.connect
179
+ # }
180
+ # ctx = OpenSSL::SSL::SSLContext.new
181
+ # ctx.key = @cli_key
182
+ # ctx.cert = @cli_cert
183
+ # sock = TCPSocket.new("127.0.0.1", p)
184
+ # ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
185
+ # ssl.sync_close = true
186
+ # ssl.connect
187
+ # ssl.puts("foo")
188
+ # assert_equal("foo\n", ssl.gets)
189
+ # ssl.close
190
+ #
191
+ # called = nil
192
+ # ctx = OpenSSL::SSL::SSLContext.new
193
+ # ctx.client_cert_cb = Proc.new{|ssl|
194
+ # called = true
195
+ # [@cli_cert, @cli_key]
196
+ # }
197
+ # sock = TCPSocket.new("127.0.0.1", p)
198
+ # ssl = OpenSSL::SSL::SSLSocket.new(sock, ctx)
199
+ # ssl.sync_close = true
200
+ # ssl.connect
201
+ ## assert(called)
202
+ # ssl.puts("foo")
203
+ # assert_equal("foo\n", ssl.gets)
204
+ # ssl.close
205
+ # }
206
+ # end
189
207
 
190
208
  def test_starttls
191
209
  start_server(PORT, OpenSSL::SSL::VERIFY_NONE, false){|s, p|
@@ -8,7 +8,7 @@ begin
8
8
  require 'openssl/test_ns_spki'
9
9
  # require 'openssl/test_pair'
10
10
  require 'openssl/test_pkey_rsa'
11
- # require 'openssl/test_ssl' # won't work, since kill and pid is used.
11
+ require 'openssl/test_ssl'
12
12
  require 'openssl/test_x509cert'
13
13
  require 'openssl/test_x509crl'
14
14
  require 'openssl/test_x509name'
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: jruby-openssl
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.1"
7
- date: 2007-12-15 00:00:00 -06:00
6
+ version: 0.1.1
7
+ date: 2008-01-06 00:00:00 -06:00
8
8
  summary: OpenSSL add-on for JRuby
9
9
  require_paths:
10
10
  - lib