http 4.4.1 → 5.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +85 -0
  3. data/.gitignore +6 -10
  4. data/.rspec +0 -4
  5. data/.rubocop/layout.yml +8 -0
  6. data/.rubocop/style.yml +32 -0
  7. data/.rubocop.yml +8 -110
  8. data/.rubocop_todo.yml +206 -0
  9. data/.yardopts +1 -1
  10. data/CHANGES.md +200 -3
  11. data/Gemfile +18 -10
  12. data/LICENSE.txt +1 -1
  13. data/README.md +48 -86
  14. data/Rakefile +2 -10
  15. data/SECURITY.md +5 -0
  16. data/http.gemspec +9 -8
  17. data/lib/http/chainable.rb +23 -17
  18. data/lib/http/client.rb +44 -34
  19. data/lib/http/connection.rb +11 -7
  20. data/lib/http/content_type.rb +12 -7
  21. data/lib/http/errors.rb +3 -0
  22. data/lib/http/feature.rb +3 -1
  23. data/lib/http/features/auto_deflate.rb +6 -6
  24. data/lib/http/features/auto_inflate.rb +6 -7
  25. data/lib/http/features/instrumentation.rb +1 -1
  26. data/lib/http/features/logging.rb +19 -21
  27. data/lib/http/headers.rb +50 -13
  28. data/lib/http/mime_type/adapter.rb +3 -1
  29. data/lib/http/mime_type/json.rb +1 -0
  30. data/lib/http/options.rb +5 -8
  31. data/lib/http/redirector.rb +55 -4
  32. data/lib/http/request/body.rb +1 -0
  33. data/lib/http/request/writer.rb +9 -4
  34. data/lib/http/request.rb +28 -11
  35. data/lib/http/response/body.rb +6 -4
  36. data/lib/http/response/inflater.rb +1 -1
  37. data/lib/http/response/parser.rb +74 -62
  38. data/lib/http/response/status.rb +4 -3
  39. data/lib/http/response.rb +44 -18
  40. data/lib/http/timeout/global.rb +20 -36
  41. data/lib/http/timeout/null.rb +2 -1
  42. data/lib/http/timeout/per_operation.rb +32 -55
  43. data/lib/http/uri.rb +51 -6
  44. data/lib/http/version.rb +1 -1
  45. data/spec/lib/http/client_spec.rb +155 -30
  46. data/spec/lib/http/connection_spec.rb +8 -5
  47. data/spec/lib/http/features/auto_inflate_spec.rb +3 -2
  48. data/spec/lib/http/features/instrumentation_spec.rb +27 -21
  49. data/spec/lib/http/features/logging_spec.rb +8 -10
  50. data/spec/lib/http/headers_spec.rb +53 -18
  51. data/spec/lib/http/options/headers_spec.rb +1 -1
  52. data/spec/lib/http/options/merge_spec.rb +16 -16
  53. data/spec/lib/http/redirector_spec.rb +133 -3
  54. data/spec/lib/http/request/body_spec.rb +3 -3
  55. data/spec/lib/http/request/writer_spec.rb +25 -2
  56. data/spec/lib/http/request_spec.rb +5 -5
  57. data/spec/lib/http/response/body_spec.rb +5 -5
  58. data/spec/lib/http/response/parser_spec.rb +33 -4
  59. data/spec/lib/http/response/status_spec.rb +3 -3
  60. data/spec/lib/http/response_spec.rb +80 -3
  61. data/spec/lib/http/uri_spec.rb +39 -0
  62. data/spec/lib/http_spec.rb +30 -3
  63. data/spec/spec_helper.rb +21 -21
  64. data/spec/support/black_hole.rb +1 -1
  65. data/spec/support/dummy_server/servlet.rb +19 -6
  66. data/spec/support/dummy_server.rb +7 -7
  67. data/spec/support/fuubar.rb +21 -0
  68. data/spec/support/http_handling_shared.rb +5 -5
  69. data/spec/support/simplecov.rb +19 -0
  70. data/spec/support/ssl_helper.rb +4 -4
  71. metadata +22 -14
  72. data/.coveralls.yml +0 -1
  73. data/.travis.yml +0 -39
@@ -26,7 +26,7 @@ RSpec.describe HTTP::Response::Status do
26
26
  end
