httpx 1.3.1 → 1.3.2

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: 0162427fe818aafee88a35a12a821cf4f1016701f4513835c91556a7e8579e9e
4
- data.tar.gz: f559d77efcdbf0e557c28c9a012cb67f45a95de8f8c2fac521800679ea30dc31
3
+ metadata.gz: e417c7a6d7564807d040374d9174d5b1fd3945ce924062397fdc0ad95d12bd31
4
+ data.tar.gz: bf001578d74624abc4d05e74563c2d9a5388cbd6315cd29fb0cf176d2e4e01e2
5
5
  SHA512:
6
- metadata.gz: 1dd2fa825bdaef26137e8c5d993dcb426eab7897adc8570a343863e7842f3732948bdc827c58e1e361bb35b2c1d549b02d89051a592a836a51f39afb95a77263
7
- data.tar.gz: 8a64f6fc512fd8fa60d7feeffff6447d3c8a4081fe6494873b4a527f425dad090ca84b810a2a91477b051a4dfeb0bbb12e0563ef37c20e8d5daab05f2a208138
6
+ metadata.gz: dc88e4afa96c336a79ba37e6fb35521cc189db0e2981bad0d5354253f2f55e320e951656da4cc59ad5baab709ef933ed98c52ff12b116c2a9021d039e42e3db8
7
+ data.tar.gz: 2cbdcc54076a34b66a413b6aa380a25e3243cedd98882774ac02fc3f345178197b01097b2b615bf174d0e0affe1b9d4dd03881305b7c16c33183dc77c27f1f9d
@@ -0,0 +1,6 @@
1
+ # 1.3.2
2
+
3
+ ## Bugfixes
4
+
5
+ * Prevent `NoMethodError` in an edge case when the `:proxy` plugin is autoloaded via env vars and webmock adapter are used in tandem, and a real request fails.
6
+ * raise invalid uri error if passed request uri does not contain the host part (ex: `"https:/get"`)
@@ -20,7 +20,7 @@ module WebMock
20
20
  WebMock::RequestSignature.new(
21
21
  request.verb.downcase.to_sym,
22
22
  uri.to_s,
23
- body: request.body.each.to_a.join,
23
+ body: request.body,
24
24
  headers: request.headers.to_h
25
25
  )
26
26
  end
@@ -166,6 +166,8 @@ module HTTPX
166
166
  response = super
167
167
 
168
168
  if response.is_a?(ErrorResponse) && proxy_error?(request, response)
169
+ return response unless @_proxy_uris
170
+
169
171
  @_proxy_uris.shift
170
172
 
171
173
  # return last error response if no more proxies to try
data/lib/httpx/request.rb CHANGED
@@ -83,7 +83,7 @@ module HTTPX
83
83
 
84
84
  @options = @body.options
85
85
 
86
- if @uri.relative?
86
+ if @uri.relative? || @uri.host.nil?
87
87
  origin = @options.origin
88
88
  raise(Error, "invalid URI: #{@uri}") unless origin
89
89
 
@@ -3,7 +3,7 @@
3
3
  require_relative "session"
4
4
  module HTTPX
5
5
  class Session
6
- def initialize(options = EMPTY_HASH, &blk)
6
+ def initialize(options = EMPTY, &blk)
7
7
  @options = self.class.default_options.merge(options)
8
8
  @responses = {}
9
9
  @persistent = @options.persistent
@@ -13,6 +13,8 @@ module HTTPX::Transcoder
13
13
 
14
14
  def_delegator :@raw, :to_s
15
15
 
16
+ def_delegator :@raw, :==
17
+
16
18
  def initialize(body)
17
19
  @raw = body
18
20
  end
@@ -20,6 +20,8 @@ module HTTPX
20
20
 
21
21
  def_delegator :@raw, :bytesize
22
22
 
23
+ def_delegator :@raw, :==
24
+
23
25
  def initialize(form)
24
26
  @raw = form.each_with_object("".b) do |(key, val), buf|
25
27
  HTTPX::Transcoder.normalize_keys(key, val) do |k, v|
@@ -15,6 +15,8 @@ module HTTPX::Transcoder
15
15
 
16
16
  def_delegator :@raw, :bytesize
17
17
 
18
+ def_delegator :@raw, :==
19
+
18
20
  def initialize(json)
19
21
  @raw = JSON.json_dump(json)
20
22
  @charset = @raw.encoding.name.downcase
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "1.3.1"
4
+ VERSION = "1.3.2"
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: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-20 00:00:00.000000000 Z
11
+ date: 2024-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2
@@ -146,6 +146,7 @@ extra_rdoc_files:
146
146
  - doc/release_notes/1_2_6.md
147
147
  - doc/release_notes/1_3_0.md
148
148
  - doc/release_notes/1_3_1.md
149
+ - doc/release_notes/1_3_2.md
149
150
  files:
150
151
  - LICENSE.txt
151
152
  - README.md
@@ -263,6 +264,7 @@ files:
263
264
  - doc/release_notes/1_2_6.md
264
265
  - doc/release_notes/1_3_0.md
265
266
  - doc/release_notes/1_3_1.md
267
+ - doc/release_notes/1_3_2.md
266
268
  - lib/httpx.rb
267
269
  - lib/httpx/adapters/datadog.rb
268
270
  - lib/httpx/adapters/faraday.rb
@@ -335,7 +337,6 @@ files:
335
337
  - lib/httpx/plugins/webdav.rb
336
338
  - lib/httpx/pmatch_extensions.rb
337
339
  - lib/httpx/pool.rb
338
- - lib/httpx/pool/synch_pool.rb
339
340
  - lib/httpx/punycode.rb
340
341
  - lib/httpx/request.rb
341
342
  - lib/httpx/request/body.rb
@@ -480,7 +481,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
480
481
  - !ruby/object:Gem::Version
481
482
  version: '0'
482
483
  requirements: []
483
- rubygems_version: 3.4.10
484
+ rubygems_version: 3.5.3
484
485
  signing_key:
485
486
  specification_version: 4
486
487
  summary: HTTPX, to the future, and beyond
@@ -1,93 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "thread"
4
-
5
- module HTTPX
6
- class SynchPool < Pool
7
- def initialize(options)
8
- super
9
-
10
- @connections = ConnectionStore.new(options)
11
- end
12
-
13
- # TODO: #wrap
14
- def find_or_new_connection(uri, options, &blk)
15
- @connections.find_or_new(uri, options) do |new_conn|
16
- catch(:coalesced) do
17
- init_connection(new_conn, options)
18
- blk.call(new_conn) if blk
19
- new_conn
20
- end
21
- end
22
- find_connection(uri, options) || new_connection(uri, options, &blk)
23
- end
24
-
25
- class ConnectionManager
26
- include Enumerable
27
-
28
- def initialize(limit = 3)
29
- @connections = []
30
- @used = 0
31
- @limit = limit
32
- end
33
-
34
- def each(*args, &blk)
35
- @connections.each(*args, &blk)
36
- end
37
-
38
- def find_or_new(uri, options, &blk)
39
- raise "over limit" if @used >= @limit
40
-
41
- @used += 1
42
- conn = @connections.find do |connection|
43
- connection.match?(uri, options)
44
- end
45
-
46
- if conn
47
- @connections.delete(conn)
48
- else
49
- conn = options.connection_class.new(uri, options)
50
- blk[conn]
51
- end
52
-
53
- conn
54
- end
55
- end
56
-
57
- class ConnectionStore
58
- include Enumerable
59
-
60
- def initialize(options)
61
- @connections = Hash.new { |hs, k| hs[k] ||= ConnectionManager.new }
62
- @conn_mtx = Thread::Mutex.new
63
- @conn_waiter = ConditionVariable.new
64
- @timeout = Float(options.fetch(:pool_timeout, 5))
65
- end
66
-
67
- def each(&block)
68
- return enum_for(__meth__) unless block
69
-
70
- @conn_mtx.synchronize do
71
- @connections.each_value do |conns|
72
- conns.each(&block)
73
- end
74
- end
75
- end
76
-
77
- def find_or_new(uri, options, &blk)
78
- @connections[uri.origin].find_or_new(uri, options, &blk)
79
- end
80
-
81
- # def <<(conn)
82
- # @conn_mtx.synchronize do
83
- # origin, conns = @connections.find { |_orig, _| conn.origins.include?(origin) }
84
- # (conns || @connections[conn.origin.to_s]) << conn
85
- # end
86
- # end
87
-
88
- def empty?
89
- @conn_mtx.synchronize { super }
90
- end
91
- end
92
- end
93
- end