From: naruse@... Date: 2017-04-17T07:43:33+00:00 Subject: [ruby-core:80731] [Ruby trunk Bug#13406][Rejected] URI.parse Issue #13406 has been updated by naruse (Yui NARUSE). Status changed from Open to Rejected Unfortunately RFC3986 allows "'" in host. ``` authority = [ userinfo "@" ] host [ ":" port ] host = IP-literal / IPv4address / reg-name reg-name = *( unreserved / pct-encoded / sub-delims ) sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "=" ``` ---------------------------------------- Bug #13406: URI.parse https://bugs.ruby-lang.org/issues/13406#change-64285 * Author: shahkrunalm (Krunal Shah) * Status: Rejected * Priority: Normal * Assignee: * Target version: * ruby -v: 2.4.1 * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- Previously we were using ``` ruby '2.1.9' rails '4.1.1' uri = URI.parse("http://" + 'abc.com') # Here, domain name abc.com is provided using single quotation. ``` This was throwing exception as domain name is invalid as it contain single quotation and that's what we want Following is the stack trace ``` 2.1.9 :001 > a = '\'abc.com\'' => "'abc.com'" 2.1.9 :002 > URI.parse("http://" + a) URI::InvalidURIError: the scheme http does not accept registry part: 'abc.com' (or bad hostname?) from /usr/local/rvm/rubies/ruby-2.1.9/lib/ruby/2.1.0/uri/generic.rb:214:in `initialize' from /usr/local/rvm/rubies/ruby-2.1.9/lib/ruby/2.1.0/uri/common.rb:214:in `new' from /usr/local/rvm/rubies/ruby-2.1.9/lib/ruby/2.1.0/uri/common.rb:214:in `parse' from /usr/local/rvm/rubies/ruby-2.1.9/lib/ruby/2.1.0/uri/common.rb:747:in `parse' from (irb):2 from /usr/local/rvm/gems/ruby-2.1.9@clearstream/gems/railties-4.1.1/lib/rails/commands/console.rb:90:in `start' from /usr/local/rvm/gems/ruby-2.1.9@clearstream/gems/railties-4.1.1/lib/rails/commands/console.rb:9:in `start' from /usr/local/rvm/gems/ruby-2.1.9@clearstream/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:69:in `console' from /usr/local/rvm/gems/ruby-2.1.9@clearstream/gems/railties-4.1.1/lib/rails/commands/commands_tasks.rb:40:in `run_command!' from /usr/local/rvm/gems/ruby-2.1.9@clearstream/gems/railties-4.1.1/lib/rails/commands.rb:17:in `' from bin/rails:8:in `require' from bin/rails:8:in `
' ``` Now, we have upgraded to ``` ruby '2.4.1' rails '5.0.2' uri = URI.parse("http://" + 'abc.com') ``` Now, it doesn't throw any exception and allows domain name with single quotation. ``` 2.4.1 :005 > a = '\'abc.com\'' => "'abc.com'" 2.4.1 :006 > URI.parse("http://" + a) => # 2.4.1 :007 > ``` -- https://bugs.ruby-lang.org/ Unsubscribe: