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 +4 -4
- data/CHANGES.md +8 -0
- data/lib/http/connection.rb +2 -1
- data/lib/http/timeout/global.rb +6 -6
- data/lib/http/timeout/null.rb +2 -2
- data/lib/http/timeout/per_operation.rb +4 -4
- data/lib/http/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e1c6e74ac078db494c4b2196a43018b75db1dc
|
4
|
+
data.tar.gz: 8bf04adb251ff46dc31190ce865736c13c7317a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/http/connection.rb
CHANGED
@@ -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
|
data/lib/http/timeout/global.rb
CHANGED
@@ -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)
|
data/lib/http/timeout/null.rb
CHANGED
@@ -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