Project

General

Profile

Bug #4759

Successful URI.parse to URI::HTTP can result in an error in request_uri

Added by mfn (Markus Fischer) about 8 years ago. Updated about 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
Backport:
[ruby-core:36375]

Description

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 `'

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 .

Associated revisions

Revision a83f125c
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 31907
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

Revision 31907
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

Revision 31907
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

Revision 31907
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

Revision 31907
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

Revision 31907
Added by naruse (Yui NARUSE) about 8 years ago

  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

History

Updated by naruse (Yui NARUSE) about 8 years ago

  • Status changed from Open to Assigned
  • Assignee set to naruse (Yui NARUSE)
#2

Updated by naruse (Yui NARUSE) about 8 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r31907.
Markus, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri is path-rootless form. Bug #4759

Also available in: Atom PDF