https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112014-11-13T18:22:50ZRuby Issue Tracking SystemRuby master - Bug #10507: URI Error: bad URI(is not URI?) in Ruby 2.0.0, 2.1.5, 2.2.0preview1https://bugs.ruby-lang.org/issues/10507?journal_id=499442014-11-13T18:22:50ZJuanitoFatas (Juanito Fatas)katehuang0320@gmail.com
<ul></ul><p>Encode + URI + open.</p>
<pre><code>ruby -v -ruri -e "open(URI(URI.encode 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'))"
ruby 2.0.0p598 (2014-11-13) [x86_64-darwin13.3.0]
-e:1:in `<main>': warning: URI.escape is obsolete
-e:1:in `open': no implicit conversion of URI::HTTP into String (TypeError)
from -e:1:in `<main>'
ruby -v -ruri -e "open(URI(URI.encode 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'))"
ruby 2.1.5p273 (2014-11-13 revision 48405) [x86_64-darwin13.0]
-e:1:in `<main>': warning: URI.escape is obsolete
-e:1:in `open': no implicit conversion of URI::HTTP into String (TypeError)
from -e:1:in `<main>'
ruby -v -ruri -e "open(URI(URI.encode 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'))"
ruby 2.2.0preview1 (2014-09-17 trunk 47616) [x86_64-darwin13]
-e:1:in `<main>': warning: URI.escape is obsolete
-e:1:in `open': no implicit conversion of URI::HTTP into String (TypeError)
from -e:1:in `<main>'
</code></pre> Ruby master - Bug #10507: URI Error: bad URI(is not URI?) in Ruby 2.0.0, 2.1.5, 2.2.0preview1https://bugs.ruby-lang.org/issues/10507?journal_id=792282019-07-09T02:08:09Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>This was fixed between 2.1 and 2.2:</p>
<pre><code>$ ruby21 -ruri -e "p URI 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'"
/usr/local/lib/ruby/2.1/uri/common.rb:176:in `split': bad URI(is not URI?): http://localhost:3000/?url=google.com&clipRect={top:0,left:0,width:1050,height:700} (URI::InvalidURIError)
from /usr/local/lib/ruby/2.1/uri/common.rb:211:in `parse'
from /usr/local/lib/ruby/2.1/uri/common.rb:747:in `parse'
from /usr/local/lib/ruby/2.1/uri/common.rb:1232:in `URI'
from -e:1:in `<main>'
$ ruby22 -ruri -e "p URI 'http://localhost:3000/?url=google.com&clipRect={"top":0,"left":0,"width":1050,"height":700}'"
#<URI::HTTP http://localhost:3000/?url=google.com&clipRect={top:0,left:0,width:1050,height:700}>
</code></pre>