Skip to content

Commit

Permalink
Remove HTTP_VERSION validation from Rack::Lint. (#2154)
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Jan 31, 2024
1 parent 25e0e01 commit 449ed4d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion SPEC.rdoc
Expand Up @@ -112,7 +112,6 @@ The <tt>SERVER_PORT</tt> must be an Integer if set.
The <tt>SERVER_NAME</tt> must be a valid authority as defined by RFC7540.
The <tt>HTTP_HOST</tt> must be a valid authority as defined by RFC7540.
The <tt>SERVER_PROTOCOL</tt> must match the regexp <tt>HTTP/\d(\.\d)?</tt>.
If the <tt>HTTP_VERSION</tt> is present, it must equal the <tt>SERVER_PROTOCOL</tt>.
The environment must not contain the keys
<tt>HTTP_CONTENT_TYPE</tt> or <tt>HTTP_CONTENT_LENGTH</tt>
(use the versions without <tt>HTTP_</tt>).
Expand Down
5 changes: 0 additions & 5 deletions lib/rack/lint.rb
Expand Up @@ -288,11 +288,6 @@ def check_environment(env)
raise LintError, "env[SERVER_PROTOCOL] does not match HTTP/\\d(\\.\\d)?"
end

## If the <tt>HTTP_VERSION</tt> is present, it must equal the <tt>SERVER_PROTOCOL</tt>.
if env['HTTP_VERSION'] && env['HTTP_VERSION'] != server_protocol
raise LintError, "env[HTTP_VERSION] does not equal env[SERVER_PROTOCOL]"
end

## The environment must not contain the keys
## <tt>HTTP_CONTENT_TYPE</tt> or <tt>HTTP_CONTENT_LENGTH</tt>
## (use the versions without <tt>HTTP_</tt>).
Expand Down
7 changes: 0 additions & 7 deletions test/spec_lint.rb
Expand Up @@ -65,13 +65,6 @@ def env(options = {})
}.must_raise(Rack::Lint::LintError).
message.must_match(/env\[SERVER_PROTOCOL\] does not match HTTP/)

lambda {
e = env
e["HTTP_VERSION"] = 'HTTP/1.0'
Rack::Lint.new(nil).call(e)
}.must_raise(Rack::Lint::LintError).
message.must_match(/env\[HTTP_VERSION\] does not equal env\[SERVER_PROTOCOL\]/)

lambda {
Rack::Lint.new(nil).call(env("HTTP_CONTENT_TYPE" => "text/plain"))
}.must_raise(Rack::Lint::LintError).
Expand Down

0 comments on commit 449ed4d

Please sign in to comment.