Issue #4759 has been updated by Yui NARUSE.

Status changed from Open to Assigned
Assignee set to Yui NARUSE


----------------------------------------
Bug #4759: Successful URI.parse to URI::HTTP can result in an error in request_uri
http://redmine.ruby-lang.org/issues/4759

Author: Markus Fischer
Status: Assigned
Priority: Normal
Assignee: Yui NARUSE
Category: lib
Target version: 
ruby -v: ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]


When passing a weird-formed uri to URI.parse which gets successfully parsed, calling request_uri bombs out with undefined method.

The malformed uri: http:foo

Example code:

$ ruby -ruri -e 'URI.parse("http:foo").request_uri'
/ruby-1.9.2-p180/lib/ruby/1.9.1/uri/http.rb:91:in `request_uri': undefined method `[]' for nil:NilClass (NoMethodError)
        from -e:1:in `<main>'

This also happens for variations, e.g. http::foo , http:::foo , etc.

I'm not exactly sure what to expect. Either request_uri to return nil or URI.parse("http:foo").class being of type URI::Generic instead of URI::HTTP .


-- 
http://redmine.ruby-lang.org