http 1.0.3 → 1.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 +4 -4
- data/CHANGES.md +18 -1
- data/lib/http/response/status/reasons.rb +1 -0
- data/lib/http/timeout/global.rb +12 -28
- data/lib/http/timeout/null.rb +13 -36
- data/lib/http/timeout/per_operation.rb +7 -7
- data/lib/http/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a554e4ac3df247f5abcf5fc5af7707604576e23
|
4
|
+
data.tar.gz: 04e6c88e86d14fbbfaa6af5db48ba28e83cf02ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 064656c4992d84ffe71bebe1cbcb83e1f32b8b33dc350a1d87e3fdc4893288697503bf36f0f27ea95cdbb4d0788aa3dd96cb69f9b3029fa4d99336d78aa12a45
|
7
|
+
data.tar.gz: 920dfb6d29655e9147d22e6f8f0ccad6075c8c77c0cde3ee3bc4ad0d8dcc3120fb387f59909d60c3a142bf6c0744b0138a81c40e2bea9ef105e1583c229f9c3c
|
data/CHANGES.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
## 1.0.4 (2016-03-19)
|
2
|
+
|
3
|
+
* [#320](https://github.com/httprb/http/pull/320)
|
4
|
+
Fix timeout regression.
|
5
|
+
([@tarcieri])
|
6
|
+
|
7
|
+
|
1
8
|
## 1.0.3 (2016-03-16)
|
2
9
|
|
3
10
|
* [#314](https://github.com/httprb/http/pull/314)
|
4
11
|
Validate charset before forcing encoding.
|
5
12
|
([@kylekyle])
|
6
13
|
|
7
|
-
|
8
14
|
* [#318](https://github.com/httprb/http/pull/318)
|
9
15
|
Remove redundant string allocations upon header names normalization.
|
10
16
|
([@ixti])
|
@@ -74,6 +80,17 @@
|
|
74
80
|
([@tarcieri])
|
75
81
|
|
76
82
|
|
83
|
+
## 0.9.9 (2016-03-16)
|
84
|
+
|
85
|
+
* *BACKPORT* [#318](https://github.com/httprb/http/pull/318)
|
86
|
+
Remove redundant string allocations upon header names normalization.
|
87
|
+
([@ixti])
|
88
|
+
|
89
|
+
* *BACKPORT* [#295](https://github.com/httprb/http/pull/295):
|
90
|
+
Fix redirect following when used with persistent mode.
|
91
|
+
([@ixti])
|
92
|
+
|
93
|
+
|
77
94
|
## 0.9.8 (2015-09-29)
|
78
95
|
|
79
96
|
* [#260](https://github.com/httprb/http/pull/260):
|
data/lib/http/timeout/global.rb
CHANGED
@@ -32,13 +32,13 @@ module HTTP
|
|
32
32
|
reset_timer
|
33
33
|
|
34
34
|
begin
|
35
|
-
|
35
|
+
socket.connect_nonblock
|
36
36
|
rescue IO::WaitReadable
|
37
|
-
IO.select([
|
37
|
+
IO.select([socket], nil, nil, time_left)
|
38
38
|
log_time
|
39
39
|
retry
|
40
40
|
rescue IO::WaitWritable
|
41
|
-
IO.select(nil, [
|
41
|
+
IO.select(nil, [socket], nil, time_left)
|
42
42
|
log_time
|
43
43
|
retry
|
44
44
|
end
|
@@ -104,32 +104,16 @@ module HTTP
|
|
104
104
|
:eof
|
105
105
|
end
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
end
|
113
|
-
|
114
|
-
# Wait for a socket to become writable
|
115
|
-
def wait_writable_or_timeout
|
116
|
-
IO.select(nil, [@socket], nil, time_left)
|
117
|
-
log_time
|
118
|
-
end
|
119
|
-
else
|
120
|
-
require "io/wait"
|
121
|
-
|
122
|
-
# Wait for a socket to become readable
|
123
|
-
def wait_readable_or_timeout
|
124
|
-
@socket.to_io.wait_readable(time_left)
|
125
|
-
log_time
|
126
|
-
end
|
107
|
+
# Wait for a socket to become readable
|
108
|
+
def wait_readable_or_timeout
|
109
|
+
IO.select([@socket], nil, nil, time_left)
|
110
|
+
log_time
|
111
|
+
end
|
127
112
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
end
|
113
|
+
# Wait for a socket to become writable
|
114
|
+
def wait_writable_or_timeout
|
115
|
+
IO.select(nil, [@socket], nil, time_left)
|
116
|
+
log_time
|
133
117
|
end
|
134
118
|
|
135
119
|
# Due to the run/retry nature of nonblocking I/O, it's easier to keep track of time
|
data/lib/http/timeout/null.rb
CHANGED
@@ -50,45 +50,22 @@ module HTTP
|
|
50
50
|
end
|
51
51
|
alias << write
|
52
52
|
|
53
|
-
# These cops can be re-eanbled after we go Ruby 2.0+ only
|
54
|
-
# rubocop:disable Lint/UselessAccessModifier, Metrics/BlockNesting
|
55
|
-
|
56
53
|
private
|
57
54
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
end
|
66
|
-
|
67
|
-
# Retry writing
|
68
|
-
def rescue_writable
|
69
|
-
yield
|
70
|
-
rescue IO::WaitWritable
|
71
|
-
retry if IO.select(nil, [@socket], nil, write_timeout)
|
72
|
-
raise TimeoutError, "Write timed out after #{write_timeout} seconds"
|
73
|
-
end
|
74
|
-
else
|
75
|
-
require "io/wait"
|
76
|
-
|
77
|
-
# Retry reading
|
78
|
-
def rescue_readable
|
79
|
-
yield
|
80
|
-
rescue IO::WaitReadable
|
81
|
-
retry if @socket.to_io.wait_readable(read_timeout)
|
82
|
-
raise TimeoutError, "Read timed out after #{read_timeout} seconds"
|
83
|
-
end
|
55
|
+
# Retry reading
|
56
|
+
def rescue_readable
|
57
|
+
yield
|
58
|
+
rescue IO::WaitReadable
|
59
|
+
retry if IO.select([socket], nil, nil, read_timeout)
|
60
|
+
raise TimeoutError, "Read timed out after #{read_timeout} seconds"
|
61
|
+
end
|
84
62
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
63
|
+
# Retry writing
|
64
|
+
def rescue_writable
|
65
|
+
yield
|
66
|
+
rescue IO::WaitWritable
|
67
|
+
retry if IO.select(nil, [socket], nil, write_timeout)
|
68
|
+
raise TimeoutError, "Write timed out after #{write_timeout} seconds"
|
92
69
|
end
|
93
70
|
end
|
94
71
|
end
|
@@ -39,7 +39,7 @@ module HTTP
|
|
39
39
|
# Read data from the socket
|
40
40
|
def readpartial(size)
|
41
41
|
rescue_readable do
|
42
|
-
|
42
|
+
socket.read_nonblock(size)
|
43
43
|
end
|
44
44
|
rescue EOFError
|
45
45
|
:eof
|
@@ -48,7 +48,7 @@ module HTTP
|
|
48
48
|
# Write data to the socket
|
49
49
|
def write(data)
|
50
50
|
rescue_writable do
|
51
|
-
|
51
|
+
socket.write_nonblock(data)
|
52
52
|
end
|
53
53
|
rescue EOFError
|
54
54
|
:eof
|
@@ -59,14 +59,14 @@ module HTTP
|
|
59
59
|
# Read data from the socket
|
60
60
|
def readpartial(size)
|
61
61
|
loop do
|
62
|
-
result =
|
62
|
+
result = socket.read_nonblock(size, :exception => false)
|
63
63
|
if result.nil?
|
64
64
|
return :eof
|
65
65
|
elsif result != :wait_readable
|
66
66
|
return result
|
67
67
|
end
|
68
68
|
|
69
|
-
unless
|
69
|
+
unless IO.select([socket], nil, nil, read_timeout)
|
70
70
|
fail TimeoutError, "Read timed out after #{read_timeout} seconds"
|
71
71
|
end
|
72
72
|
end
|
@@ -75,11 +75,11 @@ module HTTP
|
|
75
75
|
# Write data to the socket
|
76
76
|
def write(data)
|
77
77
|
loop do
|
78
|
-
result =
|
78
|
+
result = socket.write_nonblock(data, :exception => false)
|
79
79
|
return result unless result == :wait_writable
|
80
80
|
|
81
|
-
unless
|
82
|
-
fail TimeoutError, "
|
81
|
+
unless IO.select(nil, [socket], nil, write_timeout)
|
82
|
+
fail TimeoutError, "Read timed out after #{write_timeout} seconds"
|
83
83
|
end
|
84
84
|
end
|
85
85
|
end
|
data/lib/http/version.rb
CHANGED
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: 1.0.
|
4
|
+
version: 1.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: 2016-03-
|
14
|
+
date: 2016-03-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: http_parser.rb
|
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
182
|
version: '0'
|
183
183
|
requirements: []
|
184
184
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
185
|
+
rubygems_version: 2.5.1
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: HTTP should be easy
|