Don't copy HTTP_VERSION from the source to the target request

Although the HTTP Version appears as a header inside `env`, it's not actually a regular header. When `extract_http_request_headers` is called, it translates the `HTTP_VERSION` "header" into a `Version` header. `Version` is only a provisionally-supported header name, and is semantically meant to represent the version of an (evolving object)[https://www.w3.org/Protocols/HTTP/Object_Headers.html#z13]. It's not correct to pass the HTTP Version as the contents of the `Version` header, so this change skips the processing of that particular header entirely.
This commit is contained in:
Ian Clarkson 2018-04-18 15:25:14 -07:00
parent 53f0973e66
commit dc19756c1f
1 changed files with 1 additions and 1 deletions

View File

@ -131,7 +131,7 @@ module ReverseProxy
def extract_http_request_headers(env) def extract_http_request_headers(env)
headers = env.reject do |k, v| headers = env.reject do |k, v|
!(/^HTTP_[A-Z_]+$/ === k) || v.nil? !(/^HTTP_[A-Z_]+$/ === k) || k == "HTTP_VERSION" || v.nil?
end.map do |k, v| end.map do |k, v|
[reconstruct_header_name(k), v] [reconstruct_header_name(k), v]
end.inject(Rack::Utils::HeaderHash.new) do |hash, k_v| end.inject(Rack::Utils::HeaderHash.new) do |hash, k_v|