27
27
 
28
28
  described_class::REASONS.each do |code, reason|
29
- class_eval <<-RUBY
29
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
30
30
  context 'with well-known code: #{code}' do
31
31
  let(:code) { #{code} }
32
32
  it { is_expected.to eq #{reason.inspect} }
@@ -165,7 +165,7 @@ RSpec.describe HTTP::Response::Status do
165
165
  end
166
166
 
167
167
  described_class::SYMBOLS.each do |code, symbol|
168
- class_eval <<-RUBY
168
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
169
169
  context 'with well-known code: #{code}' do
170
170
  let(:code) { #{code} }
171
171
  it { is_expected.to be #{symbol.inspect} }
@@ -193,7 +193,7 @@ RSpec.describe HTTP::Response::Status do
193
193
  end
194
194
 
195
195
  described_class::SYMBOLS.each do |code, symbol|
196
- class_eval <<-RUBY
196
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
197
197
  describe '##{symbol}?' do
198
198
  subject { status.#{symbol}? }
199
199
 
@@ -4,6 +4,7 @@ RSpec.describe HTTP::Response do
4
4
  let(:body) { "Hello world!" }
5
5
  let(:uri) { "http://example.com/" }
6
6
  let(:headers) { {} }
7
+ let(:request) { HTTP::Request.new(:verb => :get, :uri => uri) }
7
8
 
8
9
  subject(:response) do
9
10
  HTTP::Response.new(
@@ -11,7 +12,7 @@ RSpec.describe HTTP::Response do
11
12
  :version => "1.1",
12
13
  :headers => headers,
13
14
  :body => body,
14
- :uri => uri
15
+ :request => request
15
16
  )
16
17
  end
17
18
 
@@ -109,7 +110,7 @@ RSpec.describe HTTP::Response do
109
110
  expect(response.parse("application/json")).to eq "foo" => "bar"
110
111
  end
111
112
 
112
- it "supports MIME type aliases" do
113
+ it "supports mime type aliases" do
113
114
  expect(response.parse(:json)).to eq "foo" => "bar"
114
115
  end
115
116
  end
@@ -165,7 +166,8 @@ RSpec.describe HTTP::Response do
165
166
  HTTP::Response.new(
166
167
  :version => "1.1",
167
168
  :status => 200,
168
- :connection => connection
169
+ :connection => connection,
170
+ :request => request
169
171
  )
170
172
  end
171
173
 
@@ -182,4 +184,79 @@ RSpec.describe HTTP::Response do
182
184
  end
183
185
  it { is_expected.not_to be_chunked }
184
186
  end
187
+
188
+ describe "backwards compatibilty with :uri" do
189
+ context "with no :verb" do
190
+ subject(:response) do
191
+ HTTP::Response.new(
192
+ :status => 200,
193
+ :version => "1.1",
194
+ :headers => headers,
195
+ :body => body,
196
+ :uri => uri
197
+ )
198
+ end
199
+
200
+ it "defaults the uri to :uri" do
201
+ expect(response.request.uri.to_s).to eq uri
202
+ end
203
+
204
+ it "defaults to the verb to :get" do
205
+ expect(response.request.verb).to eq :get
206
+ end
207
+ end
208
+
209
+ context "with both a :request and :uri" do
210
+ subject(:response) do
211
+ HTTP::Response.new(
212
+ :status => 200,
213
+ :version => "1.1",
214
+ :headers => headers,
215
+ :body => body,
216
+ :uri => uri,
217
+ :request => request
218
+ )
219
+ end
220
+
221
+ it "raises ArgumentError" do
222
+ expect { response }.to raise_error(ArgumentError)
223
+ end
224
+ end
225
+ end
226
+
227
+ describe "#body" do
228
+ let(:connection) { double(:sequence_id => 0) }
229
+ let(:chunks) { ["Hello, ", "World!"] }
230
+
231
+ subject(:response) do
232
+ HTTP::Response.new(
233
+ :status => 200,
234
+ :version => "1.1",
235
+ :headers => headers,
236
+ :request => request,
237
+ :connection => connection
238
+ )
239
+ end
240
+
241
+ before do
242
+ allow(connection).to receive(:readpartial) { chunks.shift }
243
+ allow(connection).to receive(:body_completed?) { chunks.empty? }
244
+ end
245
+
246
+ context "with no Content-Type" do
247
+ let(:headers) { {} }
248
+
249
+ it "returns a body with default binary encoding" do
250
+ expect(response.body.to_s.encoding).to eq Encoding::BINARY
251
+ end
252
+ end
253
+
254
+ context "with Content-Type: application/json" do
255
+ let(:headers) { {"Content-Type" => "application/json"} }
256
+
257
+ it "returns a body with a default UTF_8 encoding" do
258
+ expect(response.body.to_s.encoding).to eq Encoding::UTF_8
259
+ end
260
+ end
261
+ end
185
262
  end
@@ -1,11 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  RSpec.describe HTTP::URI do
4
+ let(:example_ipv6_address) { "2606:2800:220:1:248:1893:25c8:1946" }
5
+
4
6
  let(:example_http_uri_string) { "http://example.com" }
5
7
  let(:example_https_uri_string) { "https://example.com" }
8
+ let(:example_ipv6_uri_string) { "https://[#{example_ipv6_address}]" }
6
9
 
7
10
  subject(:http_uri) { described_class.parse(example_http_uri_string) }
8
11
  subject(:https_uri) { described_class.parse(example_https_uri_string) }
12
+ subject(:ipv6_uri) { described_class.parse(example_ipv6_uri_string) }
9
13
 
10
14
  it "knows URI schemes" do
11
15
  expect(http_uri.scheme).to eq "http"
@@ -20,6 +24,41 @@ RSpec.describe HTTP::URI do
20
24
  expect(https_uri.port).to eq 443
21
25
  end
22
26
 
27
+ describe "#host" do
28
+ it "strips brackets from IPv6 addresses" do
29
+ expect(ipv6_uri.host).to eq("2606:2800:220:1:248:1893:25c8:1946")
30
+ end
31
+ end
32
+
33
+ describe "#normalized_host" do
34
+ it "strips brackets from IPv6 addresses" do
35
+ expect(ipv6_uri.normalized_host).to eq("2606:2800:220:1:248:1893:25c8:1946")
36
+ end
37
+ end
38
+
39
+ describe "#host=" do
40
+ it "updates cached values for #host and #normalized_host" do
41
+ expect(http_uri.host).to eq("example.com")
42
+ expect(http_uri.normalized_host).to eq("example.com")
43
+
44
+ http_uri.host = "[#{example_ipv6_address}]"
45
+
46
+ expect(http_uri.host).to eq(example_ipv6_address)
47
+ expect(http_uri.normalized_host).to eq(example_ipv6_address)
48
+ end
49
+
50
+ it "ensures IPv6 addresses are bracketed in the inner Addressable::URI" do
51
+ expect(http_uri.host).to eq("example.com")
52
+ expect(http_uri.normalized_host).to eq("example.com")
53
+
54
+ http_uri.host = example_ipv6_address
55
+
56
+ expect(http_uri.host).to eq(example_ipv6_address)
57
+ expect(http_uri.normalized_host).to eq(example_ipv6_address)
58
+ expect(http_uri.instance_variable_get(:@uri).host).to eq("[#{example_ipv6_address}]")
59
+ end
60
+ end
61
+
23
62
  describe "#dup" do
24
63
  it "doesn't share internal value between duplicates" do
25
64
  duplicated_uri = http_uri.dup
@@ -1,5 +1,5 @@
1
- # frozen_string_literal: true
2
1
  # encoding: utf-8
2
+ # frozen_string_literal: true
3
3
 
4
4
  require "json"
5
5
 
@@ -95,7 +95,8 @@ RSpec.describe HTTP do
95
95
  expect(response.to_s).to match(/<!doctype html>/)
96
96
  end
97
97
 
98
- context "ssl" do
98
+ # TODO: htt:s://github.com/httprb/http/issues/627
99
+ xcontext "ssl" do
99
100
  it "responds with the endpoint's body" do
100
101
  response = ssl_client.via(proxy.addr, proxy.port).get dummy_ssl.endpoint
101
102
  expect(response.to_s).to match(/<!doctype html>/)
@@ -131,7 +132,8 @@ RSpec.describe HTTP do
131
132
  expect(response.status).to eq(407)
132
133
  end
133
134
 
134
- context "ssl" do
135
+ # TODO: htt:s://github.com/httprb/http/issues/627
136
+ xcontext "ssl" do
135
137
  it "responds with the endpoint's body" do
136
138
  response = ssl_client.via(proxy.addr, proxy.port, "username", "password").get dummy_ssl.endpoint
137
139
  expect(response.to_s).to match(/<!doctype html>/)
@@ -307,6 +309,15 @@ RSpec.describe HTTP do
307
309
  end
308
310
  end
309
311
 
312
+ context "specifying per operation timeouts as frozen hash" do
313
+ let(:frozen_options) { {:read => 123}.freeze }
314
+ subject(:client) { HTTP.timeout(frozen_options) }
315
+
316
+ it "does not raise an error" do
317
+ expect { client }.not_to raise_error
318
+ end
319
+ end
320
+
310
321
  context "specifying a global timeout" do
311
322
  subject(:client) { HTTP.timeout 123 }
312
323
 
@@ -429,6 +440,22 @@ RSpec.describe HTTP do
429
440
 
430
441
  expect(response.to_s).to eq("#{body}-deflated")
431
442
  end
443
+
444
+ it "returns empty body for no content response where Content-Encoding is gzip" do
445
+ client = HTTP.use(:auto_inflate).headers("Accept-Encoding" => "gzip")
446
+ body = "Hello!"
447
+ response = client.post("#{dummy.endpoint}/no-content-204", :body => body)
448
+
449
+ expect(response.to_s).to eq("")
450
+ end
451
+
452
+ it "returns empty body for no content response where Content-Encoding is deflate" do
453
+ client = HTTP.use(:auto_inflate).headers("Accept-Encoding" => "deflate")
454
+ body = "Hello!"
455
+ response = client.post("#{dummy.endpoint}/no-content-204", :body => body)
456
+
457
+ expect(response.to_s).to eq("")
458
+ end
432
459
  end
433
460
 
434
461
  context "with :normalize_uri" do
data/spec/spec_helper.rb CHANGED
@@ -1,19 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "simplecov"
4
- require "coveralls"
5
-
6
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
7
- [
8
- SimpleCov::Formatter::HTMLFormatter,
9
- Coveralls::SimpleCov::Formatter
10
- ]
11
- )
12
-
13
- SimpleCov.start do
14
- add_filter "/spec/"
15
- minimum_coverage 80
16
- end
3
+ require_relative "./support/simplecov"
4
+ require_relative "./support/fuubar" unless ENV["CI"]
17
5
 
18
6
  require "http"
19
7
  require "rspec/its"
@@ -40,6 +28,13 @@ RSpec.configure do |config|
40
28
  mocks.verify_partial_doubles = true
41
29
  end
42
30
 
31
+ # This option will default to `:apply_to_host_groups` in RSpec 4 (and will
32
+ # have no way to turn it off -- the option exists only for backwards
33
+ # compatibility in RSpec 3). It causes shared context metadata to be
34
+ # inherited by the metadata hash of host groups and examples, rather than
35
+ # triggering implicit auto-inclusion in groups with matching metadata.
36
+ config.shared_context_metadata_behavior = :apply_to_host_groups
37
+
43
38
  # These two settings work together to allow you to limit a spec run
44
39
  # to individual examples or groups you care about by tagging them with
45
40
  # `:focus` metadata. When nothing is tagged with `:focus`, all examples
@@ -48,17 +43,22 @@ RSpec.configure do |config|
48
43
  config.filter_run_excluding :flaky if defined?(JRUBY_VERSION) && ENV["CI"]
49
44
  config.run_all_when_everything_filtered = true
50
45
 
51
- # Limits the available syntax to the non-monkey patched syntax that is recommended.
52
- # For more details, see:
53
- # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
54
- # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
55
- # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
56
- config.disable_monkey_patching!
57
-
58
46
  # This setting enables warnings. It's recommended, but in some cases may
59
47
  # be too noisy due to issues in dependencies.
60
48
  config.warnings = 0 == ENV["GUARD_RSPEC"].to_i
61
49
 
50
+ # Allows RSpec to persist some state between runs in order to support
51
+ # the `--only-failures` and `--next-failure` CLI options. We recommend
52
+ # you configure your source control system to ignore this file.
53
+ config.example_status_persistence_file_path = "spec/examples.txt"
54
+
55
+ # Limits the available syntax to the non-monkey patched syntax that is
56
+ # recommended. For more details, see:
57
+ # - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
58
+ # - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
59
+ # - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
60
+ config.disable_monkey_patching!
61
+
62
62
  # Many RSpec users commonly either run the entire suite or an individual
63
63
  # file, and it's useful to allow more verbose output when running an
64
64
  # individual spec file.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module BlackHole
4
4
  class << self
5
- def method_missing(*) # rubocop: disable Style/MethodMissing
5
+ def method_missing(*)
6
6
  self
7
7
  end
8
8
 
@@ -1,9 +1,10 @@
1
- # frozen_string_literal: true
2
1
  # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ require "cgi"
3
5
 
4
6
  class DummyServer < WEBrick::HTTPServer
5
- # rubocop:disable Metrics/ClassLength
6
- class Servlet < WEBrick::HTTPServlet::AbstractServlet
7
+ class Servlet < WEBrick::HTTPServlet::AbstractServlet # rubocop:disable Metrics/ClassLength
7
8
  def self.sockets
8
9
  @sockets ||= []
9
10
  end
@@ -18,7 +19,7 @@ class DummyServer < WEBrick::HTTPServer
18
19
  end
19
20
 
20
21
  %w[get post head].each do |method|
21
- class_eval <<-RUBY, __FILE__, __LINE__
22
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
22
23
  def self.#{method}(path, &block)
23
24
  handlers["#{method}:\#{path}"] = block
24
25
  end
@@ -157,7 +158,7 @@ class DummyServer < WEBrick::HTTPServer
157
158
  res.status = 200
158
159
 
159
160
  res.body = case req["Accept-Encoding"]
160
- when "gzip" then
161
+ when "gzip"
161
162
  res["Content-Encoding"] = "gzip"
162
163
  StringIO.open do |out|
163
164
  Zlib::GzipWriter.wrap(out) do |gz|
@@ -166,12 +167,24 @@ class DummyServer < WEBrick::HTTPServer
166
167
  out.tap(&:rewind).read
167
168
  end
168
169
  end
169
- when "deflate" then
170
+ when "deflate"
170
171
  res["Content-Encoding"] = "deflate"
171
172
  Zlib::Deflate.deflate("#{req.body}-deflated")
172
173
  else
173
174
  "#{req.body}-raw"
174
175
  end
175
176
  end
177
+
178
+ post "/no-content-204" do |req, res|
179
+ res.status = 204
180
+ res.body = ""
181
+
182
+ case req["Accept-Encoding"]
183
+ when "gzip"
184
+ res["Content-Encoding"] = "gzip"
185
+ when "deflate"
186
+ res["Content-Encoding"] = "deflate"
187
+ end
188
+ end
176
189
  end
177
190
  end
@@ -13,18 +13,18 @@ class DummyServer < WEBrick::HTTPServer
13
13
  include ServerConfig
14
14
 
15
15
  CONFIG = {
16
- :BindAddress => "127.0.0.1",
17
- :Port => 0,
18
- :AccessLog => BlackHole,
19
- :Logger => BlackHole
16
+ :BindAddress => "127.0.0.1",
17
+ :Port => 0,
18
+ :AccessLog => BlackHole,
19
+ :Logger => BlackHole
20
20
  }.freeze
21
21
 
22
22
  SSL_CONFIG = CONFIG.merge(
23
- :SSLEnable => true,
24
- :SSLStartImmediately => true
23
+ :SSLEnable => true,
24
+ :SSLStartImmediately => true
25
25
  ).freeze
26
26
 
27
- def initialize(options = {}) # rubocop:disable Style/OptionHash
27
+ def initialize(options = {})
28
28
  super(options[:ssl] ? SSL_CONFIG : CONFIG)
29
29
  mount("/", Servlet)
30
30
  end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fuubar"
4
+
5
+ RSpec.configure do |config|
6
+ # Use Fuubar instafail-alike formatter, unless a formatter has already been
7
+ # configured (e.g. via a command-line flag).
8
+ config.default_formatter = "Fuubar"
9
+
10
+ # Disable auto-refresh of the fuubar progress bar to avoid surprises during
11
+ # debugiing. And simply because there's next to absolutely no point in having
12
+ # this turned on.
13
+ #
14
+ # > By default fuubar will automatically refresh the bar (and therefore
15
+ # > the ETA) every second. Unfortunately this doesn't play well with things
16
+ # > like debuggers. When you're debugging, having a bar show up every second
17
+ # > is undesireable.
18
+ #
19
+ # See: https://github.com/thekompanee/fuubar#disabling-auto-refresh
20
+ config.fuubar_auto_refresh = false
21
+ end
@@ -14,11 +14,11 @@ RSpec.shared_context "HTTP handling" do
14
14
 
15
15
  let(:options) do
16
16
  {
17
- :timeout_class => HTTP::Timeout::PerOperation,
17
+ :timeout_class => HTTP::Timeout::PerOperation,
18
18
  :timeout_options => {
19
19
  :connect_timeout => conn_timeout,
20
- :read_timeout => read_timeout,
21
- :write_timeout => write_timeout
20
+ :read_timeout => read_timeout,
21
+ :write_timeout => write_timeout
22
22
  }
23
23
  }
24
24
  end
@@ -62,7 +62,7 @@ RSpec.shared_context "HTTP handling" do
62
62
  context "with a global timeout" do
63
63
  let(:options) do
64
64
  {
65
- :timeout_class => HTTP::Timeout::Global,
65
+ :timeout_class => HTTP::Timeout::Global,
66
66
  :timeout_options => {
67
67
  :global_timeout => global_timeout
68
68
  }
@@ -77,7 +77,7 @@ RSpec.shared_context "HTTP handling" do
77
77
  sleep 1.25
78
78
  end
79
79
 
80
- expect { response }.to raise_error(HTTP::TimeoutError, /execution/)
80
+ expect { response }.to raise_error(HTTP::ConnectTimeoutError, /execution/)
81
81
  end
82
82
 
83
83
  it "errors if reading takes too long" do
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "simplecov"
4
+
5
+ if ENV["CI"]
6
+ require "simplecov-lcov"
7
+
8
+ SimpleCov::Formatter::LcovFormatter.config do |config|
9
+ config.report_with_single_file = true
10
+ config.lcov_file_name = "lcov.info"
11
+ end
12
+
13
+ SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
14
+ end
15
+
16
+ SimpleCov.start do
17
+ add_filter "/spec/"
18
+ minimum_coverage 80
19
+ end
@@ -5,7 +5,7 @@ require "pathname"
5
5
  require "certificate_authority"
6
6
 
7
7
  module SSLHelper
8
- CERTS_PATH = Pathname.new File.expand_path("../../../tmp/certs", __FILE__)
8
+ CERTS_PATH = Pathname.new File.expand_path("../../tmp/certs", __dir__)
9
9
 
10
10
  class RootCertificate < ::CertificateAuthority::Certificate
11
11
  EXTENSIONS = {"keyUsage" => {"usage" => %w[critical keyCertSign]}}.freeze
@@ -83,14 +83,14 @@ module SSLHelper
83
83
 
84
84
  def client_params
85
85
  {
86
- :key => client_cert.key,
87
- :cert => client_cert.cert,
86
+ :key => client_cert.key,
87
+ :cert => client_cert.cert,
88
88
  :ca_file => ca.file
89
89
  }
90
90
  end
91
91
 
92
92
  %w[server client].each do |side|
93
- class_eval <<-RUBY, __FILE__, __LINE__
93
+ class_eval <<-RUBY, __FILE__, __LINE__ + 1
94
94
  def #{side}_cert
95
95
  @#{side}_cert ||= ChildCertificate.new ca
96
96
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.1
4
+ version: 5.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  - Erik Michaels-Ober
9
9
  - Alexey V. Zapparov
10
10
  - Zachary Anker
11
- autorequire:
11
+ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2020-03-29 00:00:00.000000000 Z
14
+ date: 2022-12-17 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: addressable
@@ -19,14 +19,14 @@ dependencies:
19
19
  requirements:
20
20
  - - "~>"
21
21
  - !ruby/object:Gem::Version
22
- version: '2.3'
22
+ version: '2.8'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - "~>"
28
28
  - !ruby/object:Gem::Version
29
- version: '2.3'
29
+ version: '2.8'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: http-cookie
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -56,19 +56,19 @@ dependencies:
56
56
  - !ruby/object:Gem::Version
57
57
  version: '2.2'
58
58
  - !ruby/object:Gem::Dependency
59
- name: http-parser
59
+ name: llhttp-ffi
60
60
  requirement: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - "~>"
63
63
  - !ruby/object:Gem::Version
64
- version: 1.2.0
64
+ version: 0.4.0
65
65
  type: :runtime
66
66
  prerelease: false
67
67
  version_requirements: !ruby/object:Gem::Requirement
68
68
  requirements:
69
69
  - - "~>"
70
70
  - !ruby/object:Gem::Version
71
- version: 1.2.0
71
+ version: 0.4.0
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: bundler
74
74
  requirement: !ruby/object:Gem::Requirement
@@ -91,11 +91,13 @@ executables: []
91
91
  extensions: []
92
92
  extra_rdoc_files: []
93
93
  files:
94
- - ".coveralls.yml"
94
+ - ".github/workflows/ci.yml"
95
95
  - ".gitignore"
96
96
  - ".rspec"
97
97
  - ".rubocop.yml"
98
- - ".travis.yml"
98
+ - ".rubocop/layout.yml"
99
+ - ".rubocop/style.yml"
100
+ - ".rubocop_todo.yml"
99
101
  - ".yardopts"
100
102
  - CHANGES.md
101
103
  - CONTRIBUTING.md
@@ -104,6 +106,7 @@ files:
104
106
  - LICENSE.txt
105
107
  - README.md
106
108
  - Rakefile
109
+ - SECURITY.md
107
110
  - http.gemspec
108
111
  - lib/http.rb
109
112
  - lib/http/chainable.rb
@@ -175,10 +178,12 @@ files:
175
178
  - spec/support/dummy_server.rb
176
179
  - spec/support/dummy_server/servlet.rb
177
180
  - spec/support/fakeio.rb
181
+ - spec/support/fuubar.rb
178
182
  - spec/support/http_handling_shared.rb
179
183
  - spec/support/proxy_server.rb
180
184
  - spec/support/servers/config.rb
181
185
  - spec/support/servers/runner.rb
186
+ - spec/support/simplecov.rb
182
187
  - spec/support/ssl_helper.rb
183
188
  homepage: https://github.com/httprb/http
184
189
  licenses:
@@ -187,8 +192,9 @@ metadata:
187
192
  source_code_uri: https://github.com/httprb/http
188
193
  wiki_uri: https://github.com/httprb/http/wiki
189
194
  bug_tracker_uri: https://github.com/httprb/http/issues
190
- changelog_uri: https://github.com/httprb/http/blob/v4.4.1/CHANGES.md
191
- post_install_message:
195
+ changelog_uri: https://github.com/httprb/http/blob/v5.1.1/CHANGES.md
196
+ rubygems_mfa_required: 'true'
197
+ post_install_message:
192
198
  rdoc_options: []
193
199
  require_paths:
194
200
  - lib
@@ -196,7 +202,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
202
  requirements:
197
203
  - - ">="
198
204
  - !ruby/object:Gem::Version
199
- version: '2.3'
205
+ version: '2.6'
200
206
  required_rubygems_version: !ruby/object:Gem::Requirement
201
207
  requirements:
202
208
  - - ">="
@@ -204,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
204
210
  version: '0'
205
211
  requirements: []
206
212
  rubygems_version: 3.0.3
207
- signing_key:
213
+ signing_key:
208
214
  specification_version: 4
209
215
  summary: HTTP should be easy
210
216
  test_files:
@@ -243,8 +249,10 @@ test_files:
243
249
  - spec/support/dummy_server.rb
244
250
  - spec/support/dummy_server/servlet.rb
245
251
  - spec/support/fakeio.rb
252
+ - spec/support/fuubar.rb
246
253
  - spec/support/http_handling_shared.rb
247
254
  - spec/support/proxy_server.rb
248
255
  - spec/support/servers/config.rb
249
256
  - spec/support/servers/runner.rb
257
+ - spec/support/simplecov.rb
250
258
  - spec/support/ssl_helper.rb
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service-name: travis-pro