diff --git a/lib/rack/lint.rb b/lib/rack/lint.rb
index 17e98ef72..5349034e1 100644
--- a/lib/rack/lint.rb
+++ b/lib/rack/lint.rb
@@ -284,15 +284,13 @@ def check_env(env)
end
## The SERVER_NAME must be a valid authority as defined by RFC7540.
- assert("env[SERVER_NAME] must be a valid host") do
- server_name = env["SERVER_NAME"]
- URI.parse("http://#{server_name}").host == server_name rescue false
+ assert("#{env[SERVER_NAME]} must be a valid authority") do
+ URI.parse("http://#{env[SERVER_NAME]}/") rescue false
end
## The HTTP_HOST must be a valid authority as defined by RFC7540.
- assert("env[HTTP_HOST] must be a valid host") do
- http_host = env["HTTP_HOST"]
- URI.parse("http://#{http_host}/").host == http_host rescue false
+ assert("#{env[HTTP_HOST]} must be a valid authority") do
+ URI.parse("http://#{env[HTTP_HOST]}/") rescue false
end
## The environment must not contain the keys