http 3.1.0 → 3.2.0

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
  SHA1:
3
- metadata.gz: 42fd5a5fec6c2e6448908c9578bf27175a291933
4
- data.tar.gz: 03a31ca5372bf0e9e2c5dcae9a8e06d9a7e38c56
3
+ metadata.gz: f5e1c6e74ac078db494c4b2196a43018b75db1dc
4
+ data.tar.gz: 8bf04adb251ff46dc31190ce865736c13c7317a2
5
5
  SHA512:
6
- metadata.gz: abc5ea24f0d2eb18022994003ab416bfddaa8976fc58bb41169eac32431b70838255d9956d710581da1ec844e0c85243d7fa937c0603122a8d61211b47bc80ae
7
- data.tar.gz: 4b25eb0dac0ad59a5688ec5298253975c8ff186dde6d181cb8276e8e2aeafe235305f3c1717bc8c4171a551bf965215c4e0f05cda30dc79cd1bd03f6a3aa204f
6
+ metadata.gz: 702c1c5e63d582319859b9f6da99d4192141f6162237e593bb50e70e87cb0a54e0b6bcc43bfedce1e02cb1b7cc2c7cfbf18fcab903cf99a5b4f6362419a98d44
7
+ data.tar.gz: 44e4070afc9aeae5b0ba5c5f6c74d87df2c5a5656175e26d3cc485418316e84ec23c36dccd7e9b4d2a9595b09d117a1bdff0714cca432f337cc770b3840da222
data/CHANGES.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## 3.2.0 (2018-04-22)
2
+
3
+ This vresion backports one change we missed to backport in previous release:
4
+
5
+ * Reduce memory usage when reading response body
6
+ ([@janko-m])
7
+
8
+
1
9
  ## 3.1.0 (2018-04-22)
2
10
 
3
11
  This version backports some of the fixes and improvements made to development
@@ -35,6 +35,7 @@ module HTTP
35
35
  @pending_request = false
36
36
  @pending_response = false
37
37
  @failed_proxy_connect = false
38
+ @buffer = "".b
38
39
 
39
40
  @parser = Response::Parser.new
40
41
 
@@ -212,7 +213,7 @@ module HTTP
212
213
  def read_more(size)
213
214
  return if @parser.finished?
214
215
 
215
- value = @socket.readpartial(size)
216
+ value = @socket.readpartial(size, @buffer)
216
217
  if value == :eof
217
218
  @parser << ""
218
219
  :eof
@@ -48,8 +48,8 @@ module HTTP
48
48
  end
49
49
 
50
50
  # Read from the socket
51
- def readpartial(size)
52
- perform_io { read_nonblock(size) }
51
+ def readpartial(size, buffer = nil)
52
+ perform_io { read_nonblock(size, buffer) }
53
53
  end
54
54
 
55
55
  # Write to the socket
@@ -62,16 +62,16 @@ module HTTP
62
62
  private
63
63
 
64
64
  if RUBY_VERSION < "2.1.0"
65
- def read_nonblock(size)
66
- @socket.read_nonblock(size)
65
+ def read_nonblock(size, buffer = nil)
66
+ @socket.read_nonblock(size, buffer)
67
67
  end
68
68
 
69
69
  def write_nonblock(data)
70
70
  @socket.write_nonblock(data)
71
71
  end
72
72
  else
73
- def read_nonblock(size)
74
- @socket.read_nonblock(size, :exception => false)
73
+ def read_nonblock(size, buffer = nil)
74
+ @socket.read_nonblock(size, buffer, :exception => false)
75
75
  end
76
76
 
77
77
  def write_nonblock(data)
@@ -41,8 +41,8 @@ module HTTP
41
41
  end
42
42
 
43
43
  # Read from the socket
44
- def readpartial(size)
45
- @socket.readpartial(size)
44
+ def readpartial(size, buffer = nil)
45
+ @socket.readpartial(size, buffer)
46
46
  rescue EOFError
47
47
  :eof
48
48
  end
@@ -39,9 +39,9 @@ module HTTP
39
39
  # NIO with exceptions
40
40
  if RUBY_VERSION < "2.1.0"
41
41
  # Read data from the socket
42
- def readpartial(size)
42
+ def readpartial(size, buffer = nil)
43
43
  rescue_readable do
44
- @socket.read_nonblock(size)
44
+ @socket.read_nonblock(size, buffer)
45
45
  end
46
46
  rescue EOFError
47
47
  :eof
@@ -59,10 +59,10 @@ module HTTP
59
59
  # NIO without exceptions
60
60
  else
61
61
  # Read data from the socket
62
- def readpartial(size)
62
+ def readpartial(size, buffer = nil)
63
63
  timeout = false
64
64
  loop do
65
- result = @socket.read_nonblock(size, :exception => false)
65
+ result = @socket.read_nonblock(size, buffer, :exception => false)
66
66
 
67
67
  return :eof if result.nil?
68
68
  return result if result != :wait_readable
data/lib/http/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP
4
- VERSION = "3.1.0"
4
+ VERSION = "3.2.0"
5
5
  end
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: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri