protocol-rack 0.11.0 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 30e960af55f8f9e0c401657bd0e245c448f46315ef97cdd3d25aeeb8f41ef99c
4
- data.tar.gz: 1d4f9d858799b04e909776e120f4f376aa54ad4a956bd077e109edc704f3a2ff
3
+ metadata.gz: 124bd6a30fd5deaa6da388f3696ab0c78e6449a4725c93c8c7ba2481e588c4c7
4
+ data.tar.gz: 0453b87af7991026fa5caedb55ab17bee73be495a1487dd19790ec2de54a2b68
5
5
  SHA512:
6
- metadata.gz: c71e270584bfe6e4da54ce6b175664880180ddf5ba2cb5fec1fb4ef3b67aa93af2ef78ecc0d74869f477caed03e5caf4e072758fef7f831fcb8e249ccea60e5f
7
- data.tar.gz: 9af0d3f0bbd79784f9f8464a1cffdfc76f55e9d49e386a9c770b43af85da2a2d1a0dfd0bbb624d2465d99f79ae1ef2663848d38195a2816aa57ebb9a9588a926
6
+ metadata.gz: 5c51951538967417013133c28b8b45e38826d9620048aaacf97a2a1c7a9da8c28e19ba28e28f1297dbdabece59efef43d33f9130aacd817f04053953f4d6fbc4
7
+ data.tar.gz: 7ae670685d6e90520cb889a7f03e76620ad13349e0fb94a97d3a57236bdef7f476c0378533f47ac958d13fad03a8134d5318040bfa9136c23ac9f5aa74fcf9a1
checksums.yaml.gz.sig CHANGED
Binary file
@@ -34,9 +34,17 @@ module Protocol
34
34
  Console
35
35
  end
36
36
 
37
- # Unwrap raw HTTP headers into the CGI-style expected by Rack middleware.
37
+ # Unwrap HTTP headers into the CGI-style expected by Rack middleware, and add them to the rack `env`.
38
38
  #
39
- # Rack separates multiple headers with the same key, into a single field with multiple lines.
39
+ # e.g. `accept-encoding` becomes `HTTP_ACCEPT_ENCODING`.
40
+ #
41
+ # Headers keys with underscores will generate the same CGI-style header key as headers with dashes.
42
+ #
43
+ # e.g `accept_encoding` becomes `HTTP_ACCEPT_ENCODING` too.
44
+ #
45
+ # You should not implicitly trust the `HTTP_` headers for security purposes, as they are generated by the client.
46
+ #
47
+ # Multiple headers are combined with a comma, with one exception: `HTTP_COOKIE` headers are combined with a semicolon.
40
48
  #
41
49
  # @parameter headers [Protocol::HTTP::Headers] The raw HTTP request headers.
42
50
  # @parameter env [Hash] The rack request `env`.
@@ -66,6 +74,11 @@ module Protocol
66
74
  # @parameter request [Protocol::HTTP::Request] The incoming request.
67
75
  # @parameter env [Hash] The rack `env`.
68
76
  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
+
69
82
  if content_type = request.headers.delete("content-type")
70
83
  env[CGI::CONTENT_TYPE] = content_type
71
84
  end
@@ -37,9 +37,6 @@ module Protocol
37
37
  RACK_ERRORS => $stderr,
38
38
  RACK_LOGGER => self.logger,
39
39
 
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
-
43
40
  # The HTTP request method, such as “GET” or “POST”. This cannot ever be an empty string, and so is always required.
44
41
  CGI::REQUEST_METHOD => request.method,
45
42
 
@@ -30,9 +30,6 @@ module Protocol
30
30
  RACK_ERRORS => $stderr,
31
31
  RACK_LOGGER => self.logger,
32
32
 
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
-
36
33
  # The response finished callbacks:
37
34
  RACK_RESPONSE_FINISHED => [],
38
35
 
@@ -21,9 +21,6 @@ module Protocol
21
21
  RACK_ERRORS => $stderr,
22
22
  RACK_LOGGER => self.logger,
23
23
 
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
-
27
24
  # The response finished callbacks:
28
25
  RACK_RESPONSE_FINISHED => [],
29
26
 
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Rack
8
- VERSION = "0.11.0"
8
+ VERSION = "0.11.1"
9
9
  end
10
10
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -38,7 +38,7 @@ cert_chain:
38
38
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
39
39
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
40
40
  -----END CERTIFICATE-----
41
- date: 2024-11-09 00:00:00.000000000 Z
41
+ date: 2024-12-11 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: protocol-http
metadata.gz.sig CHANGED
Binary file