Skip to content

Commit

Permalink
Relax requirement on HTTP_HOST as it breaks tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Feb 6, 2020
1 parent 63e15ee commit d710df5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/rack/lint.rb
Expand Up @@ -286,13 +286,16 @@ def check_env(env)
## The <tt>SERVER_NAME</tt> 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
URI.parse("http://#{server_name}/").host == server_name rescue false
end

## The <tt>HTTP_HOST</tt> 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
if http_host = env["HTTP_HOST"]
URI.parse("http://#{http_host}/").host == http_host rescue false
else
true
end
end

## The environment must not contain the keys
Expand Down

0 comments on commit d710df5

Please sign in to comment.