httpx 1.7.1 → 1.7.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 +4 -4
- data/doc/release_notes/1_7_2.md +6 -0
- data/lib/httpx/plugins/auth.rb +21 -2
- data/lib/httpx/plugins/ntlm_auth.rb +1 -1
- data/lib/httpx/plugins/stream_bidi.rb +11 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/plugins/auth.rbs +6 -0
- data/sig/plugins/stream_bidi.rbs +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c67e4695d8ef368321f14a3c113daad0e49280413e3da42272644ad84fe6f622
|
|
4
|
+
data.tar.gz: 62bb1ab9d91ca69c9b1fa561051ffb0ed137afb53e0b40f71cfd477a84a78773
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 266576dae6b8ed604228b464281239b760df9682d27e9010b18ac7dbab4fb00f23115e5bcae1a0ecee6b191ee03a0eca758c37f8f0baee0e2ad9df5ca0c7eff6
|
|
7
|
+
data.tar.gz: e355df3c634811d0d8e08bcb10b661a4f486073e6ca808ca3af3585a4d014cd404c8d7a55e38d0d05419f205d9dc81a54fb5a17eab7e1716c38c160297963e0f
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# 1.7.2
|
|
2
|
+
|
|
3
|
+
## Bugfixes
|
|
4
|
+
|
|
5
|
+
* `:stream_bidi` plugin: when used with the `:retries` plugin, it will skip calling callbacks referencing state from the connection/stream the request was moved from.
|
|
6
|
+
* `:auth` plugin: fix issue causing tokens to be concatenated on non-auth errors.
|
data/lib/httpx/plugins/auth.rb
CHANGED
|
@@ -69,7 +69,7 @@ module HTTPX
|
|
|
69
69
|
private
|
|
70
70
|
|
|
71
71
|
def send_request(request, *)
|
|
72
|
-
return super if @skip_auth_header_value
|
|
72
|
+
return super if @skip_auth_header_value || request.authorized?
|
|
73
73
|
|
|
74
74
|
@auth_header_value ||= generate_auth_token
|
|
75
75
|
|
|
@@ -92,12 +92,31 @@ module HTTPX
|
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
module RequestMethods
|
|
95
|
+
def initialize(*)
|
|
96
|
+
super
|
|
97
|
+
@auth_token_value = nil
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def authorized?
|
|
101
|
+
!@auth_token_value.nil?
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def unauthorize!
|
|
105
|
+
return unless (auth_value = @auth_token_value)
|
|
106
|
+
|
|
107
|
+
@headers.get("authorization").delete(auth_value)
|
|
108
|
+
|
|
109
|
+
@auth_token_value = nil
|
|
110
|
+
end
|
|
111
|
+
|
|
95
112
|
def authorize(auth_value)
|
|
96
113
|
if (auth_type = @options.auth_header_type)
|
|
97
114
|
auth_value = "#{auth_type} #{auth_value}"
|
|
98
115
|
end
|
|
99
116
|
|
|
100
117
|
@headers.add("authorization", auth_value)
|
|
118
|
+
|
|
119
|
+
@auth_token_value = auth_value
|
|
101
120
|
end
|
|
102
121
|
end
|
|
103
122
|
|
|
@@ -119,7 +138,7 @@ module HTTPX
|
|
|
119
138
|
return unless auth_error?(response, request.options) ||
|
|
120
139
|
(@options.generate_auth_value_on_retry && @options.generate_auth_value_on_retry.call(response))
|
|
121
140
|
|
|
122
|
-
request.
|
|
141
|
+
request.unauthorize!
|
|
123
142
|
@auth_header_value = generate_auth_token
|
|
124
143
|
end
|
|
125
144
|
|
|
@@ -46,7 +46,7 @@ module HTTPX
|
|
|
46
46
|
|
|
47
47
|
if probe_response.status == 401 && ntlm.can_authenticate?(probe_response.headers["www-authenticate"])
|
|
48
48
|
request.transition(:idle)
|
|
49
|
-
request.
|
|
49
|
+
request.unauthorize!
|
|
50
50
|
request.authorize(ntlm.authenticate(request, probe_response.headers["www-authenticate"]).encode("utf-8"))
|
|
51
51
|
super(request)
|
|
52
52
|
else
|
|
@@ -61,7 +61,7 @@ module HTTPX
|
|
|
61
61
|
def handle_stream(stream, request)
|
|
62
62
|
return super unless @options.stream
|
|
63
63
|
|
|
64
|
-
request.
|
|
64
|
+
request.flush_buffer_on_body do
|
|
65
65
|
next unless request.headers_sent
|
|
66
66
|
|
|
67
67
|
handle(request, stream)
|
|
@@ -254,9 +254,14 @@ module HTTPX
|
|
|
254
254
|
super
|
|
255
255
|
@headers_sent = false
|
|
256
256
|
@closed = false
|
|
257
|
+
@flush_buffer_on_body_cb = nil
|
|
257
258
|
@mutex = Thread::Mutex.new
|
|
258
259
|
end
|
|
259
260
|
|
|
261
|
+
def flush_buffer_on_body(&cb)
|
|
262
|
+
@flush_buffer_on_body_cb = on(:body, &cb)
|
|
263
|
+
end
|
|
264
|
+
|
|
260
265
|
def closed?
|
|
261
266
|
return super unless @options.stream
|
|
262
267
|
|
|
@@ -280,6 +285,11 @@ module HTTPX
|
|
|
280
285
|
case nextstate
|
|
281
286
|
when :idle
|
|
282
287
|
headers_sent = false
|
|
288
|
+
|
|
289
|
+
if @flush_buffer_on_body_cb
|
|
290
|
+
callbacks(:body).delete(@flush_buffer_on_body_cb)
|
|
291
|
+
@flush_buffer_on_body_cb = nil
|
|
292
|
+
end
|
|
283
293
|
when :waiting_for_chunk
|
|
284
294
|
return unless @state == :body
|
|
285
295
|
when :body
|
data/lib/httpx/version.rb
CHANGED
data/sig/plugins/auth.rbs
CHANGED
data/sig/plugins/stream_bidi.rbs
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: httpx
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.7.
|
|
4
|
+
version: 1.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tiago Cardoso
|
|
@@ -161,6 +161,7 @@ extra_rdoc_files:
|
|
|
161
161
|
- doc/release_notes/1_6_3.md
|
|
162
162
|
- doc/release_notes/1_7_0.md
|
|
163
163
|
- doc/release_notes/1_7_1.md
|
|
164
|
+
- doc/release_notes/1_7_2.md
|
|
164
165
|
files:
|
|
165
166
|
- LICENSE.txt
|
|
166
167
|
- README.md
|
|
@@ -294,6 +295,7 @@ files:
|
|
|
294
295
|
- doc/release_notes/1_6_3.md
|
|
295
296
|
- doc/release_notes/1_7_0.md
|
|
296
297
|
- doc/release_notes/1_7_1.md
|
|
298
|
+
- doc/release_notes/1_7_2.md
|
|
297
299
|
- lib/httpx.rb
|
|
298
300
|
- lib/httpx/adapters/datadog.rb
|
|
299
301
|
- lib/httpx/adapters/faraday.rb
|