http 4.0.3 → 4.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11cd466b5be40e3caba90c9df54f90c3b927d4a3eae307b41f6c4e97fa0e453b
4
- data.tar.gz: 33b04d19cdb16ff4ef7ac4e09b79266ccb9474f2bed845b70a25c1ae7382ee5f
3
+ metadata.gz: 3c750c774b9ba9cef7d527d45863f20afe38fb2dada51404f555b3465c9d2ba5
4
+ data.tar.gz: c0421af748f924466afe818a52dc7a02598010446aa1c91e40ac02ca82278b43
5
5
  SHA512:
6
- metadata.gz: 40c8b29c85f85f64c0e6205df50cf96df6c60959ff770de9813119d1cc70a8e4fd7b70e5013980c5449b0076ef7dd0f906180d44b6037a930068997acbac2d45
7
- data.tar.gz: aacd288d0353724d3c353ffebacbd4e34ea73f32102ced92e7b1c30e76ee12e1a7ae7ee48cc203239176ffac0bcb861c0ad5e990c3dfbd20c5197b45ca6472f0
6
+ metadata.gz: 6a7e7d036484d7145f5cc8a5c077dbed71783125ebeedeb5965c0648a01d0dc596baed4b209a150a1e0848d3002eb285f16fe804c74ecca90a97d3a4f1871d5a
7
+ data.tar.gz: fb1c8d8c5ca3c4b8aa5f863d789e47516c8e19dc2ad4f132b8be8509b766fc0e3a8d3ddddc1233db8fc816dc6bc6f0acff80ead1fb5515e1d48cb10b4fd031f9
data/CHANGES.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## 4.0.4 (2019-02-12)
2
+
3
+ * Backport [#506](https://github.com/httprb/http/pull/506) from master.
4
+ Skip auto-deflate when there is no body.
5
+ ([@Bonias])
6
+
7
+
1
8
  ## 4.0.3 (2019-01-18)
2
9
 
3
10
  * Fix missing URL in response wrapped by auto inflate.
@@ -160,14 +160,6 @@ module HTTP
160
160
  headers[Headers::COOKIE] = cookies
161
161
  end
162
162
 
163
- if (auto_deflate = opts.feature(:auto_deflate))
164
- # We need to delete Content-Length header. It will be set automatically
165
- # by HTTP::Request::Writer
166
- headers.delete(Headers::CONTENT_LENGTH)
167
-
168
- headers[Headers::CONTENT_ENCODING] = auto_deflate.method
169
- end
170
-
171
163
  headers
172
164
  end
173
165
 
@@ -20,6 +20,11 @@ module HTTP
20
20
 
21
21
  def wrap_request(request)
22
22
  return request unless method
23
+ return request if request.body.size.zero?
24
+
25
+ # We need to delete Content-Length header. It will be set automatically by HTTP::Request::Writer
26
+ request.headers.delete(Headers::CONTENT_LENGTH)
27
+ request.headers[Headers::CONTENT_ENCODING] = method
23
28
 
24
29
  Request.new(
25
30
  :version => request.version,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP
4
- VERSION = "4.0.3"
4
+ VERSION = "4.0.4"
5
5
  end
@@ -234,7 +234,7 @@ RSpec.describe HTTP::Client do
234
234
 
235
235
  context "when :auto_deflate was specified" do
236
236
  let(:headers) { {"Content-Length" => "12"} }
237
- let(:client) { described_class.new :headers => headers, :features => {:auto_deflate => {}} }
237
+ let(:client) { described_class.new :headers => headers, :features => {:auto_deflate => {}}, :body => "foo" }
238
238
 
239
239
  it "deletes Content-Length header" do
240
240
  expect(client).to receive(:perform) do |req, _|
@@ -251,6 +251,18 @@ RSpec.describe HTTP::Client do
251
251
 
252
252
  client.request(:get, "http://example.com/")
253
253
  end
254
+
255
+ context "and there is no body" do
256
+ let(:client) { described_class.new :headers => headers, :features => {:auto_deflate => {}} }
257
+
258
+ it "doesn't set Content-Encoding header" do
259
+ expect(client).to receive(:perform) do |req, _|
260
+ expect(req.headers).not_to include "Content-Encoding"
261
+ end
262
+
263
+ client.request(:get, "http://example.com/")
264
+ end
265
+ end
254
266
  end
255
267
  end
256
268
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.3
4
+ version: 4.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2019-01-18 00:00:00.000000000 Z
14
+ date: 2019-02-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: http_parser.rb
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  - !ruby/object:Gem::Version
198
198
  version: '0'
199
199
  requirements: []
200
- rubygems_version: 3.0.2
200
+ rubygems_version: 3.0.1
201
201
  signing_key:
202
202
  specification_version: 4
203
203
  summary: HTTP should be easy