-
Notifications
You must be signed in to change notification settings - Fork 82
loading pem files from jar file location does not work #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
nothing we can do about it (or I mean we should not hack around this) since it's a JRuby loading issue, right? |
@kares not really it is related to https://github.com/jruby/jruby-openssl/blob/master/src/main/java/org/jruby/ext/openssl/x509store/Lookup.java#L281 t.rb:
just run it with it assumes either jruby-openssl 0.9.5 or 0.9.6.dev installed as a gem and the maven/jruby-complete/target/jruby-complete-9000.dev-SNAPSHOT.jar file be present to illustrate the various situations where and how this "add_file" fails. the results varies between jruby-1.7.15 and jruby-9000k and between 0.9.5 and 0.9.6.dev. BUT all pathes in the file a valid and are used. |
it feels like using RubyString for uri like path is not sufficient, something like RubyURIString could solve it (maybe) which knows how to turn the string into an inputstream. the runtime is needed here since the file can very much - due to a jruby feature - be located inside runtime.getJRubyClassLoader !!! |
@mkristian I see, thanks - obviously there's no tests for this thus I sure did not know it needs to work as the load service ;( ... so we're just need to delegate to some JRuby internals here that are present in 1.6.8 - 9k ... hopefully that will be possible. did any of this this actually work in 0.9.4 (I would assume it did not) ? where are these expectations coming from these days ... isn't it possible to pass in something normalized ? |
well, the problem is that in MRI X509Store#add_file just expect a path to a file which is always be on the filesystem. but with jruby a path to file can any of those cases I put in the file and look at how rubygems find those path to the pem files: and that is not the whole picture: ``$CLASSPATH << 'my.jar'` can have ruby files which will be found by the old LoadService code as well and those are not "exposed" to the $LOAD_PATH. I am digging out those "edge" cases since I tried to simplify the whole loading of things: jruby/jruby#1957 with jruby-9000.dev it is a regression for some case as you expected here: f54b3bc |
I see thanks a lot ... that is what I thought - needed to confirm that this is not really a regression (since 0.9.4) |
this just ensures that the default pem certifactes used by rubygems can be all loaded and added to the X509Store Sponsored by Lookout Inc.
this is just a mix of the old code, the new code and what the ChannelDescriptor of jruby-1.7.x is doing. but works only for jruby-1.7.14 or newer with a fallback to new code. Sponsored by Lookout Inc.
this just ensures that the default pem certifactes used by rubygems can be all loaded and added to the X509Store Sponsored by Lookout Inc.
this is just a mix of the old code, the new code and what the ChannelDescriptor of jruby-1.7.x is doing. but works only for jruby-1.7.14 or newer with a fallback to new code. Sponsored by Lookout Inc.
when installing gem using jruby-complete or the modular jruby artifact does not work anymore - not sure why it works with older jruby-openssl.
the offending line from rubygems is
https://github.com/jruby/jruby/blob/jruby-1_7/lib/ruby/shared/rubygems/request.rb#L34
the problem here is that file locations are either a string like this:
or within the jruby/jruby#1957 where it is something like this
also file location like this do not work
well, the problem is obvious, the first string is not even an uri and as such a valid path (with one directory having a name ending in !)
the other problem is
https://github.com/jruby/jruby-openssl/blob/master/src/main/java/org/jruby/ext/openssl/X509Store.java#L147
where is assumes it is a path argument and not some "uri" kind of argument.
translating the uri-like location to URI or URL is kind of tricky since it needs the runtime to maybe find the right URL - something like:
https://github.com/jruby/jruby/blob/test-load-from-jruby-classloader/core/src/main/java/org/jruby/runtime/load/LibrarySearcher.java#L280
@ratnikov maybe you have an idea how go about this. since I think it is general problem not restricted to jruby-openssl.
easy way to reproduce it with
rmvn initialize
and Mavenfile:which will use the jruby-stdlib-1.7.17-SNAPSHOT.jar build with
mvn -Pmain
The text was updated successfully, but these errors were encountered: