httpx 1.2.4 → 1.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/doc/release_notes/1_2_5.md +7 -0
- data/doc/release_notes/1_2_6.md +13 -0
- data/lib/httpx/adapters/faraday.rb +1 -0
- data/lib/httpx/connection/http1.rb +1 -0
- data/lib/httpx/connection.rb +7 -3
- data/lib/httpx/io/unix.rb +4 -2
- data/lib/httpx/parser/http1.rb +4 -0
- data/lib/httpx/plugins/follow_redirects.rb +30 -9
- data/lib/httpx/plugins/grpc.rb +1 -0
- data/lib/httpx/plugins/rate_limiter.rb +2 -0
- data/lib/httpx/plugins/response_cache.rb +4 -1
- data/lib/httpx/plugins/stream.rb +10 -1
- data/lib/httpx/resolver/native.rb +26 -8
- data/lib/httpx/transcoder/multipart/encoder.rb +1 -1
- data/lib/httpx/version.rb +1 -1
- data/sig/connection/http1.rbs +1 -1
- data/sig/connection/http2.rbs +1 -1
- data/sig/connection.rbs +7 -6
- data/sig/io/ssl.rbs +1 -0
- data/sig/io/tcp.rbs +1 -1
- data/sig/io/unix.rbs +18 -1
- data/sig/options.rbs +4 -1
- data/sig/parser/http1.rbs +1 -1
- data/sig/plugins/callbacks.rbs +1 -1
- data/sig/plugins/follow_redirects.rbs +9 -4
- data/sig/plugins/grpc.rbs +5 -0
- data/sig/plugins/proxy/socks4.rbs +5 -2
- data/sig/plugins/proxy/socks5.rbs +5 -2
- data/sig/plugins/rate_limiter.rbs +1 -1
- data/sig/plugins/retries.rbs +2 -0
- data/sig/resolver/https.rbs +1 -1
- data/sig/resolver/native.rbs +2 -0
- data/sig/session.rbs +1 -1
- data/sig/transcoder/multipart.rbs +11 -6
- data/sig/transcoder/xml.rbs +1 -0
- data/sig/utils.rbs +4 -0
- metadata +7 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0fc8cbe89a9d05f24f615e5de7874c65147954cc8d06524955fea9d0e4ef5598
|
4
|
+
data.tar.gz: e97b5febb579cd1c5e035faef9cf0368ab7148882d2ed95a0454b52fd0d31621
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55631972d465e4ea086dcaced389f7998380f052c369004f45d286d0502c612289dc5a19deff7ca26c9c0cfd6e2c4926ba5e32744c366f18884f97aedb3ad5bf
|
7
|
+
data.tar.gz: 9eb1be90bceb56c335a84b180ae6c7fc065944ae1fd6dab17d9e4802c7fb62c7d3f34d3c98ba41a9cb1b8e503a929eb97cd8a667a9f536090ef266936efb81d9
|
@@ -0,0 +1,7 @@
|
|
1
|
+
# 1.2.5
|
2
|
+
|
3
|
+
## Bugfixes
|
4
|
+
|
5
|
+
* fix for usage of correct `last-modified` header in `response_cache` plugin.
|
6
|
+
* fix usage of decoding helper methods (i.e. `response.json`) with `response_cache` plugin.
|
7
|
+
* `stream` plugin: reverted back to yielding buffered payloads for streamed responses (broke `down` integration)
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# 1.2.6
|
2
|
+
|
3
|
+
## Improvements
|
4
|
+
|
5
|
+
* `native` resolver: when timing out on DNS query for an alias, retry the DNS query for the alias (instead of the original hostname).
|
6
|
+
|
7
|
+
## Bugfixes
|
8
|
+
|
9
|
+
* `faraday` adapter: set `env` options on the request object, so they are available in the request object when yielded.
|
10
|
+
* `follow_redirects` plugin: remove body-related headers (`content-length`, `content-type`) on POST-to-GET redirects.
|
11
|
+
* `follow_redirects` plugin: maintain verb (and body) of original request when the response status code is 307.
|
12
|
+
* `native` resolver: when timing out on TCP-based name resolution, downgrade to UDP before retrying.
|
13
|
+
* `rate_limiter` plugin: do not try fetching the retry-after of error responses.
|
data/lib/httpx/connection.rb
CHANGED
@@ -48,10 +48,10 @@ module HTTPX
|
|
48
48
|
attr_accessor :family
|
49
49
|
|
50
50
|
def initialize(uri, options)
|
51
|
-
@origins = [uri.origin]
|
52
|
-
@origin = Utils.to_uri(uri.origin)
|
53
51
|
@options = Options.new(options)
|
54
52
|
@type = initialize_type(uri, @options)
|
53
|
+
@origins = [uri.origin]
|
54
|
+
@origin = Utils.to_uri(uri.origin)
|
55
55
|
@window_size = @options.window_size
|
56
56
|
@read_buffer = Buffer.new(@options.buffer_size)
|
57
57
|
@write_buffer = Buffer.new(@options.buffer_size)
|
@@ -626,7 +626,11 @@ module HTTPX
|
|
626
626
|
end
|
627
627
|
end
|
628
628
|
when "unix"
|
629
|
-
|
629
|
+
path = Array(addrs).first
|
630
|
+
|
631
|
+
path = String(path) if path
|
632
|
+
|
633
|
+
UNIX.new(@origin, path, @options)
|
630
634
|
else
|
631
635
|
raise Error, "unsupported transport (#{@type})"
|
632
636
|
end
|
data/lib/httpx/io/unix.rb
CHANGED
@@ -8,7 +8,7 @@ module HTTPX
|
|
8
8
|
|
9
9
|
alias_method :host, :path
|
10
10
|
|
11
|
-
def initialize(origin,
|
11
|
+
def initialize(origin, path, options)
|
12
12
|
@addresses = []
|
13
13
|
@hostname = origin.host
|
14
14
|
@state = :idle
|
@@ -26,8 +26,10 @@ module HTTPX
|
|
26
26
|
@path = @io.path
|
27
27
|
@keep_open = true
|
28
28
|
@state = :connected
|
29
|
+
elsif path
|
30
|
+
@path = path
|
29
31
|
else
|
30
|
-
|
32
|
+
raise Error, "No path given where to store the socket"
|
31
33
|
end
|
32
34
|
@io ||= build_socket
|
33
35
|
end
|
data/lib/httpx/parser/http1.rb
CHANGED
@@ -75,6 +75,7 @@ module HTTPX
|
|
75
75
|
buffer = @buffer
|
76
76
|
|
77
77
|
while (idx = buffer.index("\n"))
|
78
|
+
# @type var line: String
|
78
79
|
line = buffer.byteslice(0..idx)
|
79
80
|
raise Error, "wrong header format" if line.start_with?("\s", "\t")
|
80
81
|
|
@@ -101,9 +102,11 @@ module HTTPX
|
|
101
102
|
separator_index = line.index(":")
|
102
103
|
raise Error, "wrong header format" unless separator_index
|
103
104
|
|
105
|
+
# @type var key: String
|
104
106
|
key = line.byteslice(0..(separator_index - 1))
|
105
107
|
|
106
108
|
key.rstrip! # was lstripped previously!
|
109
|
+
# @type var value: String
|
107
110
|
value = line.byteslice((separator_index + 1)..-1)
|
108
111
|
value.strip!
|
109
112
|
raise Error, "wrong header format" if value.nil?
|
@@ -118,6 +121,7 @@ module HTTPX
|
|
118
121
|
@observer.on_data(chunk)
|
119
122
|
end
|
120
123
|
elsif @content_length
|
124
|
+
# @type var data: String
|
121
125
|
data = @buffer.byteslice(0, @content_length)
|
122
126
|
@buffer = @buffer.byteslice(@content_length..-1) || "".b
|
123
127
|
@content_length -= data.bytesize
|
@@ -16,6 +16,7 @@ module HTTPX
|
|
16
16
|
module FollowRedirects
|
17
17
|
MAX_REDIRECTS = 3
|
18
18
|
REDIRECT_STATUS = (300..399).freeze
|
19
|
+
REQUEST_BODY_HEADERS = %w[transfer-encoding content-encoding content-type content-length content-language content-md5 trailer].freeze
|
19
20
|
|
20
21
|
using URIExtensions
|
21
22
|
|
@@ -60,7 +61,6 @@ module HTTPX
|
|
60
61
|
return response unless REDIRECT_STATUS.include?(response.status) && response.headers.key?("location")
|
61
62
|
return response unless max_redirects.positive?
|
62
63
|
|
63
|
-
# build redirect request
|
64
64
|
redirect_uri = __get_location_from_response(response)
|
65
65
|
|
66
66
|
if options.redirect_on
|
@@ -68,24 +68,42 @@ module HTTPX
|
|
68
68
|
return response unless redirect_allowed
|
69
69
|
end
|
70
70
|
|
71
|
+
# build redirect request
|
72
|
+
request_body = redirect_request.body
|
73
|
+
redirect_method = "GET"
|
74
|
+
|
71
75
|
if response.status == 305 && options.respond_to?(:proxy)
|
76
|
+
request_body.rewind
|
72
77
|
# The requested resource MUST be accessed through the proxy given by
|
73
78
|
# the Location field. The Location field gives the URI of the proxy.
|
74
79
|
retry_options = options.merge(headers: redirect_request.headers,
|
75
80
|
proxy: { uri: redirect_uri },
|
76
|
-
body:
|
81
|
+
body: request_body,
|
77
82
|
max_redirects: max_redirects - 1)
|
78
83
|
redirect_uri = redirect_request.uri
|
79
84
|
options = retry_options
|
80
85
|
else
|
81
86
|
redirect_headers = redirect_request_headers(redirect_request.uri, redirect_uri, request.headers, options)
|
82
87
|
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
88
|
+
retry_opts = Hash[options].merge(max_redirects: max_redirects - 1)
|
89
|
+
|
90
|
+
unless request_body.empty?
|
91
|
+
if response.status == 307
|
92
|
+
# The method and the body of the original request are reused to perform the redirected request.
|
93
|
+
redirect_method = redirect_request.verb
|
94
|
+
request_body.rewind
|
95
|
+
retry_opts[:body] = request_body
|
96
|
+
else
|
97
|
+
# redirects are **ALWAYS** GET, so remove body-related headers
|
98
|
+
REQUEST_BODY_HEADERS.each do |h|
|
99
|
+
redirect_headers.delete(h)
|
100
|
+
end
|
101
|
+
retry_opts.delete(:body)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
retry_opts[:headers] = redirect_headers.to_h
|
106
|
+
|
89
107
|
retry_options = options.class.new(retry_opts)
|
90
108
|
end
|
91
109
|
|
@@ -99,7 +117,7 @@ module HTTPX
|
|
99
117
|
return ErrorResponse.new(request, error, options)
|
100
118
|
end
|
101
119
|
|
102
|
-
retry_request = build_request(
|
120
|
+
retry_request = build_request(redirect_method, redirect_uri, retry_options)
|
103
121
|
|
104
122
|
request.redirect_request = retry_request
|
105
123
|
|
@@ -125,6 +143,8 @@ module HTTPX
|
|
125
143
|
end
|
126
144
|
|
127
145
|
def redirect_request_headers(original_uri, redirect_uri, headers, options)
|
146
|
+
headers = headers.dup
|
147
|
+
|
128
148
|
return headers if options.allow_auth_to_other_origins
|
129
149
|
|
130
150
|
return headers unless headers.key?("authorization")
|
@@ -138,6 +158,7 @@ module HTTPX
|
|
138
158
|
end
|
139
159
|
|
140
160
|
def __get_location_from_response(response)
|
161
|
+
# @type var location_uri: http_uri
|
141
162
|
location_uri = URI(response.headers["location"])
|
142
163
|
location_uri = response.uri.merge(location_uri) if location_uri.relative?
|
143
164
|
location_uri
|
data/lib/httpx/plugins/grpc.rb
CHANGED
@@ -40,7 +40,7 @@ module HTTPX
|
|
40
40
|
# the Range and Content-Range headers MUST NOT cache 206 (Partial
|
41
41
|
# Content) responses.
|
42
42
|
response.status != 206 && (
|
43
|
-
response.headers.key?("etag") || response.headers.key?("last-modified
|
43
|
+
response.headers.key?("etag") || response.headers.key?("last-modified") || response.fresh?
|
44
44
|
)
|
45
45
|
end
|
46
46
|
|
@@ -102,6 +102,9 @@ module HTTPX
|
|
102
102
|
|
103
103
|
module ResponseMethods
|
104
104
|
def copy_from_cached(other)
|
105
|
+
# 304 responses do not have content-type, which are needed for decoding.
|
106
|
+
@headers = @headers.class.new(other.headers.merge(@headers))
|
107
|
+
|
105
108
|
@body = other.body.dup
|
106
109
|
|
107
110
|
@body.rewind
|
data/lib/httpx/plugins/stream.rb
CHANGED
@@ -16,9 +16,18 @@ module HTTPX
|
|
16
16
|
begin
|
17
17
|
@on_chunk = block
|
18
18
|
|
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
|
+
|
19
29
|
response.raise_for_status
|
20
30
|
ensure
|
21
|
-
response.close if @response
|
22
31
|
@on_chunk = nil
|
23
32
|
end
|
24
33
|
end
|
@@ -65,6 +65,7 @@ module HTTPX
|
|
65
65
|
if nameserver && @ns_index < nameserver.size
|
66
66
|
log { "resolver: failed resolving on nameserver #{@nameserver[@ns_index - 1]} (#{e.message})" }
|
67
67
|
transition(:idle)
|
68
|
+
@timeouts.clear
|
68
69
|
else
|
69
70
|
handle_error(e)
|
70
71
|
end
|
@@ -143,13 +144,16 @@ module HTTPX
|
|
143
144
|
|
144
145
|
if !@timeouts[host].empty?
|
145
146
|
log { "resolver: timeout after #{timeout}s, retry(#{@timeouts[host].first}) #{host}..." }
|
146
|
-
|
147
|
+
# must downgrade to tcp AND retry on same host as last
|
148
|
+
downgrade_socket
|
149
|
+
resolve(connection, h)
|
147
150
|
elsif @ns_index + 1 < @nameserver.size
|
148
151
|
# try on the next nameserver
|
149
152
|
@ns_index += 1
|
150
153
|
log { "resolver: failed resolving #{host} on nameserver #{@nameserver[@ns_index - 1]} (timeout error)" }
|
151
154
|
transition(:idle)
|
152
|
-
|
155
|
+
@timeouts.clear
|
156
|
+
resolve(connection, h)
|
153
157
|
else
|
154
158
|
|
155
159
|
@timeouts.delete(host)
|
@@ -187,10 +191,9 @@ module HTTPX
|
|
187
191
|
next unless @large_packet.full?
|
188
192
|
|
189
193
|
parse(@large_packet.to_s)
|
190
|
-
@socket_type = @resolver_options.fetch(:socket_type, :udp)
|
191
194
|
@large_packet = nil
|
192
|
-
|
193
|
-
|
195
|
+
# downgrade to udp again
|
196
|
+
downgrade_socket
|
194
197
|
return
|
195
198
|
else
|
196
199
|
size = @read_buffer[0, 2].unpack1("n")
|
@@ -304,13 +307,21 @@ module HTTPX
|
|
304
307
|
end
|
305
308
|
|
306
309
|
if address.key?("alias") # CNAME
|
310
|
+
hostname_alias = address["alias"]
|
307
311
|
# clean up intermediate queries
|
308
312
|
@timeouts.delete(name) unless connection.origin.host == name
|
309
313
|
|
310
|
-
if catch(:coalesced) { early_resolve(connection, hostname:
|
314
|
+
if catch(:coalesced) { early_resolve(connection, hostname: hostname_alias) }
|
311
315
|
@connections.delete(connection)
|
312
316
|
else
|
313
|
-
|
317
|
+
if @socket_type == :tcp
|
318
|
+
# must downgrade to udp if tcp
|
319
|
+
@socket_type = @resolver_options.fetch(:socket_type, :udp)
|
320
|
+
transition(:idle)
|
321
|
+
transition(:open)
|
322
|
+
end
|
323
|
+
log { "resolver: ALIAS #{hostname_alias} for #{name}" }
|
324
|
+
resolve(connection, hostname_alias)
|
314
325
|
return
|
315
326
|
end
|
316
327
|
else
|
@@ -386,6 +397,14 @@ module HTTPX
|
|
386
397
|
end
|
387
398
|
end
|
388
399
|
|
400
|
+
def downgrade_socket
|
401
|
+
return unless @socket_type == :tcp
|
402
|
+
|
403
|
+
@socket_type = @resolver_options.fetch(:socket_type, :udp)
|
404
|
+
transition(:idle)
|
405
|
+
transition(:open)
|
406
|
+
end
|
407
|
+
|
389
408
|
def transition(nextstate)
|
390
409
|
case nextstate
|
391
410
|
when :idle
|
@@ -393,7 +412,6 @@ module HTTPX
|
|
393
412
|
@io.close
|
394
413
|
@io = nil
|
395
414
|
end
|
396
|
-
@timeouts.clear
|
397
415
|
when :open
|
398
416
|
return unless @state == :idle
|
399
417
|
|
data/lib/httpx/version.rb
CHANGED
data/sig/connection/http1.rbs
CHANGED
data/sig/connection/http2.rbs
CHANGED
data/sig/connection.rbs
CHANGED
@@ -20,11 +20,12 @@ module HTTPX
|
|
20
20
|
|
21
21
|
|
22
22
|
attr_reader type: io_type
|
23
|
-
attr_reader origin:
|
23
|
+
attr_reader origin: http_uri
|
24
24
|
attr_reader origins: Array[String]
|
25
25
|
attr_reader state: Symbol
|
26
26
|
attr_reader pending: Array[Request]
|
27
27
|
attr_reader options: Options
|
28
|
+
attr_reader ssl_session: OpenSSL::SSL::Session?
|
28
29
|
attr_writer timers: Timers
|
29
30
|
|
30
31
|
attr_accessor family: Integer?
|
@@ -37,7 +38,7 @@ module HTTPX
|
|
37
38
|
@timeout: Numeric?
|
38
39
|
@current_timeout: Numeric?
|
39
40
|
@io: TCP | SSL | UNIX
|
40
|
-
@parser:
|
41
|
+
@parser: Object & _Parser
|
41
42
|
@connected_at: Float
|
42
43
|
@response_received_at: Float
|
43
44
|
@intervals: Array[Timers::Interval]
|
@@ -92,9 +93,9 @@ module HTTPX
|
|
92
93
|
|
93
94
|
private
|
94
95
|
|
95
|
-
def initialize: (
|
96
|
+
def initialize: (http_uri uri, options) -> void
|
96
97
|
|
97
|
-
def initialize_type: (
|
98
|
+
def initialize_type: (http_uri uri, Options) -> io_type
|
98
99
|
|
99
100
|
def connect: () -> void
|
100
101
|
|
@@ -104,11 +105,11 @@ module HTTPX
|
|
104
105
|
|
105
106
|
def send_pending: () -> void
|
106
107
|
|
107
|
-
def parser: () -> (
|
108
|
+
def parser: () -> (Object & _Parser)
|
108
109
|
|
109
110
|
def send_request_to_parser: (Request request) -> void
|
110
111
|
|
111
|
-
def build_parser: (?String protocol) -> (
|
112
|
+
def build_parser: (?String protocol) -> (Object & _Parser)
|
112
113
|
|
113
114
|
def set_parser_callbacks: (HTTP1 | HTTP2 parser) -> void
|
114
115
|
|
data/sig/io/ssl.rbs
CHANGED
@@ -14,6 +14,7 @@ module HTTPX
|
|
14
14
|
# TODO: lift when https://github.com/ruby/rbs/issues/1497 fixed
|
15
15
|
# def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) ?{ (self) -> void } -> void
|
16
16
|
|
17
|
+
def session_new_cb: { (OpenSSL::SSL::Session sess) -> void } -> void
|
17
18
|
def can_verify_peer?: () -> bool
|
18
19
|
|
19
20
|
def verify_hostname: (String host) -> bool
|
data/sig/io/tcp.rbs
CHANGED
@@ -15,7 +15,7 @@ module HTTPX
|
|
15
15
|
alias host ip
|
16
16
|
|
17
17
|
# TODO: lift when https://github.com/ruby/rbs/issues/1497 fixed
|
18
|
-
def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) ?{ (
|
18
|
+
def initialize: (URI::Generic origin, Array[ipaddr]? addresses, options options) ?{ (instance) -> void } -> void
|
19
19
|
|
20
20
|
def add_addresses: (Array[ipaddr] addrs) -> void
|
21
21
|
|
data/sig/io/unix.rbs
CHANGED
@@ -5,6 +5,23 @@ module HTTPX
|
|
5
5
|
|
6
6
|
alias host path
|
7
7
|
|
8
|
-
|
8
|
+
@hostname: String
|
9
|
+
|
10
|
+
@options: Options
|
11
|
+
|
12
|
+
@fallback_protocol: String
|
13
|
+
|
14
|
+
@keep_open: bool
|
15
|
+
|
16
|
+
@io: Socket
|
17
|
+
|
18
|
+
def initialize: (http_uri origin, String? path, options options) -> void
|
19
|
+
|
20
|
+
def connect: () -> void
|
21
|
+
|
22
|
+
def expired?: () -> bool
|
23
|
+
private
|
24
|
+
|
25
|
+
def build_socket: () -> Socket
|
9
26
|
end
|
10
27
|
end
|
data/sig/options.rbs
CHANGED
@@ -6,6 +6,9 @@ module HTTPX
|
|
6
6
|
WINDOW_SIZE: Integer
|
7
7
|
MAX_BODY_THRESHOLD_SIZE: Integer
|
8
8
|
CONNECT_TIMEOUT: Integer
|
9
|
+
READ_TIMEOUT: Integer
|
10
|
+
WRITE_TIMEOUT: Integer
|
11
|
+
REQUEST_TIMEOUT: Integer
|
9
12
|
OPERATION_TIMEOUT: Integer
|
10
13
|
KEEP_ALIVE_TIMEOUT: Integer
|
11
14
|
SETTINGS_TIMEOUT: Integer
|
@@ -46,7 +49,7 @@ module HTTPX
|
|
46
49
|
attr_reader body_threshold_size: Integer
|
47
50
|
|
48
51
|
# transport
|
49
|
-
attr_reader transport:
|
52
|
+
attr_reader transport: io_type | nil
|
50
53
|
|
51
54
|
# addresses
|
52
55
|
attr_reader addresses: Array[ipaddr]?
|
data/sig/parser/http1.rbs
CHANGED
data/sig/plugins/callbacks.rbs
CHANGED
@@ -7,7 +7,7 @@ module HTTPX
|
|
7
7
|
module InstanceMethods
|
8
8
|
include HTTPX::Callbacks
|
9
9
|
|
10
|
-
type socket = TCPSocket | SSLSocket | UNIXSocket
|
10
|
+
type socket = TCPSocket | OpenSSL::SSL::SSLSocket | UNIXSocket
|
11
11
|
|
12
12
|
def on_connection_opened: () { (http_uri origin, socket sock) -> void } -> self
|
13
13
|
|
@@ -5,6 +5,9 @@ module HTTPX
|
|
5
5
|
module FollowRedirects
|
6
6
|
MAX_REDIRECTS: Integer
|
7
7
|
REDIRECT_STATUS: Range[Integer]
|
8
|
+
REQUEST_BODY_HEADERS: Array[String]
|
9
|
+
|
10
|
+
type redirect_request = Request & RequestMethods
|
8
11
|
|
9
12
|
interface _FollowRedirectsOptions
|
10
13
|
def max_redirects: () -> Integer?
|
@@ -13,7 +16,7 @@ module HTTPX
|
|
13
16
|
|
14
17
|
def allow_auth_to_other_origins: () -> bool?
|
15
18
|
|
16
|
-
def redirect_on: (http_uri) ->
|
19
|
+
def redirect_on: () -> (^(http_uri) -> boolish | nil)
|
17
20
|
end
|
18
21
|
|
19
22
|
def self.extra_options: (Options) -> (Options & _FollowRedirectsOptions)
|
@@ -23,15 +26,17 @@ module HTTPX
|
|
23
26
|
|
24
27
|
def redirect_request_headers: (http_uri original_uri, http_uri redirect_uri, Headers headers, Options & _FollowRedirectsOptions options) -> Headers
|
25
28
|
|
26
|
-
def __get_location_from_response: (Response) ->
|
29
|
+
def __get_location_from_response: (Response) -> http_uri
|
27
30
|
end
|
28
31
|
|
29
32
|
module RequestMethods
|
30
33
|
attr_accessor root_request: instance?
|
31
34
|
|
32
|
-
|
35
|
+
@redirect_request: redirect_request
|
36
|
+
|
37
|
+
def redirect_request: () -> redirect_request
|
33
38
|
|
34
|
-
def redirect_request=: (
|
39
|
+
def redirect_request=: (redirect_request req) -> void
|
35
40
|
|
36
41
|
def max_redirects: () -> Integer
|
37
42
|
end
|
data/sig/plugins/grpc.rbs
CHANGED
@@ -7,6 +7,11 @@ module HTTPX
|
|
7
7
|
|
8
8
|
module Plugins
|
9
9
|
module GRPC
|
10
|
+
DEADLINE: Integer
|
11
|
+
MARSHAL_METHOD: Symbol
|
12
|
+
UNMARSHAL_METHOD: Symbol
|
13
|
+
HEADERS: Hash[String, String]
|
14
|
+
|
10
15
|
type compression_option = bool | String
|
11
16
|
type rpc_def = [String, untyped, untyped, Hash[Symbol, untyped]]
|
12
17
|
|
@@ -13,7 +13,10 @@ module HTTPX
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class SocksParser
|
16
|
-
include Callbacks
|
16
|
+
include HTTPX::Callbacks
|
17
|
+
|
18
|
+
@buffer: Buffer
|
19
|
+
@options: Options
|
17
20
|
|
18
21
|
def close: () -> void
|
19
22
|
def consume: (*untyped) -> void
|
@@ -22,7 +25,7 @@ module HTTPX
|
|
22
25
|
|
23
26
|
private
|
24
27
|
|
25
|
-
def initialize: (Buffer buffer, Options) -> untyped
|
28
|
+
def initialize: (Buffer buffer, Options options) -> untyped
|
26
29
|
end
|
27
30
|
|
28
31
|
module Packet
|
@@ -15,7 +15,10 @@ module HTTPX
|
|
15
15
|
end
|
16
16
|
|
17
17
|
class SocksParser
|
18
|
-
include Callbacks
|
18
|
+
include HTTPX::Callbacks
|
19
|
+
|
20
|
+
@buffer: Buffer
|
21
|
+
@options: Options
|
19
22
|
|
20
23
|
def close: () -> void
|
21
24
|
def consume: (*untyped) -> void
|
@@ -24,7 +27,7 @@ module HTTPX
|
|
24
27
|
|
25
28
|
private
|
26
29
|
|
27
|
-
def initialize: (Buffer buffer, Options) -> untyped
|
30
|
+
def initialize: (Buffer buffer, Options options) -> untyped
|
28
31
|
end
|
29
32
|
|
30
33
|
module Packet
|
data/sig/plugins/retries.rbs
CHANGED
@@ -29,6 +29,8 @@ module HTTPX
|
|
29
29
|
|
30
30
|
private
|
31
31
|
|
32
|
+
def fetch_response: (retriesRequest request, Array[Connection] connections, retriesOptions options) -> (retriesResponse | ErrorResponse)?
|
33
|
+
|
32
34
|
def __repeatable_request?: (retriesRequest request, retriesOptions options) -> boolish
|
33
35
|
|
34
36
|
def __retryable_error?: (_Exception error) -> bool
|
data/sig/resolver/https.rbs
CHANGED
data/sig/resolver/native.rbs
CHANGED
data/sig/session.rbs
CHANGED
@@ -43,7 +43,7 @@ module HTTPX
|
|
43
43
|
| (verb, _Each[[uri, options]], Options) -> Array[Request]
|
44
44
|
| (verb, _Each[uri], options) -> Array[Request]
|
45
45
|
|
46
|
-
def init_connection: (
|
46
|
+
def init_connection: (http_uri uri, Options options) -> Connection
|
47
47
|
|
48
48
|
def send_requests: (*Request) -> Array[response]
|
49
49
|
|
@@ -21,8 +21,8 @@ module HTTPX
|
|
21
21
|
@part_index: Integer
|
22
22
|
@buffer: String
|
23
23
|
|
24
|
-
@form: Enumerable[[Symbol | string, multipart_nested_value]]
|
25
|
-
@parts: Array[_Reader]
|
24
|
+
@form: Enumerable[[Symbol | string, Object & multipart_nested_value]]
|
25
|
+
@parts: Array[Object & _Reader]
|
26
26
|
|
27
27
|
def bytesize: () -> Integer
|
28
28
|
|
@@ -40,13 +40,18 @@ module HTTPX
|
|
40
40
|
|
41
41
|
def header_part: (string key, String content_type, String? filename) -> StringIO
|
42
42
|
|
43
|
-
def read_chunks: (String buffer, ?
|
43
|
+
def read_chunks: (String buffer, ?int? length) -> void
|
44
44
|
|
45
|
-
def read_from_part: (?
|
45
|
+
def read_from_part: (?int? max_length) -> String?
|
46
46
|
end
|
47
47
|
|
48
48
|
class Decoder
|
49
|
+
CRLF: String
|
49
50
|
BOUNDARY_RE: Regexp
|
51
|
+
MULTIPART_CONTENT_TYPE: Regexp
|
52
|
+
MULTIPART_CONTENT_DISPOSITION: Regexp
|
53
|
+
MULTIPART_CONTENT_ID: Regexp
|
54
|
+
WINDOW_SIZE: Integer
|
50
55
|
|
51
56
|
@state: :idle | :part_header | :part_body | :parse_boundary | :done
|
52
57
|
@buffer: String
|
@@ -75,8 +80,8 @@ module HTTPX
|
|
75
80
|
end
|
76
81
|
|
77
82
|
module Part
|
78
|
-
def self?.call: [U] (_MultipartInput multipart_input) -> [U, String, String]
|
79
|
-
| (multipart_nested_value input) -> ([StringIO, String, String?] | [File, String, String])
|
83
|
+
def self?.call: [U] (Object & _MultipartInput multipart_input) -> [U, String, String]
|
84
|
+
| (Object & multipart_nested_value input) -> ([StringIO, String, String?] | [File, String, String])
|
80
85
|
end
|
81
86
|
|
82
87
|
module MimeTypeDetector
|
data/sig/transcoder/xml.rbs
CHANGED
data/sig/utils.rbs
CHANGED
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.2.
|
4
|
+
version: 1.2.6
|
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-
|
11
|
+
date: 2024-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2-next
|
@@ -142,6 +142,8 @@ extra_rdoc_files:
|
|
142
142
|
- doc/release_notes/1_2_2.md
|
143
143
|
- doc/release_notes/1_2_3.md
|
144
144
|
- doc/release_notes/1_2_4.md
|
145
|
+
- doc/release_notes/1_2_5.md
|
146
|
+
- doc/release_notes/1_2_6.md
|
145
147
|
files:
|
146
148
|
- LICENSE.txt
|
147
149
|
- README.md
|
@@ -255,6 +257,8 @@ files:
|
|
255
257
|
- doc/release_notes/1_2_2.md
|
256
258
|
- doc/release_notes/1_2_3.md
|
257
259
|
- doc/release_notes/1_2_4.md
|
260
|
+
- doc/release_notes/1_2_5.md
|
261
|
+
- doc/release_notes/1_2_6.md
|
258
262
|
- lib/httpx.rb
|
259
263
|
- lib/httpx/adapters/datadog.rb
|
260
264
|
- lib/httpx/adapters/faraday.rb
|
@@ -471,7 +475,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
471
475
|
- !ruby/object:Gem::Version
|
472
476
|
version: '0'
|
473
477
|
requirements: []
|
474
|
-
rubygems_version: 3.
|
478
|
+
rubygems_version: 3.5.3
|
475
479
|
signing_key:
|
476
480
|
specification_version: 4
|
477
481
|
summary: HTTPX, to the future, and beyond
|