ruby / uri

URI is a module providing classes to handle Uniform Resource Identifiers
https://ruby.github.io/uri/
Other
86 stars 47 forks source link

`URI::HTTPS` can build URI with blank, invalid host #115

Closed RonRicardo closed 3 months ago

RonRicardo commented 3 months ago

In Ruby 3.4.0+, calling URI::HTTPS.build(host: "") does not raise URI::InvalidComponentError as expected. Instead, it returns #<URI::HTTPS https://>

I think this was introduced in this PR.

Steps to Reproduce

1. Environment:

2. Steps:

3. Expected Behavior:

4. Actual Behavior:

Ruby 3.1.4:

irb(main):008:0> RUBY_VERSION
=> "3.1.4"
irb(main):009:0> URI::HTTPS.build(host:"")
/home/vscode/.rbenv/versions/3.1.4/lib/ruby/3.1.0/uri/generic.rb:601:in `check_host': bad component(expected host component):  (URI::InvalidComponentError)

Ruby 3.4.0:

irb(…):015> RUBY_VERSION
=> "3.4.0"
irb(...):016> URI::HTTPS.build(host:"")
=> #<URI::HTTPS https://>
RonRicardo commented 3 months ago

Closed this issue in favor of: https://bugs.ruby-lang.org/issues/20686