protocol-rack 0.2.6 → 0.3.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: 33a02fca6186127b6390f9189b87c312dd05ec7b3351ad31ca75698a30c82097
4
- data.tar.gz: d58cafc1f71296ed6d68bf09ceeaf945d8ba1785f701623b0139d8f81adb553d
3
+ metadata.gz: 7dae79721011ba76b6565ae1e575bc39a2675906d8d7779030874b3da925c8a5
4
+ data.tar.gz: a8d80d07330a9f17a4d346b3e134187d63153becbbfb05ae2cd403b347e6ad26
5
5
  SHA512:
6
- metadata.gz: 6460132af99298b1cfb02635af9874050cf6c95c11083a1c6dd5ea884fbe1940d0f3efcea0bfcdbe2040023795bb6ca40046fea8149e55f8c03ca73a76227371
7
- data.tar.gz: 05ee66f991ad3cd77b4e0937100523c346f2af359ad310591c15286ebccdbad3c01effdb7d79a049aa5f548e595f2c941e69c802e7ed550c75602acf0f48e910
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
 
@@ -126,7 +126,6 @@ module Protocol
126
126
 
127
127
  if protocol = response.protocol
128
128
  headers['rack.protocol'] = protocol
129
- # headers['upgrade'] = protocol
130
129
  end
131
130
 
132
131
  if body = response.body and body.stream?
@@ -11,6 +11,7 @@ module Protocol
11
11
  # CGI keys <https://tools.ietf.org/html/rfc3875#section-4.1>:
12
12
  module CGI
13
13
  HTTP_HOST = 'HTTP_HOST'
14
+ HTTP_UPGRADE = "HTTP_UPGRADE"
14
15
  PATH_INFO = 'PATH_INFO'
15
16
  REQUEST_METHOD = 'REQUEST_METHOD'
16
17
  REQUEST_PATH = 'REQUEST_PATH'
@@ -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
  # Copyright, 2023, by Genki Takiuchi.
6
6
 
7
7
  require 'async/io/buffer'
@@ -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
@@ -1,10 +1,10 @@
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
  module Protocol
7
7
  module Rack
8
- VERSION = "0.2.6"
8
+ VERSION = "0.3.0"
9
9
  end
10
10
  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.2.6
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-06-11 00:00:00.000000000 Z
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: '2.5'
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.7
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,2 +1,6 @@
1
- \�IH���;�jV�%FX�7���o-&�.3�Kl�6*@��11���{;�d�u;���bw��'��|i�ԟ�%��4cWۼ�9)��1,T
2
- ��|��Ie���frcs�H��+�ȵv-ymB��(Q �؅*�K����X��gg%�"!=�>9���Ē
1
+ ��aH)�6m��������k+�?k}��錸DA�*������P��f��@`��@�T��1l�`|{�;�㣉�m�l��A���`ql���d���YW��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