httpx 1.0.2 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/doc/release_notes/1_1_0.md +32 -0
  4. data/doc/release_notes/1_1_1.md +17 -0
  5. data/lib/httpx/adapters/faraday.rb +28 -19
  6. data/lib/httpx/connection/http1.rb +13 -6
  7. data/lib/httpx/connection/http2.rb +1 -1
  8. data/lib/httpx/connection.rb +53 -15
  9. data/lib/httpx/domain_name.rb +6 -2
  10. data/lib/httpx/errors.rb +32 -0
  11. data/lib/httpx/io/ssl.rb +3 -1
  12. data/lib/httpx/io/tcp.rb +4 -2
  13. data/lib/httpx/io.rb +5 -1
  14. data/lib/httpx/options.rb +48 -1
  15. data/lib/httpx/plugins/expect.rb +10 -8
  16. data/lib/httpx/plugins/proxy/http.rb +0 -1
  17. data/lib/httpx/pool.rb +0 -4
  18. data/lib/httpx/request/body.rb +22 -9
  19. data/lib/httpx/request.rb +63 -4
  20. data/lib/httpx/resolver/native.rb +2 -2
  21. data/lib/httpx/resolver/resolver.rb +5 -2
  22. data/lib/httpx/resolver/system.rb +5 -2
  23. data/lib/httpx/resolver.rb +6 -4
  24. data/lib/httpx/response/body.rb +30 -5
  25. data/lib/httpx/response/buffer.rb +20 -14
  26. data/lib/httpx/response.rb +95 -16
  27. data/lib/httpx/selector.rb +2 -2
  28. data/lib/httpx/session.rb +64 -2
  29. data/lib/httpx/timers.rb +35 -8
  30. data/lib/httpx/transcoder/json.rb +1 -1
  31. data/lib/httpx/transcoder/utils/inflater.rb +19 -0
  32. data/lib/httpx/version.rb +1 -1
  33. data/sig/connection/http1.rbs +3 -3
  34. data/sig/connection/http2.rbs +1 -1
  35. data/sig/connection.rbs +4 -1
  36. data/sig/io/tcp.rbs +1 -1
  37. data/sig/options.rbs +2 -2
  38. data/sig/pool.rbs +1 -1
  39. data/sig/request/body.rbs +0 -2
  40. data/sig/request.rbs +9 -3
  41. data/sig/resolver/native.rbs +1 -1
  42. data/sig/resolver.rbs +1 -1
  43. data/sig/response/body.rbs +0 -1
  44. data/sig/response.rbs +11 -3
  45. data/sig/timers.rbs +17 -7
  46. data/sig/transcoder/utils/inflater.rbs +12 -0
  47. metadata +8 -2
data/sig/request.rbs CHANGED
@@ -15,6 +15,10 @@ module HTTPX
15
15
  attr_reader response: response?
16
16
  attr_reader drain_error: StandardError?
17
17
 
18
+ attr_accessor peer_address: ipaddr?
19
+
20
+ attr_writer persistent: bool
21
+
18
22
  @trailers: Headers?
19
23
  @informational_status: Integer?
20
24
  @query: String?
@@ -50,11 +54,13 @@ module HTTPX
50
54
 
51
55
  def trailers?: () -> boolish
52
56
 
53
- def read_timeout: () -> Numeric
57
+ def persistent?: () -> bool
58
+
59
+ def read_timeout: () -> Numeric?
54
60
 
55
- def write_timeout: () -> Numeric
61
+ def write_timeout: () -> Numeric?
56
62
 
57
- def request_timeout: () -> Numeric
63
+ def request_timeout: () -> Numeric?
58
64
 
59
65
  private
60
66
 
@@ -34,7 +34,7 @@ module HTTPX
34
34
 
35
35
  def timeout: () -> Numeric?
36
36
 
37
- def raise_timeout_error: (Numeric interval) -> void
37
+ def handle_socket_timeout: (Numeric interval) -> void
38
38
 
39
39
  private
40
40
 
data/sig/resolver.rbs CHANGED
@@ -2,7 +2,7 @@ module HTTPX
2
2
  type ipaddr = IPAddr | String
3
3
 
4
4
  module Resolver
5
- RESOLVE_TIMEOUT: Integer | Float
5
+ RESOLVE_TIMEOUT: Array[Integer]
6
6
 
7
7
  @lookup_mutex: Thread::Mutex
8
8
 
@@ -11,7 +11,6 @@ module HTTPX
11
11
  @headers: Headers
12
12
  @options: Options
13
13
  @state: :idle | :memory | :buffer | :closed
14
- @threshold_size: Integer
15
14
  @window_size: Integer
16
15
  @length: Integer
17
16
  @buffer: StringIO | Tempfile | nil
data/sig/response.rbs CHANGED
@@ -25,22 +25,28 @@ module HTTPX
25
25
  @content_type: ContentType
26
26
 
27
27
  def copy_to: (_ToPath | _Writer destination) -> void
28
+
28
29
  def close: () -> void
30
+
29
31
  def uri: () -> URI::Generic
