protocol-rack 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/rack/adapter/generic.rb +20 -2
- data/lib/protocol/rack/adapter/rack2.rb +3 -5
- data/lib/protocol/rack/adapter/rack3.rb +3 -4
- data/lib/protocol/rack/adapter.rb +1 -1
- data/lib/protocol/rack/constants.rb +3 -1
- data/lib/protocol/rack/input.rb +1 -2
- data/lib/protocol/rack/response.rb +1 -1
- data/lib/protocol/rack/version.rb +2 -2
- data/license.md +1 -1
- data/readme.md +1 -1
- data.tar.gz.sig +0 -0
- metadata +7 -5
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 63abbb92ce268dc594b9464a931bb846808788db40a11a5c5aae81b64552eb30
|
4
|
+
data.tar.gz: bd369d97c603d06cce3088f6d2f785c12fb20c52cc038d31d860d107cabd301c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7058394c8f576c1cbff70179dcde738d6c31036c01ef264178056281dac28195e2dc19a14c21242b22c00f8db695fd73a8836c0125e9e60c4f37010ed537c15
|
7
|
+
data.tar.gz: 8c73f392e0bb354693eb2a5063f5add1d5feccf13d5155991870b9d216f59dad31ae4831b5825cd0a47871799b4433eedc36e64b01d6656cefe157eb519882d4
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'console'
|
7
7
|
|
@@ -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
|
-
|
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
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'console'
|
7
7
|
|
@@ -11,7 +11,7 @@ require_relative '../rewindable'
|
|
11
11
|
module Protocol
|
12
12
|
module Rack
|
13
13
|
module Adapter
|
14
|
-
class Rack2
|
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
|
-
|
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]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022, by Samuel Williams.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'console'
|
7
7
|
|
@@ -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
|
-
|
96
|
-
|
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:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022, by Samuel Williams.
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
|
6
6
|
module Protocol
|
7
7
|
module Rack
|
@@ -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
|
data/lib/protocol/rack/input.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Released under the MIT License.
|
4
|
-
# Copyright, 2022-
|
4
|
+
# Copyright, 2022-2024, by Samuel Williams.
|
5
5
|
# Copyright, 2023, by Genki Takiuchi.
|
6
6
|
|
7
|
-
require 'async/io/buffer'
|
8
7
|
require 'protocol/http/body/stream'
|
9
8
|
|
10
9
|
module Protocol
|
data/license.md
CHANGED
data/readme.md
CHANGED
@@ -77,7 +77,7 @@ This project uses the [Developer Certificate of Origin](https://developercertifi
|
|
77
77
|
|
78
78
|
### Contributor Covenant
|
79
79
|
|
80
|
-
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
80
|
+
This project is governed by the [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
81
81
|
|
82
82
|
## See Also
|
83
83
|
|
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.
|
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-
|
41
|
+
date: 2024-06-14 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: protocol-http
|
@@ -94,7 +94,9 @@ files:
|
|
94
94
|
homepage: https://github.com/socketry/protocol-rack
|
95
95
|
licenses:
|
96
96
|
- MIT
|
97
|
-
metadata:
|
97
|
+
metadata:
|
98
|
+
documentation_uri: https://socketry.github.io/protocol-rack/
|
99
|
+
source_code_uri: https://github.com/socketry/protocol-rack.git
|
98
100
|
post_install_message:
|
99
101
|
rdoc_options: []
|
100
102
|
require_paths:
|
@@ -103,14 +105,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
105
|
requirements:
|
104
106
|
- - ">="
|
105
107
|
- !ruby/object:Gem::Version
|
106
|
-
version: '3.
|
108
|
+
version: '3.1'
|
107
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
110
|
requirements:
|
109
111
|
- - ">="
|
110
112
|
- !ruby/object:Gem::Version
|
111
113
|
version: '0'
|
112
114
|
requirements: []
|
113
|
-
rubygems_version: 3.5.
|
115
|
+
rubygems_version: 3.5.9
|
114
116
|
signing_key:
|
115
117
|
specification_version: 4
|
116
118
|
summary: An implementation of the Rack protocol/specification.
|
metadata.gz.sig
CHANGED
Binary file
|