httpx 0.15.0 → 0.15.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db99d4bc2c59c9292882ced18f8b89a9137d13bca7cf0cb7a9e4a84609e0f385
4
- data.tar.gz: a42b6a825a7c3d098a9dca4a0a705e37eb0c17012533e66a2bd85ad7cb8897e7
3
+ metadata.gz: b9ddf7801add132a755b4ae9a069d5267251780577ca68398f92ca04788ea5ba
4
+ data.tar.gz: 17a8072343c029940262b14810d66744d7761e561c2f0f0c5bb892737690c761
5
5
  SHA512:
6
- metadata.gz: be7a3184672e1c7193e4acf538b5c3f8b3aacd257334055b59fac4303cb02701f12d6e35cfd553b641ac12ca0b10b47ff011f396f7ee8a3068f3785be9ad07f8
7
- data.tar.gz: 69cdeb266a69127135dd6d7c4cab6cc034ef7c5de11b4eee4bf135f3073c55dac4f25a7c1453fb6e73c4200470f9b374bde5aa1c91c004e264643813e9cb7e41
6
+ metadata.gz: bcf80ebdd6b1b767f0617e5f21c162d2beaacfb988d83061aebc2a4bbf4b7308ed7a693f2147cbc31cdee01f1dd4543087b4d57d241de61bdcf3e68d07525597
7
+ data.tar.gz: 176bfb2025dcf3039da7fc803a4abfada95d19a8221dfac746872f8806018b7b6b9b2c659ed6788183fe37bc661d7deb769094a9929b34534602bd7c4689ea01
@@ -41,4 +41,13 @@ A new timeout option, `settings_timeout`, is supported for the HTTP/2 handshake;
41
41
  # if you want to change
42
42
  HTTPX.with(timeout: {settings_timeout: 5})....
43
43
 