30
32
 
33
+ def peer_address: () -> ipaddr?
34
+
31
35
  def merge_headers: (_Each[[String, headers_value]]) -> void
36
+
32
37
  def bodyless?: () -> bool
38
+
33
39
  def content_type: () -> ContentType
40
+
34
41
  def complete?: () -> bool
35
42
 
36
43
  def json: (?json_options opts) -> untyped
37
44
 
38
45
  def form: () -> Hash[String, untyped]
39
46
 
40
- private
47
+ def initialize: (Request request, String | Integer status, String version, headers?) -> void
41
48
 
42
- def initialize: (Request request, String | Integer status, String version, headers?) -> untyped
43
- def no_data?: () -> bool
49
+ private
44
50
 
45
51
  def decode:(Transcoder::_Decode transcoder, ?untyped options) -> untyped
46
52
  end
@@ -78,6 +84,8 @@ module HTTPX
78
84
 
79
85
  def uri: () -> URI::Generic
80
86
 
87
+ def peer_address: () -> ipaddr?
88
+
81
89
  def close: () -> void
82
90
 
83
91
  private
data/sig/timers.rbs CHANGED
@@ -3,30 +3,40 @@ module HTTPX
3
3
  @intervals: Array[Interval]
4
4
  @next_interval_at: Float
5
5
 
6
- def after: (Numeric interval_in_secs) { () -> void } -> void
6
+ def after: (Numeric interval_in_secs, ^() -> void) -> Interval
7
+ | (Numeric interval_in_secs) { () -> void } -> Interval
7
8
 
8
9
  def wait_interval: () -> Numeric?
9
10
 
10
11
  def fire: (?TimeoutError error) -> void
11
12
 
12
- def cancel: () -> void
13
-
14
- private
15
-
16
13
  def initialize: () -> void
17
14
 
18
15
  class Interval
19
16
  include Comparable
20
17
 
18
+ type callback = ^() -> void
19
+
21
20
  attr_reader interval: Numeric
22
21
 
23
- @callbacks: Array[^() -> void]
22
+ @callbacks: Array[callback]
23
+ @on_empty: callback?
24
+
25
+
26
+ def on_empty: () { () -> void } -> void
24
27
 
25
28
  def to_f: () -> Float
26
29
 
27
- def <<: (^() -> void) -> void
30
+ def <<: (callback) -> void
31
+
32
+ def delete: (callback) -> void
28
33
 
29
34
  def elapse: (Numeric elapsed) -> Numeric
35
+
36
+ def elapsed?: () -> bool
37
+
38
+ def no_callbacks?: () -> bool
39
+
30
40
  private
31
41
 
32
42
  def initialize: (Numeric interval) -> void
@@ -0,0 +1,12 @@
1
+ module HTTPX
2
+ module Transcoder
3
+ class Inflater
4
+ @inflater: Zlib::Inflate
5
+ @bytesize: Integer
6
+
7
+ def initialize: (Integer | Float bytesize) -> void
8
+
9
+ def call: (String chunk) -> String
10
+ end
11
+ end
12
+ 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.0.2
4
+ version: 1.1.1
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-10-13 00:00:00.000000000 Z
11
+ date: 2023-11-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -131,6 +131,8 @@ extra_rdoc_files:
131
131
  - doc/release_notes/1_0_0.md
132
132
  - doc/release_notes/1_0_1.md
133
133
  - doc/release_notes/1_0_2.md
134
+ - doc/release_notes/1_1_0.md
135
+ - doc/release_notes/1_1_1.md
134
136
  files:
135
137
  - LICENSE.txt
136
138
  - README.md
@@ -233,6 +235,8 @@ files:
233
235
  - doc/release_notes/1_0_0.md
234
236
  - doc/release_notes/1_0_1.md
235
237
  - doc/release_notes/1_0_2.md
238
+ - doc/release_notes/1_1_0.md
239
+ - doc/release_notes/1_1_1.md
236
240
  - lib/httpx.rb
237
241
  - lib/httpx/adapters/datadog.rb
238
242
  - lib/httpx/adapters/faraday.rb
@@ -334,6 +338,7 @@ files:
334
338
  - lib/httpx/transcoder/multipart/part.rb
335
339
  - lib/httpx/transcoder/utils/body_reader.rb
336
340
  - lib/httpx/transcoder/utils/deflater.rb
341
+ - lib/httpx/transcoder/utils/inflater.rb
337
342
  - lib/httpx/transcoder/xml.rb
338
343
  - lib/httpx/utils.rb
339
344
  - lib/httpx/version.rb
@@ -416,6 +421,7 @@ files:
416
421
  - sig/transcoder/multipart.rbs
417
422
  - sig/transcoder/utils/body_reader.rbs
418
423
  - sig/transcoder/utils/deflater.rbs
424
+ - sig/transcoder/utils/inflater.rbs
419
425
  - sig/transcoder/xml.rbs
420
426
  - sig/utils.rbs
421
427
  homepage: https://gitlab.com/os85/httpx