httpx 0.14.4 → 0.14.5
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/0_14_5.md +11 -0
- data/lib/httpx/connection.rb +2 -0
- data/lib/httpx/connection/http1.rb +3 -1
- data/lib/httpx/plugins/ntlm_authentication.rb +64 -0
- data/lib/httpx/version.rb +1 -1
- data/sig/plugins/ntlm_authentication.rbs +27 -0
- metadata +43 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 16f2f2bc0c8dfff4c7a92bc573f25e717a703f06fa8f336bde41bd60ad86ad87
|
4
|
+
data.tar.gz: 313f1fe9ec2c3d5a04f838c36d6ceee6982c60e3b4d6646644428f0c5c6d1d74
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6780278b2b12254fe0f1a884a78d7e102e965d2d5f93b7431a2239e5b2d5e8c25e6e122715af89b03e786ba752b265d53d94d1f3a66cac7fe2a26299ff25491d
|
7
|
+
data.tar.gz: e85a43e840647f60a721481e112c8b8672f3f478d4bacdae6337c52beca5e3a198e2e9f0206592ecb111dfd0b5be33addf2f2e930255750ed89f145631f8d66c
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# 0.14.5
|
2
|
+
|
3
|
+
## Bugfixes
|
4
|
+
|
5
|
+
* After a connection had been initiated, sending multiple concurrent requests (ex: `open_httpx.request(req1, req2, req3)`) could freeze; this happened when the first request would fill the write buffer (like a file upload request), and the subsequent requests would never be buffered afterwards; this was fixed by making pending requests flushing a part of a connection's consumption loop.
|
6
|
+
* Fixing v0.14.1's fixed bug again; The HTTP/1 "Connection: close" header was not being set in the last possible request on a connection, due to ann off-by-one error on connection bookkeeping;
|
7
|
+
* HTTP/1 connections didn't respect a server-set max nunmber of requests after a reconnect; Fixed by making this accounting part of the reset process;
|
8
|
+
|
9
|
+
## Chore
|
10
|
+
|
11
|
+
* Added regression test suite, which reproduce reported bugs before the fix (backported all 0.14.x releases here)
|
data/lib/httpx/connection.rb
CHANGED
@@ -40,6 +40,7 @@ module HTTPX
|
|
40
40
|
def reset
|
41
41
|
@max_requests = @options.max_requests || MAX_REQUESTS
|
42
42
|
@parser.reset!
|
43
|
+
@handshake_completed = false
|
43
44
|
end
|
44
45
|
|
45
46
|
def close
|
@@ -260,7 +261,8 @@ module HTTPX
|
|
260
261
|
|
261
262
|
requests_limit = [@max_requests, @requests.size].min
|
262
263
|
|
263
|
-
connection = if request
|
264
|
+
connection = if request != @requests[requests_limit - 1] &&
|
265
|
+
request.options.persistent && @max_requests != 1
|
264
266
|
"keep-alive"
|
265
267
|
else
|
266
268
|
"close"
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HTTPX
|
4
|
+
module Plugins
|
5
|
+
#
|
6
|
+
# https://gitlab.com/honeyryderchuck/httpx/wikis/Authentication#ntlm-authentication
|
7
|
+
#
|
8
|
+
module NTLMAuthentication
|
9
|
+
NTLMParams = Struct.new(:user, :domain, :password)
|
10
|
+
|
11
|
+
class << self
|
12
|
+
def load_dependencies(_klass)
|
13
|
+
require "base64"
|
14
|
+
require "ntlm"
|
15
|
+
end
|
16
|
+
|
17
|
+
def configure(klass)
|
18
|
+
klass.plugin(:authentication)
|
19
|
+
end
|
20
|
+
|
21
|
+
def extra_options(options)
|
22
|
+
Class.new(options.class) do
|
23
|
+
def_option(:ntlm, <<-OUT)
|
24
|
+
raise Error, ":ntlm must be a #{NTLMParams}" unless value.is_a?(#{NTLMParams})
|
25
|
+
|
26
|
+
value
|
27
|
+
OUT
|
28
|
+
end.new(options).merge(max_concurrent_requests: 1)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
module InstanceMethods
|
33
|
+
def ntlm_authentication(user, password, domain = nil)
|
34
|
+
with(ntlm: NTLMParams.new(user, domain, password))
|
35
|
+
end
|
36
|
+
|
37
|
+
alias_method :ntlm_auth, :ntlm_authentication
|
38
|
+
|
39
|
+
def request(*args, **options)
|
40
|
+
requests = build_requests(*args, options)
|
41
|
+
request = requests.first
|
42
|
+
ntlm = request.options.ntlm
|
43
|
+
|
44
|
+
return super(*requests, **options) unless ntlm
|
45
|
+
|
46
|
+
request.headers["authorization"] = "NTLM #{NTLM.negotiate(domain: ntlm.domain).to_base64}"
|
47
|
+
probe_response = wrap { send_requests(*request, options).first }
|
48
|
+
|
49
|
+
return probe_response unless probe_response.status == 401 && probe_response.headers.key?("www-authenticate") &&
|
50
|
+
(challenge = probe_response.headers["www-authenticate"][/NTLM (.*)/, 1])
|
51
|
+
|
52
|
+
challenge = Base64.decode64(challenge)
|
53
|
+
ntlm_challenge = NTLM.authenticate(challenge, ntlm.user, ntlm.domain, ntlm.password).to_base64
|
54
|
+
|
55
|
+
request.transition(:idle)
|
56
|
+
|
57
|
+
request.headers["authorization"] = "NTLM #{ntlm_challenge}"
|
58
|
+
super(request, **options)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
register_plugin :ntlm_authentication, NTLMAuthentication
|
63
|
+
end
|
64
|
+
end
|
data/lib/httpx/version.rb
CHANGED
@@ -0,0 +1,27 @@
|
|
1
|
+
module HTTPX
|
2
|
+
module Plugins
|
3
|
+
module NTLMAuthentication
|
4
|
+
|
5
|
+
interface _NTLMOptions
|
6
|
+
def ntlm: () -> NTLMParams?
|
7
|
+
def ntlm=: (NTLMParams) -> NTLMParams
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.extra_options: (Options) -> (Options & _NTLMOptions)
|
11
|
+
|
12
|
+
def self.load_dependencies: (*untyped) -> void
|
13
|
+
|
14
|
+
module InstanceMethods
|
15
|
+
def ntlm_authentication: (string user, string password, ?string? domain) -> instance
|
16
|
+
end
|
17
|
+
|
18
|
+
class NTLMParams
|
19
|
+
attr_reader user: String
|
20
|
+
attr_reader password: String
|
21
|
+
attr_reader domain: String?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
type sessionNTLMAuthentication = Plugins::sessionAuthentication & Plugins::NTLMAuthentication::InstanceMethods
|
26
|
+
end
|
27
|
+
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.14.
|
4
|
+
version: 0.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Cardoso
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-06-
|
11
|
+
date: 2021-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -47,48 +47,49 @@ extra_rdoc_files:
|
|
47
47
|
- LICENSE.txt
|
48
48
|
- README.md
|
49
49
|
- doc/release_notes/0_0_1.md
|
50
|
-
- doc/release_notes/
|
51
|
-
- doc/release_notes/
|
52
|
-
- doc/release_notes/0_0_4.md
|
50
|
+
- doc/release_notes/0_14_5.md
|
51
|
+
- doc/release_notes/0_1_0.md
|
53
52
|
- doc/release_notes/0_0_5.md
|
54
|
-
- doc/release_notes/
|
55
|
-
- doc/release_notes/
|
56
|
-
- doc/release_notes/
|
57
|
-
- doc/release_notes/
|
58
|
-
- doc/release_notes/
|
53
|
+
- doc/release_notes/0_14_1.md
|
54
|
+
- doc/release_notes/0_0_4.md
|
55
|
+
- doc/release_notes/0_14_0.md
|
56
|
+
- doc/release_notes/0_14_4.md
|
57
|
+
- doc/release_notes/0_6_5.md
|
58
|
+
- doc/release_notes/0_13_0.md
|
59
|
+
- doc/release_notes/0_6_1.md
|
59
60
|
- doc/release_notes/0_11_2.md
|
61
|
+
- doc/release_notes/0_7_0.md
|
62
|
+
- doc/release_notes/0_6_0.md
|
63
|
+
- doc/release_notes/0_10_2.md
|
60
64
|
- doc/release_notes/0_11_3.md
|
61
|
-
- doc/release_notes/
|
62
|
-
- doc/release_notes/
|
65
|
+
- doc/release_notes/0_8_2.md
|
66
|
+
- doc/release_notes/0_6_4.md
|
63
67
|
- doc/release_notes/0_13_1.md
|
68
|
+
- doc/release_notes/0_12_0.md
|
69
|
+
- doc/release_notes/0_9_0.md
|
70
|
+
- doc/release_notes/0_6_3.md
|
71
|
+
- doc/release_notes/0_10_1.md
|
72
|
+
- doc/release_notes/0_11_0.md
|
73
|
+
- doc/release_notes/0_8_1.md
|
74
|
+
- doc/release_notes/0_5_0.md
|
75
|
+
- doc/release_notes/0_6_7.md
|
64
76
|
- doc/release_notes/0_13_2.md
|
65
|
-
- doc/release_notes/0_14_0.md
|
66
|
-
- doc/release_notes/0_14_1.md
|
67
|
-
- doc/release_notes/0_14_2.md
|
68
|
-
- doc/release_notes/0_14_3.md
|
69
|
-
- doc/release_notes/0_14_4.md
|
70
|
-
- doc/release_notes/0_1_0.md
|
71
|
-
- doc/release_notes/0_2_0.md
|
72
|
-
- doc/release_notes/0_2_1.md
|
73
|
-
- doc/release_notes/0_3_0.md
|
74
|
-
- doc/release_notes/0_3_1.md
|
75
|
-
- doc/release_notes/0_4_0.md
|
76
77
|
- doc/release_notes/0_4_1.md
|
77
|
-
- doc/release_notes/0_5_0.md
|
78
78
|
- doc/release_notes/0_5_1.md
|
79
|
-
- doc/release_notes/0_6_0.md
|
80
|
-
- doc/release_notes/0_6_1.md
|
81
|
-
- doc/release_notes/0_6_2.md
|
82
|
-
- doc/release_notes/0_6_3.md
|
83
|
-
- doc/release_notes/0_6_4.md
|
84
|
-
- doc/release_notes/0_6_5.md
|
85
79
|
- doc/release_notes/0_6_6.md
|
86
|
-
- doc/release_notes/
|
87
|
-
- doc/release_notes/
|
80
|
+
- doc/release_notes/0_4_0.md
|
81
|
+
- doc/release_notes/0_6_2.md
|
82
|
+
- doc/release_notes/0_10_0.md
|
83
|
+
- doc/release_notes/0_11_1.md
|
88
84
|
- doc/release_notes/0_8_0.md
|
89
|
-
- doc/release_notes/
|
90
|
-
- doc/release_notes/
|
91
|
-
- doc/release_notes/
|
85
|
+
- doc/release_notes/0_3_0.md
|
86
|
+
- doc/release_notes/0_14_3.md
|
87
|
+
- doc/release_notes/0_2_1.md
|
88
|
+
- doc/release_notes/0_0_3.md
|
89
|
+
- doc/release_notes/0_0_2.md
|
90
|
+
- doc/release_notes/0_3_1.md
|
91
|
+
- doc/release_notes/0_14_2.md
|
92
|
+
- doc/release_notes/0_2_0.md
|
92
93
|
files:
|
93
94
|
- LICENSE.txt
|
94
95
|
- README.md
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- doc/release_notes/0_14_2.md
|
114
115
|
- doc/release_notes/0_14_3.md
|
115
116
|
- doc/release_notes/0_14_4.md
|
117
|
+
- doc/release_notes/0_14_5.md
|
116
118
|
- doc/release_notes/0_1_0.md
|
117
119
|
- doc/release_notes/0_2_0.md
|
118
120
|
- doc/release_notes/0_2_1.md
|
@@ -187,6 +189,7 @@ files:
|
|
187
189
|
- lib/httpx/plugins/multipart/encoder.rb
|
188
190
|
- lib/httpx/plugins/multipart/mime_type_detector.rb
|
189
191
|
- lib/httpx/plugins/multipart/part.rb
|
192
|
+
- lib/httpx/plugins/ntlm_authentication.rb
|
190
193
|
- lib/httpx/plugins/persistent.rb
|
191
194
|
- lib/httpx/plugins/proxy.rb
|
192
195
|
- lib/httpx/plugins/proxy/http.rb
|
@@ -246,6 +249,7 @@ files:
|
|
246
249
|
- sig/plugins/follow_redirects.rbs
|
247
250
|
- sig/plugins/h2c.rbs
|
248
251
|
- sig/plugins/multipart.rbs
|
252
|
+
- sig/plugins/ntlm_authentication.rbs
|
249
253
|
- sig/plugins/persistent.rbs
|
250
254
|
- sig/plugins/proxy.rbs
|
251
255
|
- sig/plugins/proxy/http.rbs
|
@@ -281,7 +285,7 @@ metadata:
|
|
281
285
|
changelog_uri: https://honeyryderchuck.gitlab.io/httpx/#release-notes
|
282
286
|
documentation_uri: https://honeyryderchuck.gitlab.io/httpx/rdoc/
|
283
287
|
source_code_uri: https://gitlab.com/honeyryderchuck/httpx
|
284
|
-
post_install_message:
|
288
|
+
post_install_message:
|
285
289
|
rdoc_options: []
|
286
290
|
require_paths:
|
287
291
|
- lib
|
@@ -296,8 +300,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
296
300
|
- !ruby/object:Gem::Version
|
297
301
|
version: '0'
|
298
302
|
requirements: []
|
299
|
-
rubygems_version: 3.
|
300
|
-
signing_key:
|
303
|
+
rubygems_version: 3.0.3
|
304
|
+
signing_key:
|
301
305
|
specification_version: 4
|
302
306
|
summary: HTTPX, to the future, and beyond
|
303
307
|
test_files: []
|