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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ce1cd065ce4c93b81a5a28a949354322222d0d78
4
- data.tar.gz: e4b2d331cc30a7780425ec9248c14ba43fcab9ad
3
+ metadata.gz: 6a554e4ac3df247f5abcf5fc5af7707604576e23
4
+ data.tar.gz: 04e6c88e86d14fbbfaa6af5db48ba28e83cf02ab
5
5
  SHA512:
6
- metadata.gz: 7fe63ab93211bb553b5f5ec8b9d62f2a7279c0896dc30ff2ff6dc1afdda0c89efcf1193f4032232aec011f2cf77f613d75a77763dfa3ba656ce07e98b72976e0
7
- data.tar.gz: 94cfd48b04617ab0966222097c2cf11c10c6567dcc89e7decea6dd2d927e9f199cb80f8609f759ecdfa38d57ad894def14c440367f27b0d06d3b5d2bb7b3cf98
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):
@@ -61,6 +61,7 @@ module HTTP
61
61
  428 => "Precondition Required",
62
62
  429 => "Too Many Requests",
63
63
  431 => "Request Header Fields Too Large",
64
+ 451 => "Unavailable For Legal Reasons",
64
65
  500 => "Internal Server Error",
65
66
  501 => "Not Implemented",
66
67
  502 => "Bad Gateway",
@@ -32,13 +32,13 @@ module HTTP
32
32
  reset_timer
33
33
 
34
34
  begin
35
- @socket.connect_nonblock
35
+ socket.connect_nonblock
36
36
  rescue IO::WaitReadable
37
- IO.select([@socket], nil, nil, time_left)
37
+ IO.select([socket], nil, nil, time_left)
38
38
  log_time
39
39
  retry
40
40
  rescue IO::WaitWritable
41
- IO.select(nil, [@socket], nil, time_left)
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
- if RUBY_VERSION < "2.0.0"
108
- # Wait for a socket to become readable
109
- def wait_readable_or_timeout
110
- IO.select([@socket], nil, nil, time_left)
111
- log_time
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
- # Wait for a socket to become writable
129
- def wait_writable_or_timeout
130
- @socket.to_io.wait_writable(time_left)
131
- log_time
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
@@ -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
- if RUBY_VERSION < "2.0.0"
59
- # Retry reading
60
- def rescue_readable
61
- yield
62
- rescue IO::WaitReadable
63
- retry if IO.select([@socket], nil, nil, read_timeout)
64
- raise TimeoutError, "Read timed out after #{read_timeout} seconds"
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
- # Retry writing
86
- def rescue_writable
87
- yield
88
- rescue IO::WaitWritable
89
- retry if @socket.to_io.wait_writable(write_timeout)
90
- raise TimeoutError, "Write timed out after #{write_timeout} seconds"
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
- @socket.read_nonblock(size)
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
- @socket.write_nonblock(data)
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 = @socket.read_nonblock(size, :exception => false)
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 @socket.to_io.wait_readable(read_timeout)
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 = @socket.write_nonblock(data, :exception => false)
78
+ result = socket.write_nonblock(data, :exception => false)
79
79
  return result unless result == :wait_writable
80
80
 
81
- unless @socket.to_io.wait_writable(write_timeout)
82
- fail TimeoutError, "Write timed out after #{write_timeout} seconds"
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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module HTTP
3
- VERSION = "1.0.3".freeze
3
+ VERSION = "1.0.4".freeze
4
4
  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: 1.0.3
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-16 00:00:00.000000000 Z
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.2.5
185
+ rubygems_version: 2.5.1
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: HTTP should be easy