protocol-rack 0.5.1 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f8eef2db46dd32a4307561b5d6d05b5b3874971473f0a01f669122bba02aa2f4
4
- data.tar.gz: 24f7ce0dec015114a5d6a984ef3b3075446fee220975b1a9060100588124d262
3
+ metadata.gz: 63abbb92ce268dc594b9464a931bb846808788db40a11a5c5aae81b64552eb30
4
+ data.tar.gz: bd369d97c603d06cce3088f6d2f785c12fb20c52cc038d31d860d107cabd301c
5
5
  SHA512:
6
- metadata.gz: aaf3f413e3667955841c43dfbd66d0ed930bf0454a9fda0740af3d24ee2cab7055fa3dbe4807f4aa4d7684747e96567216eb9490a412ed68bc6c2a94c125fe60
7
- data.tar.gz: b8055752788740184967b2ab59a9c9c612659451797aadadc956358b661e876afe7e8465dfc2ae72e5f4d27be27514a5a70ad76cd726460036ef1c41bc986d58
6
+ metadata.gz: d7058394c8f576c1cbff70179dcde738d6c31036c01ef264178056281dac28195e2dc19a14c21242b22c00f8db695fd73a8836c0125e9e60c4f37010ed537c15
7
+ data.tar.gz: 8c73f392e0bb354693eb2a5063f5add1d5feccf13d5155991870b9d216f59dad31ae4831b5825cd0a47871799b4433eedc36e64b01d6656cefe157eb519882d4
checksums.yaml.gz.sig CHANGED
Binary file
@@ -45,7 +45,11 @@ module Protocol
45
45
  http_key = "HTTP_#{key.upcase.tr('-', '_')}"
46
46
 
47
47
  if current_value = env[http_key]
48
- env[http_key] = "#{current_value};#{value}"
48
+ if http_key == CGI::HTTP_COOKIE
49
+ env[http_key] = "#{current_value};#{value}"
50
+ else
51
+ env[http_key] = "#{current_value},#{value}"
52
+ end
49
53
  else
50
54
  env[http_key] = value
51
55
  end
@@ -138,6 +142,20 @@ module Protocol
138
142
  def failure_response(exception)
139
143
  Protocol::HTTP::Response.for_exception(exception)
140
144
  end
145
+
146
+ def self.extract_protocol(env, response, headers)
147
+ if protocol = response.protocol
148
+ # This is the newer mechanism for protocol upgrade:
149
+ if env['rack.protocol']
150
+ headers['rack.protocol'] = protocol
151
+
152
+ # Older mechanism for protocol upgrade:
153
+ elsif env[CGI::HTTP_UPGRADE]
154
+ headers['upgrade'] = protocol
155
+ headers['connection'] = 'upgrade'
156
+ end
157
+ end
158
+ end
141
159
  end
142
160
  end
143
161
  end
@@ -11,7 +11,7 @@ require_relative '../rewindable'
11
11
  module Protocol
12
12
  module Rack
13
13
  module Adapter
14
- class Rack2 < Generic
14
+ class Rack2 < Generic
15
15
  RACK_VERSION = 'rack.version'
16
16
  RACK_MULTITHREAD = 'rack.multithread'
17
17
  RACK_MULTIPROCESS = 'rack.multiprocess'
@@ -121,9 +121,7 @@ module Protocol
121
121
  # These interfaces should be largely compatible:
122
122
  headers = response.headers.to_h
123
123
 
124
- if protocol = response.protocol
125
- headers['rack.protocol'] = protocol
126
- end
124
+ self.extract_protocol(env, response, headers)
127
125
 
128
126
  if body = response.body and body.stream?
129
127
  if env[RACK_IS_HIJACK]
@@ -92,9 +92,8 @@ module Protocol
92
92
  def self.make_response(env, response)
93
93
  # These interfaces should be largely compatible:
94
94
  headers = response.headers.to_h
95
- if protocol = response.protocol
96
- headers['rack.protocol'] = protocol
97
- end
95
+
96
+ self.extract_protocol(env, response, headers)
98
97
 
99
98
  if body = response.body and body.stream?
100
99
  # Force streaming response:
@@ -25,6 +25,8 @@ module Protocol
25
25
  CONTENT_TYPE = 'CONTENT_TYPE'
26
26
  CONTENT_LENGTH = 'CONTENT_LENGTH'
27
27
 
28
+ HTTP_COOKIE = 'HTTP_COOKIE'
29
+
28
30
  # Header constants:
29
31
  HTTP_X_FORWARDED_PROTO = 'HTTP_X_FORWARDED_PROTO'
30
32
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module Rack
8
- VERSION = "0.5.1"
8
+ VERSION = "0.6.0"
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.5.1
4
+ version: 0.6.0
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-04-24 00:00:00.000000000 Z
41
+ date: 2024-06-14 00:00:00.000000000 Z
42
42
  dependencies:
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: protocol-http
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.5.3
115
+ rubygems_version: 3.5.9
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: An implementation of the Rack protocol/specification.
metadata.gz.sig CHANGED
Binary file