http 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +9 -0
- data/README.md +4 -0
- data/lib/http/chainable.rb +8 -6
- data/lib/http/version.rb +1 -1
- data/spec/lib/http_spec.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 66bda3b695b673507461ef5f59bc3d14a145fc78
|
4
|
+
data.tar.gz: 69c82f1484defda8becec34ef76caf0a59e2d378
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1149d111a7b16ea0d02c30a5a5126c393ea86cda749341a2056c17cf5c5004ee1bb3faf416c9bc483d28771c7c0ad9af349a866bd209a394460b579561142be
|
7
|
+
data.tar.gz: 7e3a46cf89a76a1ff557f40740f3aa851a8dd3e9bc44f64146f62db7db4839f21fb5efce9aaf88826945c85d97820bfa7574bc8aea21a0e6551d7195120d5e51
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 2.2.2 (2017-04-27)
|
2
|
+
|
3
|
+
* [#404](https://github.com/httprb/http/issues/404),
|
4
|
+
[#405](https://github.com/httprb/http/pull/405)
|
5
|
+
Make keepalive timeout configurable.
|
6
|
+
([@nestegg])
|
7
|
+
|
8
|
+
|
1
9
|
## 2.2.1 (2017-02-06)
|
2
10
|
|
3
11
|
* [#395](https://github.com/httprb/http/issues/395)
|
@@ -585,3 +593,4 @@ end
|
|
585
593
|
[@britishtea]: https://github.com/britishtea
|
586
594
|
[@janko-m]: https://github.com/janko-m
|
587
595
|
[@Bonias]: https://github.com/Bonias
|
596
|
+
[@nestegg]: https://github.com/nestegg
|
data/README.md
CHANGED
@@ -6,6 +6,10 @@
|
|
6
6
|
[![Coverage Status](https://coveralls.io/repos/httprb/http/badge.svg?branch=master)](https://coveralls.io/r/httprb/http)
|
7
7
|
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/httprb/http/blob/master/LICENSE.txt)
|
8
8
|
|
9
|
+
_NOTE: This is the 2.x **stable** branch. For the 3.x **development** branch, please see:_
|
10
|
+
|
11
|
+
https://github.com/httprb/http/
|
12
|
+
|
9
13
|
## About
|
10
14
|
|
11
15
|
HTTP (The Gem! a.k.a. http.rb) is an easy-to-use client library for making requests
|
data/lib/http/chainable.rb
CHANGED
@@ -109,12 +109,13 @@ module HTTP
|
|
109
109
|
)
|
110
110
|
end
|
111
111
|
|
112
|
-
# @overload persistent(host)
|
112
|
+
# @overload persistent(host, timeout: 5)
|
113
113
|
# Flags as persistent
|
114
|
-
# @param
|
115
|
-
# @
|
114
|
+
# @param [String] host
|
115
|
+
# @option [Integer] timeout Keep alive timeout
|
116
|
+
# @raise [Request::Error] if Host is invalid
|
116
117
|
# @return [HTTP::Client] Persistent client
|
117
|
-
# @overload persistent(host, &block)
|
118
|
+
# @overload persistent(host, timeout: 5, &block)
|
118
119
|
# Executes given block with persistent client and automatically closes
|
119
120
|
# connection at the end of execution.
|
120
121
|
#
|
@@ -138,8 +139,9 @@ module HTTP
|
|
138
139
|
#
|
139
140
|
# @yieldparam [HTTP::Client] client Persistent client
|
140
141
|
# @return [Object] result of last expression in the block
|
141
|
-
def persistent(host)
|
142
|
-
|
142
|
+
def persistent(host, timeout: 5)
|
143
|
+
options = {:keep_alive_timeout => timeout}
|
144
|
+
p_client = branch default_options.merge(options).with_persistent host
|
143
145
|
return p_client unless block_given?
|
144
146
|
yield p_client
|
145
147
|
ensure
|
data/lib/http/version.rb
CHANGED
data/spec/lib/http_spec.rb
CHANGED
@@ -288,6 +288,14 @@ RSpec.describe HTTP do
|
|
288
288
|
end
|
289
289
|
end
|
290
290
|
end
|
291
|
+
|
292
|
+
context "with timeout specified" do
|
293
|
+
subject(:client) { HTTP.persistent host, :timeout => 100 }
|
294
|
+
it "sets keep_alive_timeout" do
|
295
|
+
options = client.default_options
|
296
|
+
expect(options.keep_alive_timeout).to eq(100)
|
297
|
+
end
|
298
|
+
end
|
291
299
|
end
|
292
300
|
|
293
301
|
describe ".timeout" do
|
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: 2.2.
|
4
|
+
version: 2.2.2
|
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: 2017-
|
14
|
+
date: 2017-04-27 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: http_parser.rb
|