async-http 0.56.5 → 0.56.6
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/async/http/client.rb +42 -0
- data/lib/async/http/endpoint.rb +2 -2
- data/lib/async/http/protocol/http1/client.rb +1 -0
- data/lib/async/http/protocol/http2/stream.rb +3 -10
- data/lib/async/http/relative_location.rb +3 -3
- data/lib/async/http/server.rb +40 -1
- data/lib/async/http/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +72 -15
- metadata.gz.sig +4 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8a62982c0ca9bd57cf326b34e0f697a6fac7af99de50cf98fe36b7cc93fb4cd
|
4
|
+
data.tar.gz: 16e52379346b1d2e7a9ad115c1859c8c8ba3c3e229e2f1a6385eaf9f5477ca12
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0d95e9e50f34b39a8725ef5cef5b8affb7a3feee22eda029e5c064ca7afd254aa77d2ce5fba65d0a8903e8c65875a6e3756fa98a204725f322a2e2c3fb0c570
|
7
|
+
data.tar.gz: 71c38354bd9ce92fb507bd7e36b0e557fb7073eeb30fcbba1c44511ac1d9cf96d5ca6e0c8556e86b036b4dc53fb3fd394eaf7975f16b8509e50cbdd58c1de399
|
checksums.yaml.gz.sig
ADDED
Binary file
|
data/lib/async/http/client.rb
CHANGED
@@ -28,6 +28,8 @@ require 'async/pool/controller'
|
|
28
28
|
require 'protocol/http/body/completable'
|
29
29
|
require 'protocol/http/methods'
|
30
30
|
|
31
|
+
require 'traces/provider'
|
32
|
+
|
31
33
|
require_relative 'protocol'
|
32
34
|
|
33
35
|
module Async
|
@@ -136,6 +138,46 @@ module Async
|
|
136
138
|
@pool.release(connection) if connection
|
137
139
|
end
|
138
140
|
end
|
141
|
+
|
142
|
+
def inspect
|
143
|
+
"#<#{self.class} authority=#{@authority.inspect}>"
|
144
|
+
end
|
145
|
+
|
146
|
+
Traces::Provider(self) do
|
147
|
+
def call(request)
|
148
|
+
attributes = {
|
149
|
+
'http.method': request.method,
|
150
|
+
'http.authority': request.authority || self.authority,
|
151
|
+
'http.scheme': request.scheme || self.scheme,
|
152
|
+
'http.path': request.path,
|
153
|
+
}
|
154
|
+
|
155
|
+
if protocol = request.protocol
|
156
|
+
attributes['http.protocol'] = protocol
|
157
|
+
end
|
158
|
+
|
159
|
+
if length = request.body&.length
|
160
|
+
attributes['http.request.length'] = length
|
161
|
+
end
|
162
|
+
|
163
|
+
trace('async.http.client.call', attributes: attributes) do |span|
|
164
|
+
if context = trace_context(span)
|
165
|
+
request.headers['traceparent'] = context.to_s
|
166
|
+
# request.headers['tracestate'] = context.state
|
167
|
+
end
|
168
|
+
|
169
|
+
super.tap do |response|
|
170
|
+
if status = response&.status
|
171
|
+
span['http.status_code'] = status
|
172
|
+
end
|
173
|
+
|
174
|
+
if length = response.body&.length
|
175
|
+
span['http.response.length'] = length
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
139
181
|
|
140
182
|
protected
|
141
183
|
|
data/lib/async/http/endpoint.rb
CHANGED
@@ -43,7 +43,7 @@ module Async
|
|
43
43
|
uri_klass = URI.scheme_list[scheme.upcase] || URI::HTTP
|
44
44
|
|
45
45
|
self.new(
|
46
|
-
uri_klass.new(scheme, nil, hostname, nil, nil, nil, nil, nil, nil),
|
46
|
+
uri_klass.new(scheme, nil, hostname, nil, nil, nil, nil, nil, nil).normalize,
|
47
47
|
**options
|
48
48
|
)
|
49
49
|
end
|
@@ -241,4 +241,4 @@ module Async
|
|
241
241
|
end
|
242
242
|
end
|
243
243
|
end
|
244
|
-
end
|
244
|
+
end
|
@@ -34,6 +34,7 @@ module Async
|
|
34
34
|
|
35
35
|
Console.logger.debug(self) {"#{request.method} #{request.path} #{request.headers.inspect}"}
|
36
36
|
|
37
|
+
# Mark the start of the trailers:
|
37
38
|
trailer = request.headers.trailer!
|
38
39
|
|
39
40
|
# We carefully interpret https://tools.ietf.org/html/rfc7230#section-6.3.1 to implement this correctly.
|
@@ -34,7 +34,6 @@ module Async
|
|
34
34
|
super
|
35
35
|
|
36
36
|
@headers = nil
|
37
|
-
@trailer = nil
|
38
37
|
|
39
38
|
# Input buffer, reading request body, or response body (receive_data):
|
40
39
|
@length = nil
|
@@ -62,11 +61,7 @@ module Async
|
|
62
61
|
|
63
62
|
def receive_trailing_headers(headers, end_stream)
|
64
63
|
headers.each do |key, value|
|
65
|
-
|
66
|
-
add_header(key, value)
|
67
|
-
else
|
68
|
-
raise ::Protocol::HTTP2::HeaderError, "Cannot add trailer #{key} as it was not specified as a trailer!"
|
69
|
-
end
|
64
|
+
add_header(key, value)
|
70
65
|
end
|
71
66
|
end
|
72
67
|
|
@@ -74,9 +69,7 @@ module Async
|
|
74
69
|
if @headers.nil?
|
75
70
|
@headers = ::Protocol::HTTP::Headers.new
|
76
71
|
self.receive_initial_headers(super, frame.end_stream?)
|
77
|
-
|
78
|
-
@trailer = @headers[TRAILER]
|
79
|
-
elsif @trailer and frame.end_stream?
|
72
|
+
elsif frame.end_stream?
|
80
73
|
self.receive_trailing_headers(super, frame.end_stream?)
|
81
74
|
else
|
82
75
|
raise ::Protocol::HTTP2::HeaderError, "Unable to process headers!"
|
@@ -152,7 +145,7 @@ module Async
|
|
152
145
|
send_reset_stream(::Protocol::HTTP2::Error::INTERNAL_ERROR)
|
153
146
|
else
|
154
147
|
# Write trailer?
|
155
|
-
if trailer
|
148
|
+
if trailer&.any?
|
156
149
|
send_headers(nil, trailer, ::Protocol::HTTP2::END_STREAM)
|
157
150
|
else
|
158
151
|
send_data(nil, ::Protocol::HTTP2::END_STREAM)
|
@@ -28,11 +28,11 @@ module Async
|
|
28
28
|
module HTTP
|
29
29
|
class TooManyRedirects < StandardError
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# A client wrapper which transparently handles both relative and absolute redirects to a given maximum number of hops.
|
33
33
|
class RelativeLocation < ::Protocol::HTTP::Middleware
|
34
34
|
DEFAULT_METHOD = GET
|
35
|
-
|
35
|
+
|
36
36
|
# maximum_hops is the max number of redirects. Set to 0 to allow 1 request with no redirects.
|
37
37
|
def initialize(app, maximum_hops = 3)
|
38
38
|
super(app)
|
@@ -51,7 +51,7 @@ module Async
|
|
51
51
|
|
52
52
|
while hops <= @maximum_hops
|
53
53
|
response = super(request)
|
54
|
-
|
54
|
+
|
55
55
|
if response.redirection?
|
56
56
|
hops += 1
|
57
57
|
response.finish
|
data/lib/async/http/server.rb
CHANGED
@@ -23,9 +23,12 @@
|
|
23
23
|
require 'async/io/endpoint'
|
24
24
|
require 'async/io/stream'
|
25
25
|
|
26
|
-
require_relative 'protocol'
|
27
26
|
require 'protocol/http/middleware'
|
28
27
|
|
28
|
+
require 'traces/provider'
|
29
|
+
|
30
|
+
require_relative 'protocol'
|
31
|
+
|
29
32
|
module Async
|
30
33
|
module HTTP
|
31
34
|
class Server < ::Protocol::HTTP::Middleware
|
@@ -70,6 +73,42 @@ module Async
|
|
70
73
|
def run
|
71
74
|
@endpoint.accept(&self.method(:accept))
|
72
75
|
end
|
76
|
+
|
77
|
+
Traces::Provider(self) do
|
78
|
+
def call(request)
|
79
|
+
if trace_parent = request.headers['traceparent']
|
80
|
+
self.trace_context = Traces::Context.parse(trace_parent.join, request.headers['tracestate'], remote: true)
|
81
|
+
end
|
82
|
+
|
83
|
+
attributes = {
|
84
|
+
'http.method': request.method,
|
85
|
+
'http.authority': request.authority,
|
86
|
+
'http.scheme': request.scheme,
|
87
|
+
'http.path': request.path,
|
88
|
+
'http.user_agent': request.headers['user-agent'],
|
89
|
+
}
|
90
|
+
|
91
|
+
if length = request.body&.length
|
92
|
+
attributes['http.request.length'] = length
|
93
|
+
end
|
94
|
+
|
95
|
+
if protocol = request.protocol
|
96
|
+
attributes['http.protocol'] = protocol
|
97
|
+
end
|
98
|
+
|
99
|
+
trace('async.http.server.call', attributes: attributes) do |span|
|
100
|
+
super.tap do |response|
|
101
|
+
if status = response&.status
|
102
|
+
span['http.status_code'] = status
|
103
|
+
end
|
104
|
+
|
105
|
+
if length = response&.body&.length
|
106
|
+
span['http.response.length'] = length
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
73
112
|
end
|
74
113
|
end
|
75
114
|
end
|
data/lib/async/http/version.rb
CHANGED
data.tar.gz.sig
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: async-http
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.56.
|
4
|
+
version: 0.56.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Williams
|
8
|
+
- Brian Morearty
|
9
|
+
- Bruno Sutic
|
10
|
+
- Janko Marohnić
|
11
|
+
- Adam Daniels
|
12
|
+
- Cyril Roelandt
|
13
|
+
- Denis Talakevich
|
14
|
+
- Ian Ker-Seymer
|
15
|
+
- Igor Sidorov
|
16
|
+
- Marco Concetto Rudilosso
|
17
|
+
- Olle Jonsson
|
18
|
+
- Orgad Shaneh
|
19
|
+
- Stefan Wrobel
|
20
|
+
- TheAthlete
|
21
|
+
- Trevor Turk
|
22
|
+
- samshadwell
|
8
23
|
autorequire:
|
9
24
|
bindir: bin
|
10
|
-
cert_chain:
|
11
|
-
|
25
|
+
cert_chain:
|
26
|
+
- |
|
27
|
+
-----BEGIN CERTIFICATE-----
|
28
|
+
MIIEhDCCAuygAwIBAgIBATANBgkqhkiG9w0BAQsFADA3MTUwMwYDVQQDDCxzYW11
|
29
|
+
ZWwud2lsbGlhbXMvREM9b3Jpb250cmFuc2Zlci9EQz1jby9EQz1uejAeFw0yMTA4
|
30
|
+
MTYwNjMzNDRaFw0yMjA4MTYwNjMzNDRaMDcxNTAzBgNVBAMML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g4VWO5ZU7z2JmPoTXZtYMunRAmQPFL/gSUc6aK
|
46
|
+
vszMHIyhtyzRc6DnfW2AiVOjMBjaYv8xXZc9bduniRVPrLR4J7ozmGLh4o4uJp7w
|
47
|
+
x9KCFaR8Lvn/r0oJWJOqb/DMAYI83YeN2Dlt3jpwrsmsONrtC5S3gOUle5afSGos
|
48
|
+
bYt5ocnEpKSomR9ZtnCGljds/aeO1Xgpn2r9HHcjwnH346iNrnHmMlC7BtHUFPDg
|
49
|
+
Ts92S47PTOXzwPBDsrFiq3VLbRjHSwf8rpqybQBH9MfzxGGxTaETQYOd6b4e4Ag6
|
50
|
+
y92abGna0bmIEb4+Tx9rQ10Uijh1POzvr/VTH4bbIPy9FbKrRsIQ24qDbNJRtOpE
|
51
|
+
RAOsIl+HOBTb252nx1kIRN5hqQx272AJCbCjKx8egcUQKffFVVCI0nye09v5CK+a
|
52
|
+
HiLJ8VOFx6w=
|
53
|
+
-----END CERTIFICATE-----
|
54
|
+
date: 2022-05-02 00:00:00.000000000 Z
|
12
55
|
dependencies:
|
13
56
|
- !ruby/object:Gem::Dependency
|
14
57
|
name: async
|
@@ -94,6 +137,20 @@ dependencies:
|
|
94
137
|
- - "~>"
|
95
138
|
- !ruby/object:Gem::Version
|
96
139
|
version: 0.14.0
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: traces
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: 0.4.0
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: 0.4.0
|
97
154
|
- !ruby/object:Gem::Dependency
|
98
155
|
name: async-container
|
99
156
|
requirement: !ruby/object:Gem::Requirement
|
@@ -137,7 +194,7 @@ dependencies:
|
|
137
194
|
- !ruby/object:Gem::Version
|
138
195
|
version: '0'
|
139
196
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
197
|
+
name: localhost
|
141
198
|
requirement: !ruby/object:Gem::Requirement
|
142
199
|
requirements:
|
143
200
|
- - ">="
|
@@ -151,33 +208,33 @@ dependencies:
|
|
151
208
|
- !ruby/object:Gem::Version
|
152
209
|
version: '0'
|
153
210
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
211
|
+
name: rack-test
|
155
212
|
requirement: !ruby/object:Gem::Requirement
|
156
213
|
requirements:
|
157
|
-
- - "
|
214
|
+
- - ">="
|
158
215
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
216
|
+
version: '0'
|
160
217
|
type: :development
|
161
218
|
prerelease: false
|
162
219
|
version_requirements: !ruby/object:Gem::Requirement
|
163
220
|
requirements:
|
164
|
-
- - "
|
221
|
+
- - ">="
|
165
222
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
223
|
+
version: '0'
|
167
224
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
225
|
+
name: rspec
|
169
226
|
requirement: !ruby/object:Gem::Requirement
|
170
227
|
requirements:
|
171
|
-
- - "
|
228
|
+
- - "~>"
|
172
229
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
230
|
+
version: '3.6'
|
174
231
|
type: :development
|
175
232
|
prerelease: false
|
176
233
|
version_requirements: !ruby/object:Gem::Requirement
|
177
234
|
requirements:
|
178
|
-
- - "
|
235
|
+
- - "~>"
|
179
236
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
237
|
+
version: '3.6'
|
181
238
|
description:
|
182
239
|
email:
|
183
240
|
executables: []
|
@@ -244,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
244
301
|
- !ruby/object:Gem::Version
|
245
302
|
version: '0'
|
246
303
|
requirements: []
|
247
|
-
rubygems_version: 3.
|
304
|
+
rubygems_version: 3.3.7
|
248
305
|
signing_key:
|
249
306
|
specification_version: 4
|
250
307
|
summary: A HTTP client and server library.
|
metadata.gz.sig
ADDED
@@ -0,0 +1,4 @@
|
|
1
|
+
��Ը�|D|�,�:���l&�l�^� f�ȿ,���������
|
2
|
+
�g�z��*0��o�ñ7ym�L̅���iʦ��0Nx�
|
3
|
+
�H�1H�w����^}Pg"�B�B�l8�,m#k�Ixù:z�Iݽ�ZhPw{����E�����M�kl F��3A�L�uf�vω�[/�%B����������q��}�a��D�����ϒ���X�n<�m�ܐp���hѶWdZc.g�[Pڛ��z:���ɰ~k=�'~�O��=w�8��P�B�DrF5 �S�&� ���?�뮝�����Ŗ�����h���j��6t���t���oDw����V�?L|��X��M��
|
4
|
+
��)���SXE'@�iJ�U�7l\wgwHkQފ��e�]�
|