http 5.0.0.pre2 → 5.0.2

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +65 -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 +7 -124
  8. data/.rubocop_todo.yml +192 -0
  9. data/CHANGES.md +114 -1
  10. data/Gemfile +18 -11
  11. data/LICENSE.txt +1 -1
  12. data/README.md +13 -16
  13. data/Rakefile +2 -10
  14. data/http.gemspec +3 -3
  15. data/lib/http/chainable.rb +15 -14
  16. data/lib/http/client.rb +26 -15
  17. data/lib/http/connection.rb +7 -3
  18. data/lib/http/content_type.rb +10 -5
  19. data/lib/http/feature.rb +1 -1
  20. data/lib/http/features/auto_inflate.rb +0 -2
  21. data/lib/http/features/instrumentation.rb +1 -1
  22. data/lib/http/features/logging.rb +19 -21
  23. data/lib/http/headers.rb +3 -3
  24. data/lib/http/mime_type/adapter.rb +2 -0
  25. data/lib/http/options.rb +2 -2
  26. data/lib/http/redirector.rb +1 -1
  27. data/lib/http/request/writer.rb +5 -1
  28. data/lib/http/request.rb +22 -5
  29. data/lib/http/response/body.rb +5 -4
  30. data/lib/http/response/inflater.rb +1 -1
  31. data/lib/http/response/parser.rb +74 -62
  32. data/lib/http/response/status.rb +2 -2
  33. data/lib/http/response.rb +22 -4
  34. data/lib/http/timeout/global.rb +41 -35
  35. data/lib/http/timeout/null.rb +2 -1
  36. data/lib/http/timeout/per_operation.rb +56 -59
  37. data/lib/http/version.rb +1 -1
  38. data/spec/lib/http/client_spec.rb +109 -41
  39. data/spec/lib/http/features/auto_inflate_spec.rb +0 -1
  40. data/spec/lib/http/features/instrumentation_spec.rb +21 -16
  41. data/spec/lib/http/features/logging_spec.rb +2 -5
  42. data/spec/lib/http/headers_spec.rb +3 -3
  43. data/spec/lib/http/redirector_spec.rb +44 -0
  44. data/spec/lib/http/request/writer_spec.rb +12 -1
  45. data/spec/lib/http/response/body_spec.rb +5 -5
  46. data/spec/lib/http/response/parser_spec.rb +30 -1
  47. data/spec/lib/http/response_spec.rb +62 -10
  48. data/spec/lib/http_spec.rb +20 -2
  49. data/spec/spec_helper.rb +21 -21
  50. data/spec/support/black_hole.rb +1 -1
  51. data/spec/support/dummy_server/servlet.rb +14 -2
  52. data/spec/support/dummy_server.rb +1 -1
  53. data/spec/support/fuubar.rb +21 -0
  54. data/spec/support/simplecov.rb +19 -0
  55. metadata +23 -17
  56. data/.coveralls.yml +0 -1
  57. data/.travis.yml +0 -38
@@ -2,7 +2,7 @@
2
2
 
3
3
  module BlackHole
4
4
  class << self
5
- def method_missing(*) # rubocop:disable Style/MethodMissingSuper
5
+ def method_missing(*)
6
6
  self
7
7
  end
8
8
 
@@ -156,7 +156,7 @@ class DummyServer < WEBrick::HTTPServer
156
156
  res.status = 200
157
157
 
158
158
  res.body = case req["Accept-Encoding"]
159
- when "gzip" then
159
+ when "gzip"
160
160
  res["Content-Encoding"] = "gzip"
161
161
  StringIO.open do |out|
162
162
  Zlib::GzipWriter.wrap(out) do |gz|
@@ -165,12 +165,24 @@ class DummyServer < WEBrick::HTTPServer
165
165
  out.tap(&:rewind).read
166
166
  end
167
167
  end
168
- when "deflate" then
168
+ when "deflate"
169
169
  res["Content-Encoding"] = "deflate"
170
170
  Zlib::Deflate.deflate("#{req.body}-deflated")
171
171
  else
172
172
  "#{req.body}-raw"
173
173
  end
174
174
  end
