Skip to content

HTTP_HOST not parsing port correctly at 2.X #2070

@caiofct

Description

@caiofct

Hello, I think we might have a regression from this PR #1606.

With Rack 2.1.4.3 (Rack 3.X also works as expected)

irb(main):001:0> r = Rack::Request.new({"HTTP_HOST" => "some_service:3001"})
irb(main):002:0> r.host
=> "some_service"
irb(main):003:0> r.port
=> 3001

With Rack 2.2.6.4 (But any version at 2.2.X will behave the same way)

irb(main):001:0> r = Rack::Request.new({ "HTTP_HOST" => "some_service:3001" })
irb(main):002:0> r.host
=> "http://some_service:3001"
irb(main):003:0> r.port
=> nil

Am I missing something here?

Ruby: 2.7.8
Rails 7.0.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions