[#114181] [Ruby master Bug#19767] [Not really a bug, but more a not ideal notification] "historical binary regexp match" when using the "n" modifier in a ruby regex — "rubyFeedback (robert heiler) via ruby-core" <ruby-core@...>
SXNzdWUgIzE5NzY3IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHJ1YnlGZWVkYmFjayAocm9iZXJ0IGhl
3 messages
2023/07/14
[ruby-core:114096] [Ruby master Bug#19756] URI::HTTP.build does not accept a host of `_gateway`, but `URI.parse` will.
From:
"austin (Austin Ziegler) via ruby-core" <ruby-core@...>
Date:
2023-07-05 19:08:58 UTC
List:
ruby-core #114096
Issue #19756 has been updated by austin (Austin Ziegler).
This is a better thread overall and there are a *number* of points worth reading in it. It boils down to:
- Underscores are not permitted in hostnames and therefore URLs/URIs.
- Leading underscores are permitted in DNS labels.
- Underscores are not otherwise permitted in DNS labels.
https://stackoverflow.com/questions/2180465/can-domain-name-subdomains-have-an-underscore-in-it
----------------------------------------
Bug #19756: URI::HTTP.build does not accept a host of `_gateway`, but `URI.parse` will.
https://bugs.ruby-lang.org/issues/19756#change-103772
* Author: postmodern (Hal Brodigan)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
* Backport: 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN
----------------------------------------
I noticed a difference in behavior between `URI::HTTP.build` and `URI.parse`. `URI::HTTP.build` will not accept `host:` value of `_gateway`, but `URI.parse` will.
## Steps To Reproduce
```ruby
URI::HTTP.build(host: "_gateway")
```
vs.
```ruby
URI.parse("http://_gateway")
```
### Expected Results
Both raise the same exception, or return the same URI object.
### Actual Results
```
URI::HTTP.build(host: "_gateway")
/usr/share/ruby/uri/generic.rb:601:in `check_host': bad component(expected host component): _gateway (URI::InvalidComponentError)
from /usr/share/ruby/uri/generic.rb:640:in `host='
from /usr/share/ruby/uri/generic.rb:673:in `hostname='
from /usr/share/ruby/uri/generic.rb:190:in `initialize'
from /usr/share/ruby/uri/generic.rb:136:in `new'
from /usr/share/ruby/uri/generic.rb:136:in `build'
from /usr/share/ruby/uri/http.rb:61:in `build'
from (irb):2:in `<main>'
from /usr/local/share/gems/gems/irb-1.7.0/exe/irb:9:in `<top (required)>'
from /usr/local/bin/irb:25:in `load'
from /usr/local/bin/irb:25:in `<main>'
```
```
URI.parse("https://_gateway")
# => #<URI::HTTPS https://_gateway>
```
## Additional Information
```
$ gem list uri
uri (default: 0.12.1)
```
--
https://bugs.ruby-lang.org/
______________________________________________
ruby-core mailing list -- ruby-core@ml.ruby-lang.org
To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/