Skip to content

Are hostnames with underscores / ampersands legit? #141

Closed
@voxik

Description

@voxik

Testing globalid Ruby 3.4, there some issues such as:

Failure:
GlobalIDTest#test_invalid_app_name [test/cases/global_id_test.rb:13]:
ArgumentError expected but nothing was raised.

rails test test/cases/global_id_test.rb:8

F

Digging closer into this test error, I have spotted this difference:

$ ruby -ruri -ruri/version -e 'puts URI::VERSION; URI::Generic.new("gid", nil, "blog_app", nil, nil, "/Model/1", nil, nil, nil, nil, true)'
0.13.1
/usr/share/ruby/uri/generic.rb:601:in `check_host': bad component(expected host component): blog_app (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 -e:1:in `new'
	from -e:1:in `<main>'

vs

$ ruby -ruri -ruri/version -e 'puts URI::VERSION; URI::Generic.new("gid", nil, "blog_app", nil, nil, "/Model/1", nil, nil, nil, nil, true)'
1.0.2

As you can see, for the URI 0.13.1, the underscore is not allowed, while with URI 1.0.2 underscore works just fine. Is that expected?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions