degzipper 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 9a36b7f29e14fe05b8873d292452bf787cde984f
4
- data.tar.gz: d18190258ac989ccff637b97f0b6b2fbd3ac8883
3
+ metadata.gz: ee39cde684c0493cba8587318e2f16a37925b1cc
4
+ data.tar.gz: 712f518e9a307afd97170c1d8132bc31253a83e4
5
5
  SHA512:
6
- metadata.gz: 3651b710bd5659f4f986f4e43ccaeae217854f18eeef3f6b22e69a54d025c1abaadaa0bc34a9a7fdc06a1d7cf2729717c3578a8451e1d59111e001b48b1cf39b
7
- data.tar.gz: 625046d22854e92f3fb59e7f2b1476631b889906805796b196eb3eb24f5c9e79cea053eea14bc9d420488cda9447da83e5333a93a2bf4dcd6fe91174a924813d
6
+ metadata.gz: 300a3b34f87eefd8eed351654d4c98e4fe3d308d59362ce8a3c0e04b6fadf65574dcdd5043ac6774ec5af4f93f4f3edc06ae89ceafc46dd4344dc05d7cf76154
7
+ data.tar.gz: f7bf0adfd814f1ef374cc5a82ab575a3b7b0d3957f2168d25fd372de77b8da572365207b873658f87d6945728906bdb9c68c55187f0dfc07660ca381fc952183
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.0.5] - 2015-06-30
4
+
5
+ ### Fixed
6
+ - [Fix reading when content-length is large (#4)](https://github.com/andrhamm/degzipper/pull/4)
7
+
8
+
3
9
  ## [0.0.4] - 2015-06-29
4
10
 
5
11
  ### Fixed
@@ -27,12 +27,15 @@ module Degzipper
27
27
  end
28
28
 
29
29
  def decode(input, content_encoding)
30
+ # type of input depends on CONTENT_LENGTH
31
+ # if CONTENT_LENGTH < 20k it's StringIO; if more it's Tempfile
32
+ # that's why use only common methods of these types
30
33
  case content_encoding
31
34
  when 'gzip' then Zlib::GzipReader.new(input).read
32
- when 'zlib' then Zlib::Inflate.inflate(input.string)
35
+ when 'zlib' then Zlib::Inflate.inflate(input.read)
33
36
  when 'deflate'
34
37
  stream = Zlib::Inflate.new(-Zlib::MAX_WBITS)
35
- content = stream.inflate(input.string)
38
+ content = stream.inflate(input.read)
36
39
  stream.finish
37
40
  stream.close
38
41
  content
@@ -1,3 +1,3 @@
1
1
  module Degzipper
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -59,6 +59,20 @@ RSpec.describe Degzipper::Middleware do
59
59
  'length' => 6
60
60
  )
61
61
  end
62
+
63
+ it 'handles a tmp files as well' do
64
+ Tempfile.open('degzipper') do |stream|
65
+ stream << compress('hello')
66
+ stream.rewind
67
+ resp = make_request(stream, type)
68
+
69
+ expect(resp).to eq(
70
+ 'body' => 'hello',
71
+ 'content_encoding' => nil,
72
+ 'length' => 5
73
+ )
74
+ end
75
+ end
62
76
  end
63
77
 
64
78
  context 'gzip' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: degzipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Hammond
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-06-29 00:00:00.000000000 Z
12
+ date: 2015-06-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler