protocol-rack 0.2.5 → 0.3.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 +22 -1
- data/lib/protocol/rack/adapter/rack2.rb +0 -1
- data/lib/protocol/rack/constants.rb +1 -0
- data/lib/protocol/rack/input.rb +1 -1
- data/lib/protocol/rack/request.rb +2 -3
- data/lib/protocol/rack/version.rb +2 -2
- data/readme.md +8 -0
- data.tar.gz.sig +0 -0
- metadata +4 -88
- metadata.gz.sig +6 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dae79721011ba76b6565ae1e575bc39a2675906d8d7779030874b3da925c8a5
|
4
|
+
data.tar.gz: a8d80d07330a9f17a4d346b3e134187d63153becbbfb05ae2cd403b347e6ad26
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d695b98ff03053fd4245f6441d7409f2d13ba1804ed0d34e739acf2e0c8d648b62c7f32f18a1f812ad0b63b3f7a5fca250d82970cbf0ac83c0149abfe6ce508
|
7
|
+
data.tar.gz: 59a25f01bb637d9b5100f2609d714801a58cbc1ccb8373836ec11b2539cf80300be3f48ebd30590102ad59d4ca29c9c83d18788719cf6d527ecd8bf8f3b4f5dc
|
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, by Samuel Williams.
|
4
|
+
# Copyright, 2022-2023, by Samuel Williams.
|
5
5
|
|
6
6
|
require 'console'
|
7
7
|
|
@@ -68,6 +68,11 @@ module Protocol
|
|
68
68
|
|
69
69
|
self.unwrap_headers(request.headers, env)
|
70
70
|
|
71
|
+
# For the sake of compatibility, we set the `HTTP_UPGRADE` header to the requested protocol.
|
72
|
+
if protocol = request.protocol and request.version.start_with?('http/1')
|
73
|
+
env[CGI::HTTP_UPGRADE] = Array(protocol).join(",")
|
74
|
+
end
|
75
|
+
|
71
76
|
# HTTP/2 prefers `:authority` over `host`, so we do this for backwards compatibility.
|
72
77
|
env[CGI::HTTP_HOST] ||= request.authority
|
73
78
|
|
@@ -78,6 +83,12 @@ module Protocol
|
|
78
83
|
end
|
79
84
|
end
|
80
85
|
|
86
|
+
def make_environment(request)
|
87
|
+
{
|
88
|
+
request: request
|
89
|
+
}
|
90
|
+
end
|
91
|
+
|
81
92
|
# Build a rack `env` from the incoming request and apply it to the rack middleware.
|
82
93
|
#
|
83
94
|
# @parameter request [Protocol::HTTP::Request] The incoming request.
|
@@ -86,6 +97,16 @@ module Protocol
|
|
86
97
|
|
87
98
|
status, headers, body = @app.call(env)
|
88
99
|
|
100
|
+
# The status must always be an integer.
|
101
|
+
unless status.is_a?(Integer)
|
102
|
+
raise ArgumentError, "Status must be an integer!"
|
103
|
+
end
|
104
|
+
|
105
|
+
# Headers must always be a hash or equivalent.
|
106
|
+
unless headers
|
107
|
+
raise ArgumentError, "Headers must not be nil!"
|
108
|
+
end
|
109
|
+
|
89
110
|
headers, meta = self.wrap_headers(headers)
|
90
111
|
|
91
112
|
return Response.wrap(env, status, headers, meta, body, request)
|
data/lib/protocol/rack/input.rb
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
require 'protocol/http/request'
|
7
7
|
require 'protocol/http/headers'
|
8
8
|
|
9
|
+
require_relative 'constants'
|
9
10
|
require_relative 'body/input_wrapper'
|
10
11
|
|
11
12
|
module Protocol
|
@@ -30,12 +31,10 @@ module Protocol
|
|
30
31
|
)
|
31
32
|
end
|
32
33
|
|
33
|
-
HTTP_UPGRADE = 'HTTP_UPGRADE'
|
34
|
-
|
35
34
|
def self.protocol(env)
|
36
35
|
if protocols = env['rack.protocol']
|
37
36
|
return Array(protocols)
|
38
|
-
elsif protocols = env[HTTP_UPGRADE]
|
37
|
+
elsif protocols = env[CGI::HTTP_UPGRADE]
|
39
38
|
return protocols.split(/\s*,\s*/)
|
40
39
|
end
|
41
40
|
end
|
data/readme.md
CHANGED
@@ -71,6 +71,14 @@ We welcome contributions to this project.
|
|
71
71
|
4. Push to the branch (`git push origin my-new-feature`).
|
72
72
|
5. Create new Pull Request.
|
73
73
|
|
74
|
+
### Developer Certificate of Origin
|
75
|
+
|
76
|
+
This project uses the [Developer Certificate of Origin](https://developercertificate.org/). All contributors to this project must agree to this document to have their contributions accepted.
|
77
|
+
|
78
|
+
### Contributor Covenant
|
79
|
+
|
80
|
+
This project is governed by [Contributor Covenant](https://www.contributor-covenant.org/). All contributors and participants agree to abide by its terms.
|
81
|
+
|
74
82
|
## See Also
|
75
83
|
|
76
84
|
- [protocol-http](https://github.com/socketry/protocol-http) — General abstractions for HTTP client/server implementations.
|
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.3.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: 2023-
|
41
|
+
date: 2023-12-11 00:00:00.000000000 Z
|
42
42
|
dependencies:
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: protocol-http
|
@@ -68,90 +68,6 @@ dependencies:
|
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '1.0'
|
71
|
-
- !ruby/object:Gem::Dependency
|
72
|
-
name: async-http
|
73
|
-
requirement: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0.59'
|
78
|
-
type: :development
|
79
|
-
prerelease: false
|
80
|
-
version_requirements: !ruby/object:Gem::Requirement
|
81
|
-
requirements:
|
82
|
-
- - "~>"
|
83
|
-
- !ruby/object:Gem::Version
|
84
|
-
version: '0.59'
|
85
|
-
- !ruby/object:Gem::Dependency
|
86
|
-
name: bake-test
|
87
|
-
requirement: !ruby/object:Gem::Requirement
|
88
|
-
requirements:
|
89
|
-
- - "~>"
|
90
|
-
- !ruby/object:Gem::Version
|
91
|
-
version: '0.1'
|
92
|
-
type: :development
|
93
|
-
prerelease: false
|
94
|
-
version_requirements: !ruby/object:Gem::Requirement
|
95
|
-
requirements:
|
96
|
-
- - "~>"
|
97
|
-
- !ruby/object:Gem::Version
|
98
|
-
version: '0.1'
|
99
|
-
- !ruby/object:Gem::Dependency
|
100
|
-
name: bake-test-external
|
101
|
-
requirement: !ruby/object:Gem::Requirement
|
102
|
-
requirements:
|
103
|
-
- - "~>"
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version: '0.1'
|
106
|
-
type: :development
|
107
|
-
prerelease: false
|
108
|
-
version_requirements: !ruby/object:Gem::Requirement
|
109
|
-
requirements:
|
110
|
-
- - "~>"
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
version: '0.1'
|
113
|
-
- !ruby/object:Gem::Dependency
|
114
|
-
name: covered
|
115
|
-
requirement: !ruby/object:Gem::Requirement
|
116
|
-
requirements:
|
117
|
-
- - "~>"
|
118
|
-
- !ruby/object:Gem::Version
|
119
|
-
version: '0.16'
|
120
|
-
type: :development
|
121
|
-
prerelease: false
|
122
|
-
version_requirements: !ruby/object:Gem::Requirement
|
123
|
-
requirements:
|
124
|
-
- - "~>"
|
125
|
-
- !ruby/object:Gem::Version
|
126
|
-
version: '0.16'
|
127
|
-
- !ruby/object:Gem::Dependency
|
128
|
-
name: sus
|
129
|
-
requirement: !ruby/object:Gem::Requirement
|
130
|
-
requirements:
|
131
|
-
- - "~>"
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
version: '0.12'
|
134
|
-
type: :development
|
135
|
-
prerelease: false
|
136
|
-
version_requirements: !ruby/object:Gem::Requirement
|
137
|
-
requirements:
|
138
|
-
- - "~>"
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: '0.12'
|
141
|
-
- !ruby/object:Gem::Dependency
|
142
|
-
name: sus-fixtures-async-http
|
143
|
-
requirement: !ruby/object:Gem::Requirement
|
144
|
-
requirements:
|
145
|
-
- - "~>"
|
146
|
-
- !ruby/object:Gem::Version
|
147
|
-
version: '0.1'
|
148
|
-
type: :development
|
149
|
-
prerelease: false
|
150
|
-
version_requirements: !ruby/object:Gem::Requirement
|
151
|
-
requirements:
|
152
|
-
- - "~>"
|
153
|
-
- !ruby/object:Gem::Version
|
154
|
-
version: '0.1'
|
155
71
|
description:
|
156
72
|
email:
|
157
73
|
executables: []
|
@@ -187,14 +103,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
103
|
requirements:
|
188
104
|
- - ">="
|
189
105
|
- !ruby/object:Gem::Version
|
190
|
-
version: '
|
106
|
+
version: '3.0'
|
191
107
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
108
|
requirements:
|
193
109
|
- - ">="
|
194
110
|
- !ruby/object:Gem::Version
|
195
111
|
version: '0'
|
196
112
|
requirements: []
|
197
|
-
rubygems_version: 3.4.
|
113
|
+
rubygems_version: 3.4.22
|
198
114
|
signing_key:
|
199
115
|
specification_version: 4
|
200
116
|
summary: An implementation of the Rack protocol/specification.
|
metadata.gz.sig
CHANGED
@@ -1 +1,6 @@
|
|
1
|
-
|
1
|
+
��aH)�6m��������k+�?k}��錸DA�*������P��f��@`��@�T��1l�`|{�;�㣉�m�l��A���`q�l���d���Y�W��e|Ӕ
|
2
|
+
����T�Y������mv!���8t���QY�8��Q��q�K��@�##�"�>|�
|
3
|
+
w� �s7���xZc$0nT��^�/5"h�i1�h"I�h�7�.ژ�}h. |U
|
4
|
+
msUe��mG�ʎ��c�_�$lG)EV��xw��E
|
5
|
+
��Z5U�V�5z�~TS(��~@��ܒ:�$�ۤ��7�+�T%�1$K2l�p���
|
6
|
+
1"š&��qf�t�
|