http 2.2.1 → 2.2.2

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: d9dcdebfa768fef6850eb95f309e613e7dabff6e
4
- data.tar.gz: ef6556edd618dc48d214b6e4dd0b3eae123a2640
3
+ metadata.gz: 66bda3b695b673507461ef5f59bc3d14a145fc78
4
+ data.tar.gz: 69c82f1484defda8becec34ef76caf0a59e2d378
5
5
  SHA512:
6
- metadata.gz: 1c5b7284269683e79dc40f00784745498483ba98a9931ff1fcdd9141fdfeb77bddd96e29ee086c8611536ef6498456deb390afe64a138816f84eb347aaacd5a1
7
- data.tar.gz: 4d6fd7a909cffcbd7618fae1cebf984de0d3a85753725ac79997febfa46f67526f9d0e0eb2dd9e605d6809ad686acc00fba98f9ada46fb2f8b67d125c6b233bc
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
@@ -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 [String] host
115
- # @raise [Request::Error] if Host is invalid
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
- p_client = branch default_options.with_persistent host
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HTTP
4
- VERSION = "2.2.1".freeze
4
+ VERSION = "2.2.2".freeze
5
5
  end
@@ -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.1
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-02-06 00:00:00.000000000 Z
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