httpx 0.18.4 → 0.18.5

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: 4c6e05e5bda153614ac00aac76cdaff0d5d727c58a99fb2297c545aa54b27c0e
4
- data.tar.gz: 9d682e4136c3e8a3d769e02f96209a72dadbb5722a01d4ec8267cec06b5f1a3a
3
+ metadata.gz: 843e16ae32c900167850fe3a864446af2cd6b6a9d3ca6368f64b999964a1a5b2
4
+ data.tar.gz: 533464195c08ab7e0ba2e5aa7871fdf8b59e59643122ca48ce5e7cf8a6ebb351
5
5
  SHA512:
6
- metadata.gz: f2549dd8e2b9786dfb6916f88bd9979e06fc32806a09ead664f97d67612eb3d4b182e4a48d1b23f037e899ecda50ad36b343e85e97258fd3ecb730f63238417e
7
- data.tar.gz: f0388924dfba2717069b9cea8463e658d6262c6bfb874185c60baaab1650055fe4a98acd9fa39a6a060f00aa0aa05f1345d627bac138ecf5e17ad4d8aacd92b2
6
+ metadata.gz: 6e170cf6a47bce0a1eeeea25c53870615958f77e2fe9eb9b4176783b860bc26c8d45712e0ad758ba2481bd2712a21bb14d10a32fb5f17871a9421413edf162ac
7
+ data.tar.gz: ae5a0bc77a54cf66528dfd89c7127b5ce64730be6fc0fe8be6d79966dfa36e2e04b348f39e1e91d3b457e34c35f8b3a33e18bc656f7823874ffbaedc72e3b8ad
@@ -4,4 +4,4 @@
4
4
 
5
5
  * request bodies eager-loaded from enumerables yield duped partial chunks.
6
6
 
7
- An error was observed while looking at webmock integration, where requests formed via the multipart plugin where returning an empty string as body. The issue was caused by an optimization on multipart encoder, which reuses the same buffer when reading chunks. Unfortunately, these cannot be yielded the same way via IO.copy_stream, as the same (cleared) buffer will be used to generate the eager-loaded body chunks.
7
+ An error was observed while looking at webmock integration, where requests formed via the multipart plugin were returning an empty string as body. The issue was caused by an optimization on multipart encoder, which reuses the same buffer when reading chunks. Unfortunately, these cannot be yielded the same way via IO.copy_stream, as the same (cleared) buffer will be used to generate the eager-loaded body chunks.
@@ -4,11 +4,11 @@
4
4
 
5
5
  * faraday adapter: added support for `#on_data` callback in order to support [faraday streaming](https://lostisland.github.io/faraday/usage/streaming).
6
6
 
7
- * multipart plugin: removed support for file mime type detection using `mime-types`. The reasoning behind it was that `mime-types` uses the filename, which is a very innacurate detection strategy (ex: an mp4 video will be identified as `application/mp4`, instead of the correct `video/mp4`).
7
+ * multipart plugin: removed support for file mime type detection using `mime-types`. The reasoning behind it was that `mime-types` uses the filename, which is a very inaccurate detection strategy (ex: an mp4 video will be identified as `application/mp4`, instead of the correct `video/mp4`).
8
8
  * multipart plugin: supported for file mime type detection using `marcel` and `filemagic` was added. Both use the magic header bytes, which is a more accurate strategy for file type detection.
9
9
 
10
10
  ## Bugfixes
11
11
 
12
12
  * webmock adapter has been reimplemented to work with `httpx` plugins (such as the `:retries` plugin). Some other fixes were applied to make it work better under `vcr` (a common `webmock` extension).
13
13
 
14
- * fixed the URI-related bug which was making requests stall under ruby 3.1 (still not officially testinng against it).
14
+ * fixed the URI-related bug which was making requests stall under ruby 3.1 (still not officially testing against it).
@@ -0,0 +1,10 @@
1
+ # 0.18.5
2
+
3
+ ## Improvements
4
+
5
+ * ruby 3.1 is now officially supported.
6
+ * when user sets a `Host` header for an HTTP/2 request, this will be used in the `:authority` HTTP/2 pseudo-header, instead of silently ignored (mimicking what "curl" does).
7
+
8
+ ## Bugfixes
9
+
10
+ * fixed "throw outside of catch block" error happening when pipelining requests on an HTTP/1 connnection and resulting in a timeout.
@@ -184,7 +184,7 @@ module HTTPX
184
184
  end
185
185
 
186
186
  if @pipelining
187
- disable
187
+ catch(:called) { disable }
188
188
  else
189
189
  @requests.each do |request|
190
190
  emit(:error, request, ex)
@@ -220,6 +220,12 @@ module HTTPX
220
220
 
221
221
  def join_headers(stream, request)
222
222
  extra_headers = set_protocol_headers(request)
223
+
224
+ if request.headers.key?("host")
225
+ log { "forbidden \"host\" header found (#{request.headers["host"]}), will use it as authority..." }
226
+ extra_headers[":authority"] = request.headers["host"]
227
+ end
228
+
223
229
  log(level: 1, color: :yellow) do
224
230
  request.headers.merge(extra_headers).each.map { |k, v| "#{stream.id}: -> HEADER: #{k}: #{v}" }.join("\n")
225
231
  end
@@ -138,10 +138,20 @@ module HTTPX
138
138
  error = response.error
139
139
  case error
140
140
  when NativeResolveError
141
+ return false unless @_proxy_uris && !@_proxy_uris.empty?
142
+
143
+ proxy_uri = URI(@_proxy_uris.first)
144
+
145
+ origin = error.connection.origin
146
+
141
147
  # failed resolving proxy domain
142
- error.connection.origin.to_s == @_proxy_uris.first
148
+ origin.host == proxy_uri.host && origin.port == proxy_uri.port
143
149
  when ResolveError
144
- error.message.end_with?(@_proxy_uris.first)
150
+ return false unless @_proxy_uris && !@_proxy_uris.empty?
151
+
152
+ proxy_uri = URI(@_proxy_uris.first)
153
+
154
+ error.message.end_with?(proxy_uri.to_s)
145
155
  when *PROXY_ERRORS
146
156
  # timeout errors connecting to proxy
147
157
  true
@@ -160,7 +170,9 @@ module HTTPX
160
170
 
161
171
  # redefining the connection origin as the proxy's URI,
162
172
  # as this will be used as the tcp peer ip.
163
- @origin = URI(@options.proxy.uri.origin)
173
+ proxy_uri = URI(@options.proxy.uri)
174
+ @origin.host = proxy_uri.host
175
+ @origin.port = proxy_uri.port
164
176
  end
165
177
 
166
178
  def match?(uri, options)
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.18.4"
4
+ VERSION = "0.18.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: httpx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.4
4
+ version: 0.18.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-12-26 00:00:00.000000000 Z
11
+ date: 2022-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -67,6 +67,7 @@ extra_rdoc_files:
67
67
  - doc/release_notes/0_18_2.md
68
68
  - doc/release_notes/0_18_3.md
69
69
  - doc/release_notes/0_18_4.md
70
+ - doc/release_notes/0_18_5.md
70
71
  - doc/release_notes/0_1_0.md
71
72
  - doc/release_notes/0_2_0.md
72
73
  - doc/release_notes/0_2_1.md
@@ -127,6 +128,7 @@ files:
127
128
  - doc/release_notes/0_18_2.md
128
129
  - doc/release_notes/0_18_3.md
129
130
  - doc/release_notes/0_18_4.md
131
+ - doc/release_notes/0_18_5.md
130
132
  - doc/release_notes/0_1_0.md
131
133
  - doc/release_notes/0_2_0.md
132
134
  - doc/release_notes/0_2_1.md
@@ -324,7 +326,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
324
326
  - !ruby/object:Gem::Version
325
327
  version: '0'
326
328
  requirements: []
327
- rubygems_version: 3.3.3
329
+ rubygems_version: 3.2.32
328
330
  signing_key:
329
331
  specification_version: 4
330
332
  summary: HTTPX, to the future, and beyond