Skip to content

Commit 313bbff

Browse files
committed
load OpenSSL::Config lazily (also) - not much use for it in JOpenSSL
1 parent 0131dc9 commit 313bbff

5 files changed

Lines changed: 13 additions & 3 deletions

File tree

lib/jopenssl/load.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,6 @@
4242
end
4343

4444
module OpenSSL
45+
autoload :Config, 'openssl/config' unless const_defined?(:Config, false)
4546
autoload :PKCS12, 'openssl/pkcs12'
4647
end

lib/jopenssl23/openssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
require 'openssl/bn'
1414
require 'openssl/pkey'
1515
require 'openssl/cipher'
16-
require 'openssl/config'
16+
require 'openssl/config' if OpenSSL.const_defined?(:Config, false)
1717
require 'openssl/digest'
1818
require 'openssl/x509'
1919
require 'openssl/ssl'

lib/openssl/config.rb

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,12 @@
66
load "jopenssl21/openssl/#{File.basename(__FILE__)}"
77
else
88
load "jopenssl19/openssl/#{File.basename(__FILE__)}"
9-
end
9+
end
10+
11+
# @note moved from JOpenSSL native bits.
12+
module OpenSSL
13+
class Config
14+
DEFAULT_CONFIG_FILE = nil
15+
end
16+
class ConfigError < OpenSSLError; end
17+
end

src/main/java/org/jruby/ext/openssl/Config.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
* OpenSSL::Config (native parts)
3636
* @author <a href="mailto:ola.bini@ki.se">Ola Bini</a>
3737
*/
38+
@Deprecated // move to .rb (for now) as its now lazy loaded ...
3839
public class Config {
3940
// TODO: we cannot detect OS's default config file. ignore?
4041
// public static final String DEFAULT_CONFIG_FILE = "./openssl.cnf";

src/main/java/org/jruby/ext/openssl/OpenSSL.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public static void createOpenSSL(final Ruby runtime) {
6666
final String warn = SafePropertyAccessor.getProperty("jruby.openssl.warn");
6767
if ( warn != null ) OpenSSL.warn = Boolean.parseBoolean(warn);
6868

69-
Config.createConfig(runtime, _OpenSSL);
69+
// Config.createConfig(runtime, _OpenSSL);
7070
ExtConfig.create(runtime, _OpenSSL);
7171
PKey.createPKey(runtime, _OpenSSL);
7272
BN.createBN(runtime, _OpenSSL);

0 commit comments

Comments
 (0)