Forum: Ruby-core change in URI.split from 1.9.2 to 1.9.3

Posted by Matthew Hall (Guest)
on 2012-10-09 22:25
(Received via mailing list)
Hello,

I noticed a change in behavior between 1.9.2p180 and ruby 1.9.3p269 in 
the
URI.split function. The URI 'tel://12345' gets split into scheme and 
registry
in 1.9.2, and into scheme and host on 1.9.3, which seems more correct.

I'm suspecting this changed because someone integrated a bug fix. So I 
was
trying to figure out when the fix was introduced so I could make my code
compatible with both versions of the behavior.

However I did not find it when I searched the mailing list, and I did 
not find
anything on -core or -talk, so I was hoping somebody who knew more about 
this
topic could help me understand this better.

Regards,
Matthew.

Test Case:

#!...

require 'uri'

puts "RUBY_DESCRIPTION #{RUBY_DESCRIPTION}"

URI_PARTS = [
    "scheme",
    "userinfo",
    "host",
    "port",
    "registry",
    "path",
    "opaque",
    "query",
    "fragment",
]

parts = URI.split('tel://12345')

URI_PARTS.each_with_index do |part, i|
    puts "part [#{part}] value [#{parts[i]}]"
end

exit 0

Output on 1.9.2:

RUBY_DESCRIPTION ruby 1.9.2p180 (2011-02-18 revision 30909) 
[x86_64-darwin11.2.0]
part [scheme] value [tel]
part [userinfo] value []
part [host] value []
part [port] value []
part [registry] value [12345]
part [path] value []
part [opaque] value []
part [query] value []
part [fragment] value []

Output on 1.9.3:

RUBY_DESCRIPTION ruby 1.9.3p269 (2012-09-09 revision 36939) 
[x86_64-linux]
part [scheme] value [tel]
part [userinfo] value []
part [host] value [12345]
part [port] value []
part [registry] value []
part [path] value []
part [opaque] value []
part [query] value []
part [fragment] value []
Posted by Matthew Hall (Guest)
on 2012-10-09 22:35
(Received via mailing list)
Hi,

I just noticed this also:

URI.split('tel://+12345')

returns +12345 in the Registry entry, not the Host entry, on 1.9.3:

irb(main):002:0> URI.split('tel://+12345')
=> ["tel", nil, nil, nil, "+12345", "", nil, nil, nil]

To me, this doesn't seem quite right.

Regards,
Matthew.
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.