44
+ ```
45
+
46
+ IDNA 2008 support is now possibly, by integrating [idnx](https://github.com/HoneyryderChuck/idnx) into your dependencies:
47
+
48
+
49
+ ```ruby
50
+ # in Gemfile
51
+ gem "httpx"
52
+ gem "idnx"
44
53
  ```
@@ -0,0 +1,8 @@
1
+ # 0.15.1
2
+
3
+ ## Bugfixes
4
+
5
+ Fixed HTTP/1 connection accounting on requests:
6
+
7
+ * when persistent, Connection: close will be set based on the request position on the batch against the allowed requests on the open connection.
8
+ * when not persistent, Connnection: close will be set on the last request of the batch, being the batch a subset based on allowed requests, or the whole of it.
@@ -0,0 +1,9 @@
1
+ # 0.15.2
2
+
3
+ ## Bugfixes
4
+
5
+ * Fixed cookie management for same-keys: before the fix, cookies with same-key, same-domain and same-path were all being sent in subsequent requests, which violates RFC 6265 - 5.4 . As of now, only the last valid cookie for a given key/domain/path will be kept, evicting the others.
6
+
7
+ ## Chore
8
+
9
+ * debug logs were inserting ASCII code string wrappers, even when no color was set. It nonw only sends the plain string.
@@ -0,0 +1,5 @@
1
+ # 0.15.3
2
+
3
+ ## Bugfixes
4
+
5
+ * Fixed connection management, where selectables could end up with "arrays of IO objects" as elements, instead of just IO objects. This caused bugs when connecting and performing concurrent requests on multiple hosts (#138).
@@ -0,0 +1,5 @@
1
+ # 0.15.4
2
+
3
+ ## Bugfixes
4
+
5
+ * Fixed `grpc` plugin, where `.marshal` was being called on the encoding protobuf object, instead of the coorrect "marshal method", which is `.encode`.
@@ -263,13 +263,24 @@ module HTTPX
263
263
  request.chunk!
264
264
  end
265
265
 
266
- requests_limit = [@max_requests, @requests.size].min
267
-
268
- connection = if request != @requests[requests_limit - 1] &&
269
- request.options.persistent && @max_requests != 1
270
- "keep-alive"
266
+ connection = if request.options.persistent
267
+ # when in a persistent connection, the request can't be at
268
+ # the edge of a renegotiation
269
+ if @requests.index(request) + 1 < @max_requests
270
+ "keep-alive"
271
+ else
272
+ "close"
273
+ end
271
274
  else
272
- "close"
275
+ # when it's not a persistent connection, it sets "Connection: close" always
276
+ # on the last request of the possible batch (either allowed max requests,
277
+ # or if smaller, the size of the batch itself)
278
+ requests_limit = [@max_requests, @requests.size].min
279
+ if request != @requests[requests_limit - 1]
280
+ "keep-alive"
281
+ else
282
+ "close"
283
+ end
273
284
  end
274
285
 
275
286
  {
@@ -20,7 +20,7 @@ module HTTPX
20
20
  debug_stream = @options.debug
21
21
 
22
22
  message = (+"" << msg.call << "\n")
23
- message = "\e[#{COLORS[color]}m#{message}\e[0m" if debug_stream.respond_to?(:isatty) && debug_stream.isatty
23
+ message = "\e[#{COLORS[color]}m#{message}\e[0m" if color && debug_stream.respond_to?(:isatty) && debug_stream.isatty
24
24
  debug_stream << message
25
25
  end
26
26
 
data/lib/httpx/options.rb CHANGED
@@ -144,7 +144,7 @@ module HTTPX
144
144
  Array(value)
145
145
  OUT
146
146
 
147
- %w[
147
+ %i[
148
148
  params form json body ssl http2_settings
149
149
  request_class response_class headers_class request_body_class response_body_class connection_class
150
150
  io fallback_protocol debug debug_level transport_options resolver_class resolver_options
@@ -171,6 +171,8 @@ module HTTPX
171
171
  end
172
172
 
173
173
  def merge(other)
174
+ raise ArgumentError, "#{other.inspect} is not a valid set of options" unless other.respond_to?(:to_hash)
175
+
174
176
  h2 = other.to_hash
175
177
  return self if h2.empty?
176
178
 
@@ -43,8 +43,7 @@ module HTTPX
43
43
  # Precedence: 1. longer path 2. older creation
44
44
  (@name <=> other.name).nonzero? ||
45
45
  (other.path.length <=> @path.length).nonzero? ||
46
- (@created_at <=> other.created_at).nonzero? ||
47
- @value <=> other.value
46
+ (@created_at <=> other.created_at).nonzero?
48
47
  end
49
48
 
50
49
  class << self
@@ -43,6 +43,10 @@ module HTTPX
43
43
 
44
44
  c.path = path if path && c.path == "/"
45
45
 
46
+ # If the user agent receives a new cookie with the same cookie-name, domain-value, and path-value
47
+ # as a cookie that it has already stored, the existing cookie is evicted and replaced with the new cookie.
48
+ @cookies.delete_if { |ck| ck.name == c.name && ck.domain == c.domain && ck.path == c.path }
49
+
46
50
  @cookies << c
47
51
  end
48
52
 
@@ -180,7 +180,7 @@ module HTTPX
180
180
  end
181
181
  end
182
182
  else
183
- input_enc.marshal(input)
183
+ input_enc.__send__(marshal_method, input)
184
184
  end
185
185
 
186
186
  call = execute(rpc_name, messages, **exec_opts)
@@ -0,0 +1,14 @@
1
+ require_relative "request"
2
+ module HTTPX
3
+ class Request
4
+ def response=(response)
5
+ return unless response
6
+
7
+ if response.status == 100
8
+ @informational_status = response.status
9
+ return
10
+ end
11
+ @response = response
12
+ end
13
+ end
14
+ end
@@ -77,7 +77,7 @@ class HTTPX::Selector
77
77
 
78
78
  break
79
79
  else
80
- @selectables = [*selectables, @selectables]
80
+ @selectables.concat(selectables)
81
81
  end
82
82
  rescue StandardError
83
83
  @selectables = selectables if selectables
@@ -95,14 +95,18 @@ class HTTPX::Selector
95
95
  retry
96
96
  end
97
97
 
98
- readers.each do |io|
99
- yield io
98
+ if writers
99
+ readers.each do |io|
100
+ yield io
100
101
 
101
- # so that we don't yield 2 times
102
- writers.delete(io)
103
- end if readers
102
+ # so that we don't yield 2 times
103
+ writers.delete(io)
104
+ end if readers
104
105
 
105
- writers.each(&block) if writers
106
+ writers.each(&block)
107
+ else
108
+ readers.each(&block) if readers
109
+ end
106
110
  end
107
111
 
108
112
  def select_one(interval)
data/lib/httpx/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTPX
4
- VERSION = "0.15.0"
4
+ VERSION = "0.15.4"
5
5
  end
data/sig/selector.rbs CHANGED
@@ -2,6 +2,7 @@ module HTTPX
2
2
  class Selector
3
3
  READABLE: :r | :rw
4
4
  WRITABLE: :w | :rw
5
+ @selectables: Array[_ToIO]
5
6
 
6
7
  def register: (_ToIO) -> void
7
8
  def deregister: (_ToIO) -> void
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.15.0
4
+ version: 0.15.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: 2021-06-18 00:00:00.000000000 Z
11
+ date: 2021-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2-next
@@ -69,6 +69,10 @@ extra_rdoc_files:
69
69
  - doc/release_notes/0_14_4.md
70
70
  - doc/release_notes/0_14_5.md
71
71
  - doc/release_notes/0_15_0.md
72
+ - doc/release_notes/0_15_1.md
73
+ - doc/release_notes/0_15_2.md
74
+ - doc/release_notes/0_15_3.md
75
+ - doc/release_notes/0_15_4.md
72
76
  - doc/release_notes/0_1_0.md
73
77
  - doc/release_notes/0_2_0.md
74
78
  - doc/release_notes/0_2_1.md
@@ -117,6 +121,10 @@ files:
117
121
  - doc/release_notes/0_14_4.md
118
122
  - doc/release_notes/0_14_5.md
119
123
  - doc/release_notes/0_15_0.md
124
+ - doc/release_notes/0_15_1.md
125
+ - doc/release_notes/0_15_2.md
126
+ - doc/release_notes/0_15_3.md
127
+ - doc/release_notes/0_15_4.md
120
128
  - doc/release_notes/0_1_0.md
121
129
  - doc/release_notes/0_2_0.md
122
130
  - doc/release_notes/0_2_1.md
@@ -208,6 +216,7 @@ files:
208
216
  - lib/httpx/punycode.rb
209
217
  - lib/httpx/registry.rb
210
218
  - lib/httpx/request.rb
219
+ - lib/httpx/request2.rb
211
220
  - lib/httpx/resolver.rb
212
221
  - lib/httpx/resolver/https.rb
213
222
  - lib/httpx/resolver/native.rb
@@ -290,6 +299,7 @@ metadata:
290
299
  changelog_uri: https://honeyryderchuck.gitlab.io/httpx/#release-notes
291
300
  documentation_uri: https://honeyryderchuck.gitlab.io/httpx/rdoc/
292
301
  source_code_uri: https://gitlab.com/honeyryderchuck/httpx
302
+ homepage_uri: https://honeyryderchuck.gitlab.io/httpx/
293
303
  post_install_message:
294
304
  rdoc_options: []
295
305
  require_paths: