Skip to content
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

URI parsing IPv6 address without scheme fails #5177

Open
simmel opened this issue May 18, 2018 · 1 comment
Open

URI parsing IPv6 address without scheme fails #5177

simmel opened this issue May 18, 2018 · 1 comment

Comments

@simmel
Copy link

simmel commented May 18, 2018

Environment

Provide at least:

  • JRuby version (jruby -v) and command line (flags, JRUBY_OPTS, etc): jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [darwin-x86_64]
  • Operating system and platform (e.g. uname -a): Mac OS X 10.12.6

Expected Behavior

kaka:~$ ruby --version
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
kaka:~$ ruby -rURI -e 'p URI.parse("//[::1]:9202")'
#<URI::Generic:0x007fe777875238 URL://[::1]:9202>

Actual Behavior

kaka:~$ ruby --version
jruby 9.1.17.0 (2.3.3) 2018-04-20 d8b1ff9 Java HotSpot(TM) 64-Bit Server VM 25.151-b12 on 1.8.0_151-b12 +jit [darwin-x86_64]
kaka:~$ ruby -rURI -e 'p URI.parse("//[::1]:9202")'
/Users/simlu/.rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/URI.rb:99: warning: already initialized constant VERSION_CODE
/Users/simlu/.rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/URI.rb:100: warning: already initialized constant VERSION
URI::InvalidURIError: bad URI(is not URI?): //[::1]:9202
   split at /Users/simlu/.rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/uri/rfc3986_parser.rb:67
   parse at /Users/simlu/.rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/uri/rfc3986_parser.rb:73
   parse at /Users/simlu/.rvm/rubies/jruby-9.1.17.0/lib/ruby/stdlib/uri/common.rb:227
  <main> at -e:1

Newer Ruby also have this issue:

$ ruby -v -ruri -e 'URI.parse("//[::1]:9202")'
ruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
Traceback (most recent call last):
        3: from -e:1:in `<main>'
        2: from /usr/lib/ruby/2.5.0/uri/common.rb:237:in `parse'
        1: from /usr/lib/ruby/2.5.0/uri/rfc3986_parser.rb:73:in `parse'
/usr/lib/ruby/2.5.0/uri/rfc3986_parser.rb:67:in `split': bad URI(is not URI?): //[::1]:9202 (URI::InvalidURIError)

Might be related to https://bugs.ruby-lang.org/issues/10402 ?

@simmel
Copy link
Author

simmel commented May 18, 2018

kaka:~$ ruby -v -ruri -e 'URI.parse("//[::1]:9202")'
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin16.0]
kaka:~$ ruby -v -ruri -e 'URI.parse("//[::1]:9202")'
ruby 2.2.7p470 (2017-03-28 revision 58194) [x86_64-darwin16]
/Users/simlu/.rvm/rubies/ruby-2.2.7/lib/ruby/2.2.0/uri/rfc3986_parser.rb:66:in `split': bad URI(is not URI?): //[::1]:9202 (URI::InvalidURIError)
        from /Users/simlu/.rvm/rubies/ruby-2.2.7/lib/ruby/2.2.0/uri/rfc3986_parser.rb:72:in `parse'
        from /Users/simlu/.rvm/rubies/ruby-2.2.7/lib/ruby/2.2.0/uri/common.rb:226:in `parse'
        from -e:1:in `<main>'

It's a regression between 2.1 and 2.2 for sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant