httpx 1.1.3 → 1.1.4

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: 88e35920c570a12032835c1c67c9ffde6119b0f5e26e357ba58dbe385e1483a5
4
- data.tar.gz: e421a0532b92e6a1e689c1d907ef0b87d98e6589093d791ce9a905d475b0c638
3
+ metadata.gz: d8999f3068b60027a01d29f4d840ff77828a151eaf377bec3959c26fcc0b2e25
4
+ data.tar.gz: cb1490afe5522a3c77c0a1f5ef44267d60d7e23993718c58f18525e971bf70d9
5
5
  SHA512:
6
- metadata.gz: e01adb8c3974497b091c72d8b9848dd02973c19924c910be4649f83c3430b579a6ea0889f0f27a348cabbddd6ed56cc1b682be0ae984b4dd0ef5dbf76543ba8e
7
- data.tar.gz: 343ace24f2a3be6ce420b4c5f8fbe919ad84dabdc8f3b97bbafc3bda8466fef6dfa48a1985478fd7ec6056678818a60b9cfb158f4423569086f42d4c27c696f6
6
+ metadata.gz: 5d29a339eb2781a8d8c1ff9b3c95f03717034eb32210639e355f8687129d80b614290d699d00e6bd5781998f14564a8dec4e1750545841e30dd53eaba58d3a9c
7
+ data.tar.gz: d9e0dd9966132648aa4ded10fe71cb94496337328575d0c99d6b861536401820c354742d5a923d79e2a7eff77a8649e7f1630e7c895e6f14fdbcf6e5e48bd828
@@ -1,4 +1,4 @@
1
- # 1.1.2
1
+ # 1.1.3
2
2
 
3
3
  ## improvements
4
4
 
@@ -0,0 +1,6 @@
1
+ # 1.1.4
2
+
3
+ ## bug reports
4
+
5
+ * datadog adapter: use `Gem::Version` to invoke the correct configuration API.
6
+ * stream plugin: do not preempt request enqueuing (this was making integration with the `:follow_redirects` plugin fail when set up with `webmock`).
@@ -126,7 +126,7 @@ module Datadog::Tracing
126
126
  option :distributed_tracing, default: true
127
127
  option :split_by_domain, default: false
128
128
 
129
- if DDTrace::VERSION::STRING >= "1.13.0"
129
+ if Gem::Version.new(DDTrace::VERSION::STRING) >= Gem::Version.new("1.13.0")
130
130
  option :enabled do |o|
131
131
  o.type :bool
132
132
  o.env "DD_TRACE_HTTPX_ENABLED"
@@ -182,12 +182,12 @@ module Datadog::Tracing
182
182
 
183
183
  option :distributed_tracing, default: true
184
184
 
185
- if DDTrace::VERSION::STRING >= "1.15.0"
185
+ if Gem::Version.new(DDTrace::VERSION::STRING) >= Gem::Version.new("1.15.0")
186
186
  option :error_handler do |o|
187
187
  o.type :proc
188
188
  o.default_proc(&DEFAULT_ERROR_HANDLER)
189
189
  end
190
- elsif DDTrace::VERSION::STRING >= "1.13.0"
190
+ elsif Gem::Version.new(DDTrace::VERSION::STRING) >= Gem::Version.new("1.13.0")
191
191
  option :error_handler do |o|
192
192
  o.type :proc
193
193
  o.experimental_default_proc(&DEFAULT_ERROR_HANDLER)
@@ -7,7 +7,7 @@ module HTTPX
7
7
  # the HTTP Authorization header, and another, +bearer_auth+, which fill the "Bearer " prefix
8
8
  # in its value.
9
9
  #
10
- # https://gitlab.com/os85/httpx/wikis/Auth#authorization
10
+ # https://gitlab.com/os85/httpx/wikis/Auth#auth
11
11
  #
12
12
  module Auth
13
13
  module InstanceMethods
@@ -5,7 +5,7 @@ module HTTPX
5
5
  #
6
6
  # This plugin adds helper methods to implement HTTP Basic Auth (https://tools.ietf.org/html/rfc7617)
7
7
  #
8
- # https://gitlab.com/os85/httpx/wikis/Authorization#basic-auth
8
+ # https://gitlab.com/os85/httpx/wikis/Auth#basic-auth
9
9
  #
10
10
  module BasicAuth
11
11
  class << self
@@ -5,7 +5,7 @@ module HTTPX
5
5
  #
6
6
  # This plugin adds helper methods to implement HTTP Digest Auth (https://tools.ietf.org/html/rfc7616)
7
7
  #
8
- # https://gitlab.com/os85/httpx/wikis/Authorization#digest-auth
8
+ # https://gitlab.com/os85/httpx/wikis/Auth#digest-auth
9
9
  #
10
10
  module DigestAuth
11
11
  DigestError = Class.new(Error)
@@ -36,7 +36,6 @@ module HTTPX
36
36
 
37
37
  class Inflater
38
38
  def initialize(response)
39
- @encodings = response.headers.get("grpc-encoding")
40
39
  @response = response
41
40
  end
42
41
 
@@ -49,7 +48,7 @@ module HTTPX
49
48
  encoded_data = message.byteslice(5..size + 5 - 1)
50
49
 
51
50
  if compressed == 1
52
- @encodings.reverse_each do |encoding|
51
+ grpc_encodings.reverse_each do |encoding|
53
52
  decoder = @response.body.class.initialize_inflater_by_encoding(encoding, @response, bytesize: encoded_data.bytesize)
54
53
  encoded_data = decoder.call(encoded_data)
55
54
 
@@ -68,6 +67,12 @@ module HTTPX
68
67
 
69
68
  data
70
69
  end
70
+
71
+ private
72
+
73
+ def grpc_encodings
74
+ @grpc_encodings ||= @response.headers.get("grpc-encoding")
75
+ end
71
76
  end
72
77
 
73
78
  def self.encode(*args, **kwargs)
@@ -215,7 +215,7 @@ module HTTPX
215
215
  **opts)
216
216
  grpc_request = build_grpc_request(rpc_method, input, deadline: deadline, metadata: metadata, **opts)
217
217
  response = request(grpc_request, **opts)
218
- response.raise_for_status
218
+ response.raise_for_status unless opts[:stream]
219
219
  GRPC::Call.new(response)
220
220
  end
221
221
 
@@ -3,7 +3,7 @@
3
3
  module HTTPX
4
4
  module Plugins
5
5
  #
6
- # https://gitlab.com/os85/httpx/wikis/Authorization#ntlm-auth
6
+ # https://gitlab.com/os85/httpx/wikis/Auth#ntlm-auth
7
7
  #
8
8
  module NTLMAuth
9
9
  class << self
@@ -2,10 +2,9 @@
2
2
 
3
3
  module HTTPX
4
4
  class StreamResponse
5
- def initialize(request, session, connections)
5
+ def initialize(request, session)
6
6
  @request = request
7
7
  @session = session
8
- @connections = connections
9
8
  end
10
9
 
11
10
  def each(&block)
@@ -16,19 +15,9 @@ module HTTPX
16
15
  begin
17
16
  @on_chunk = block
18
17
 
19
- if @request.response
20
- # if we've already started collecting the payload, yield it first
21
- # before proceeding
22
- body = @request.response.body
23
-
24
- body.each do |chunk|
25
- on_chunk(chunk)
26
- end
27
- end
28
-
29
18
  response.raise_for_status
30
- response.close
31
19
  ensure
20
+ response.close if @response
32
21
  @on_chunk = nil
33
22
  end
34
23
  end
@@ -69,9 +58,9 @@ module HTTPX
69
58
  private
70
59
 
71
60
  def response
72
- @session.__send__(:receive_requests, [@request], @connections) until @request.response
73
-
74
- @request.response
61
+ @response ||= begin
62
+ @request.response || @session.request(@request)
63
+ end
75
64
  end
76
65
 
77
66
  def respond_to_missing?(meth, *args)
@@ -105,9 +94,7 @@ module HTTPX
105
94
 
106
95
  request = requests.first
107
96
 
108
- connections = _send_requests(requests)
109
-
110
- StreamResponse.new(request, self, connections)
97
+ StreamResponse.new(request, self)
111
98
  end
112
99
  end
113
100
 
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.1.3"
4
+ VERSION = "1.1.4"
5
5
  end
@@ -21,11 +21,15 @@ module HTTPX
21
21
 
22
22
  class Inflater
23
23
  @response: Response
24
- @encodings: Array[String]
24
+ @grpc_encodings: Array[String]
25
25
 
26
26
  def initialize: (Response | StreamResponse response) -> void
27
27
 
28
28
  def call: (String message) ?{ (String) -> void } -> String
29
+
30
+ private
31
+
32
+ def grpc_encodings: () -> Array[String]
29
33
  end
30
34
 
31
35
  end
@@ -2,6 +2,10 @@ module HTTPX
2
2
  class StreamResponse
3
3
  include _ToS
4
4
 
5
+ @request: Request & RequestMethods
6
+ @session: sessionStream
7
+ @on_chunk: ^(String) -> void | nil
8
+
5
9
  def each: () { (String) -> void } -> void
6
10
  | () -> Enumerable[String]
7
11
 
@@ -10,10 +14,11 @@ module HTTPX
10
14
 
11
15
  def on_chunk: (string) -> void
12
16
 
17
+ def initialize: (Request, Session) -> void
18
+
13
19
  private
14
20
 
15
21
  def response: () -> response
16
- def initialize: (Request, Session, Array[Connection]) -> untyped
17
22
  end
18
23
 
19
24
  module Plugins
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.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tiago Cardoso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
11
+ date: 2023-11-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -135,6 +135,7 @@ extra_rdoc_files:
135
135
  - doc/release_notes/1_1_1.md
136
136
  - doc/release_notes/1_1_2.md
137
137
  - doc/release_notes/1_1_3.md
138
+ - doc/release_notes/1_1_4.md
138
139
  files:
139
140
  - LICENSE.txt
140
141
  - README.md
@@ -241,6 +242,7 @@ files:
241
242
  - doc/release_notes/1_1_1.md
242
243
  - doc/release_notes/1_1_2.md
243
244
  - doc/release_notes/1_1_3.md
245
+ - doc/release_notes/1_1_4.md
244
246
  - lib/httpx.rb
245
247
  - lib/httpx/adapters/datadog.rb
246
248
  - lib/httpx/adapters/faraday.rb