Skip to content

Commit d73291c

Browse files
authored
Don't assign nil to rack.protocol. (#19)
1 parent 90f0baf commit d73291c

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

lib/protocol/rack/adapter/generic.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ def unwrap_headers(headers, env)
7474
# @parameter request [Protocol::HTTP::Request] The incoming request.
7575
# @parameter env [Hash] The rack `env`.
7676
def unwrap_request(request, env)
77+
# The request protocol, either from the upgrade header or the HTTP/2 pseudo header of the same name.
78+
if protocol = request.protocol
79+
env[RACK_PROTOCOL] = protocol
80+
end
81+
7782
if content_type = request.headers.delete("content-type")
7883
env[CGI::CONTENT_TYPE] = content_type
7984
end

lib/protocol/rack/adapter/rack2.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,6 @@ def make_environment(request)
3737
RACK_ERRORS => $stderr,
3838
RACK_LOGGER => self.logger,
3939

40-
# The request protocol, either from the upgrade header or the HTTP/2 pseudo header of the same name.
41-
RACK_PROTOCOL => request.protocol,
42-
4340
# The HTTP request method, such as “GET” or “POST”. This cannot ever be an empty string, and so is always required.
4441
CGI::REQUEST_METHOD => request.method,
4542

lib/protocol/rack/adapter/rack3.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ def make_environment(request)
3030
RACK_ERRORS => $stderr,
3131
RACK_LOGGER => self.logger,
3232

33-
# The request protocol, either from the upgrade header or the HTTP/2 pseudo header of the same name.
34-
RACK_PROTOCOL => request.protocol,
35-
3633
# The response finished callbacks:
3734
RACK_RESPONSE_FINISHED => [],
3835

lib/protocol/rack/adapter/rack31.rb

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ def make_environment(request)
2121
RACK_ERRORS => $stderr,
2222
RACK_LOGGER => self.logger,
2323

24-
# The request protocol, either from the upgrade header or the HTTP/2 pseudo header of the same name.
25-
RACK_PROTOCOL => request.protocol,
26-
2724
# The response finished callbacks:
2825
RACK_RESPONSE_FINISHED => [],
2926

0 commit comments

Comments
 (0)