-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rack::Request#host returns unexpected host when the domain starts with a number #1590
Closed
pocke opened this issue
Feb 10, 2020
· 4 comments
· Fixed by lucasgallen/patchwork#12, T-o-s-s-h-y/Learning#110, Madek/madek-graphql-api#39, imoisharma/EKs-Infrastructure-Work#1 or amrith92/Brain-Hunt#3
Closed
Rack::Request#host returns unexpected host when the domain starts with a number #1590
pocke opened this issue
Feb 10, 2020
· 4 comments
· Fixed by lucasgallen/patchwork#12, T-o-s-s-h-y/Learning#110, Madek/madek-graphql-api#39, imoisharma/EKs-Infrastructure-Work#1 or amrith92/Brain-Hunt#3
Comments
Yes, that's correct, I guess we need to force it to match the full string. Thanks for the report. |
I thought it would be greedy by default but it wasn't. Changing AUTHORITY = /^
# The host:
(?<host>
# An IPv6 address:
(\[(?<ip6>.*)\])
|
# An IPv4 address:
(?<ip4>[\d\.]+)
|
# A hostname:
(?<name>[a-zA-Z0-9\.\-]+)
)
# The optional port:
(:(?<port>\d+))?
$/x fixes the issue for me. |
ioquatix
added a commit
that referenced
this issue
Feb 10, 2020
Thank you for quick fixing! |
ioquatix
added a commit
that referenced
this issue
Feb 10, 2020
Released now in v2.2.2 - thanks for reporting the issue with an easy repro! |
This was referenced Mar 7, 2021
Merged
This was referenced Mar 14, 2021
This was referenced Mar 15, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Rack::Request#host
returns unexpected host when the domain starts with a number.Rack v2.1.2 returns host correctly.
But Rack v2.2.0 (and v2.2.1) returns a part of the host unexpectedly.
I guess the cause is the following pull request. #1561
rack/lib/rack/request.rb
Lines 601 to 615 in 838ce3a
The
AUTHORITY
regexp looks too loose.123
matches as anip4
, but it is not an ip4.The text was updated successfully, but these errors were encountered: