async-http 0.70.0 → 0.72.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f049c61bc6afdaebb893a682209ac35e761efa9a4ef6aea5759e276153a4da80
4
- data.tar.gz: 0334a7f914b12caafa97e7ab00ea3e02845c8451c52c159bbd625ecc9a8f9d51
3
+ metadata.gz: 8b358f54acd8cf0943e35f30865d7f505025bad37a2c37e0dda5f8438efe3b25
4
+ data.tar.gz: a8a9eee82cc0723cf8101ef727072d4518a38ddb7e68f5f0f2d15027e92e83a9
5
5
  SHA512:
6
- metadata.gz: 93188a2d18c3991ac8e1b7306dc26ea552b7094b1683c3c6434ee2b76951c4fa725a280438026cd410ccd1229efd36bbf337173241688e61552a8c9c23f5d07c
7
- data.tar.gz: e0cc2b44db653d9770facff7958a512bb56da5483b07348bc12af17b76fec7cfc22e95a2d3d5fdcb608edac47591304c04e6ab558e5ae07fff816d125d3e0379
6
+ metadata.gz: 7f5720d8ac42c48afb19bd5c387db2da015b2d210836c6d1a7abfe3cd3a4df85587c92b9bbdee61fce397302c66c8ca303c123d9e7f9a2201b26602ea0240e58
7
+ data.tar.gz: 91a543963515d1375953da096781b7b9d5a161e20bafc6aa067fbf0e09ff546ae3b48e18a5d8ca06dc5173184546898d415310b6bfbded5605040bce08443010
checksums.yaml.gz.sig CHANGED
Binary file
@@ -165,6 +165,10 @@ module Async
165
165
  end
166
166
 
167
167
  super.tap do |response|
168
+ if version = response&.version
169
+ span['http.version'] = version
170
+ end
171
+
168
172
  if status = response&.status
169
173
  span['http.status_code'] = status
170
174
  end
@@ -62,7 +62,7 @@ module Async
62
62
  # @option hostname [String] the hostname to connect to (or bind to), overrides the URL hostname (used for SNI).
63
63
  # @option port [Integer] the port to bind to, overrides the URL port.
64
64
  # @option ssl_context [OpenSSL::SSL::SSLContext] the context to use for TLS.
65
- # @option alpn_protocols [Array<String>] the alpn protocols to negotiate.
65
+ # @option alpn_protocols [Array(String)] the alpn protocols to negotiate.
66
66
  def initialize(url, endpoint = nil, **options)
67
67
  super(**options)
68
68
 
@@ -1,8 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
5
- # Copyright, 2019-2020, by Brian Morearty.
4
+ # Copyright, 2024, by Samuel Williams.
6
5
 
7
6
  require_relative '../reference'
8
7
 
@@ -82,17 +81,7 @@ module Async
82
81
  # We don't want to follow redirects for HEAD requests:
83
82
  return super if request.head?
84
83
 
85
- if body = request.body
86
- if body.respond_to?(:rewind)
87
- # The request body was already rewindable, so use it as is:
88
- body = request.body
89
- else
90
- # The request body was not rewindable, and we might need to resubmit it if we get a response status of 307 or 308, so make it rewindable:
91
- body = ::Protocol::HTTP::Body::Rewindable.new(body)
92
- request.body = body
93
- end
94
- end
95
-
84
+ body = ::Protocol::HTTP::Body::Rewindable.wrap(request)
96
85
  hops = 0
97
86
 
98
87
  while hops <= @maximum_hops
@@ -141,4 +130,4 @@ module Async
141
130
  end
142
131
  end
143
132
  end
144
- end
133
+ end
@@ -7,6 +7,7 @@
7
7
  # Copyright, 2024, by Anton Zhuravsky.
8
8
 
9
9
  require_relative 'connection'
10
+ require 'console/event/failure'
10
11
 
11
12
  module Async
12
13
  module HTTP
@@ -17,8 +18,9 @@ module Async
17
18
  @persistent = false
18
19
  write_response(@version, status, {})
19
20
  write_body(@version, nil)
20
- rescue Errno::ECONNRESET, Errno::EPIPE
21
- # Nothing we can do...
21
+ rescue => error
22
+ # At this point, there is very little we can do to recover:
23
+ Console::Event::Failure.for(error).emit(self, "Failed to write failure response.", severity: :debug)
22
24
  end
23
25
 
24
26
  def next_request
@@ -33,13 +35,9 @@ module Async
33
35
  end
34
36
 
35
37
  return request
36
- rescue Async::TimeoutError
37
- # For an interesting discussion about this behaviour, see https://trac.nginx.org/nginx/ticket/1005
38
- # If you enable this, you will see some spec failures...
39
- # fail_request(408)
40
- raise
41
- rescue
38
+ rescue ::Protocol::HTTP1::BadRequest
42
39
  fail_request(400)
40
+ # Conceivably we could retry here, but we don't really know how bad the error is, so it's better to just fail:
43
41
  raise
44
42
  end
45
43
 
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  # Released under the MIT License.
4
- # Copyright, 2018-2023, by Samuel Williams.
4
+ # Copyright, 2018-2024, by Samuel Williams.
5
5
  # Copyright, 2019-2020, by Brian Morearty.
6
6
 
7
7
  require_relative 'middleware/location_redirector'
@@ -81,6 +81,7 @@ module Async
81
81
  end
82
82
 
83
83
  attributes = {
84
+ 'http.version': request.version,
84
85
  'http.method': request.method,
85
86
  'http.authority': request.authority,
86
87
  'http.scheme': request.scheme,
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Async
7
7
  module HTTP
8
- VERSION = "0.70.0"
8
+ VERSION = "0.72.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -12,6 +12,14 @@ Please see the [project documentation](https://socketry.github.io/async-http/) f
12
12
 
13
13
  - [Testing](https://socketry.github.io/async-http/guides/testing/index) - This guide explains how to use `Async::HTTP` clients and servers in your tests.
14
14
 
15
+ ## See Also
16
+
17
+ - [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency.
18
+ - [falcon](https://github.com/socketry/falcon) — A rack compatible server built on top of `async-http`.
19
+ - [async-websocket](https://github.com/socketry/async-websocket) — Asynchronous client and server websockets.
20
+ - [async-rest](https://github.com/socketry/async-rest) — A RESTful resource layer built on top of `async-http`.
21
+ - [async-http-faraday](https://github.com/socketry/async-http-faraday) — A faraday adapter to use `async-http`.
22
+
15
23
  ## Contributing
16
24
 
17
25
  We welcome contributions to this project.
@@ -22,14 +30,6 @@ We welcome contributions to this project.
22
30
  4. Push to the branch (`git push origin my-new-feature`).
23
31
  5. Create new Pull Request.
24
32
 
25
- ## See Also
26
-
27
- - [benchmark-http](https://github.com/socketry/benchmark-http) — A benchmarking tool to report on web server concurrency.
28
- - [falcon](https://github.com/socketry/falcon) — A rack compatible server built on top of `async-http`.
29
- - [async-websocket](https://github.com/socketry/async-websocket) — Asynchronous client and server websockets.
30
- - [async-rest](https://github.com/socketry/async-rest) — A RESTful resource layer built on top of `async-http`.
31
- - [async-http-faraday](https://github.com/socketry/async-http-faraday) — A faraday adapter to use `async-http`.
32
-
33
33
  ### Developer Certificate of Origin
34
34
 
35
35
  In order to protect users of this project, we require all contributors to comply with the [Developer Certificate of Origin](https://developercertificate.org/). This ensures that all contributions are properly licensed and attributed.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.70.0
4
+ version: 0.72.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -58,7 +58,7 @@ cert_chain:
58
58
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
59
59
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
60
60
  -----END CERTIFICATE-----
61
- date: 2024-08-14 00:00:00.000000000 Z
61
+ date: 2024-08-29 00:00:00.000000000 Z
62
62
  dependencies:
63
63
  - !ruby/object:Gem::Dependency
64
64
  name: async
@@ -122,28 +122,28 @@ dependencies:
122
122
  requirements:
123
123
  - - "~>"
124
124
  - !ruby/object:Gem::Version
125
- version: '0.28'
125
+ version: '0.29'
126
126
  type: :runtime
127
127
  prerelease: false
128
128
  version_requirements: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - - "~>"
131
131
  - !ruby/object:Gem::Version
132
- version: '0.28'
132
+ version: '0.29'
133
133
  - !ruby/object:Gem::Dependency
134
134
  name: protocol-http1
135
135
  requirement: !ruby/object:Gem::Requirement
136
136
  requirements:
137
137
  - - "~>"
138
138
  - !ruby/object:Gem::Version
139
- version: '0.19'
139
+ version: '0.20'
140
140
  type: :runtime
141
141
  prerelease: false
142
142
  version_requirements: !ruby/object:Gem::Requirement
143
143
  requirements:
144
144
  - - "~>"
145
145
  - !ruby/object:Gem::Version
146
- version: '0.19'
146
+ version: '0.20'
147
147
  - !ruby/object:Gem::Dependency
148
148
  name: protocol-http2
149
149
  requirement: !ruby/object:Gem::Requirement
metadata.gz.sig CHANGED
Binary file