175
+
176
+ post "/no-content-204" do |req, res|
177
+ res.status = 204
178
+ res.body = ""
179
+
180
+ case req["Accept-Encoding"]
181
+ when "gzip"
182
+ res["Content-Encoding"] = "gzip"
183
+ when "deflate"
184
+ res["Content-Encoding"] = "deflate"
185
+ end
186
+ end
175
187
  end
176
188
  end
@@ -24,7 +24,7 @@ class DummyServer < WEBrick::HTTPServer
24
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
@@ -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
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: 5.0.0.pre2
4
+ version: 5.0.2
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-01-23 00:00:00.000000000 Z
14
+ date: 2021-09-10 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
@@ -175,10 +177,12 @@ files:
175
177
  - spec/support/dummy_server.rb
176
178
  - spec/support/dummy_server/servlet.rb
177
179
  - spec/support/fakeio.rb
180
+ - spec/support/fuubar.rb
178
181
  - spec/support/http_handling_shared.rb
179
182
  - spec/support/proxy_server.rb
180
183
  - spec/support/servers/config.rb
181
184
  - spec/support/servers/runner.rb
185
+ - spec/support/simplecov.rb
182
186
  - spec/support/ssl_helper.rb
183
187
  homepage: https://github.com/httprb/http
184
188
  licenses:
@@ -187,8 +191,8 @@ metadata:
187
191
  source_code_uri: https://github.com/httprb/http
188
192
  wiki_uri: https://github.com/httprb/http/wiki
189
193
  bug_tracker_uri: https://github.com/httprb/http/issues
190
- changelog_uri: https://github.com/httprb/http/blob/v5.0.0.pre2/CHANGES.md
191
- post_install_message:
194
+ changelog_uri: https://github.com/httprb/http/blob/v5.0.2/CHANGES.md
195
+ post_install_message:
192
196
  rdoc_options: []
193
197
  require_paths:
194
198
  - lib
@@ -196,15 +200,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
196
200
  requirements:
197
201
  - - ">="
198
202
  - !ruby/object:Gem::Version
199
- version: '2.3'
203
+ version: '2.5'
200
204
  required_rubygems_version: !ruby/object:Gem::Requirement
201
205
  requirements:
202
- - - ">"
206
+ - - ">="
203
207
  - !ruby/object:Gem::Version
204
- version: 1.3.1
208
+ version: '0'
205
209
  requirements: []
206
- rubygems_version: 3.1.2
207
- signing_key:
210
+ rubygems_version: 3.0.3
211
+ signing_key:
208
212
  specification_version: 4
209
213
  summary: HTTP should be easy
210
214
  test_files:
@@ -243,8 +247,10 @@ test_files:
243
247
  - spec/support/dummy_server.rb
244
248
  - spec/support/dummy_server/servlet.rb
245
249
  - spec/support/fakeio.rb
250
+ - spec/support/fuubar.rb
246
251
  - spec/support/http_handling_shared.rb
247
252
  - spec/support/proxy_server.rb
248
253
  - spec/support/servers/config.rb
249
254
  - spec/support/servers/runner.rb
255
+ - spec/support/simplecov.rb
250
256
  - spec/support/ssl_helper.rb
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service-name: travis-pro
data/.travis.yml DELETED
@@ -1,38 +0,0 @@
1
- language: ruby
2
- sudo: false
3
-
4
- cache: bundler
5
-
6
- before_install:
7
- - gem update --system
8
- - gem --version
9
- - gem install bundler
10
- - bundle --version
11
-
12
- install: bundle install --without development doc
13
-
14
- script: bundle exec rake
15
-
16
- env: JRUBY_OPTS="$JRUBY_OPTS --debug"
17
-
18
- rvm:
19
- # Include JRuby first because it takes the longest
20
- - jruby-9.2.5.0
21
- - 2.4
22
- - 2.5
23
- - 2.6
24
- - 2.7
25
-
26
- matrix:
27
- fast_finish: true
28
- include:
29
- # Only run RuboCop and Yardstick metrics on the latest Ruby
30
- - rvm: 2.7
31
- env: SUITE="rubocop"
32
- - rvm: 2.7
33
- env: SUITE="yardstick"
34
-
35
- branches:
36
- only:
37
- - master
38
- - 4-x-stable