http 0.9.8 → 0.9.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33850aa83bf574cc7c05572dd92bc190e198b6e4
4
- data.tar.gz: 5b7a2359fc586d691b85e59921bec5d1bcfb5b1d
3
+ metadata.gz: e30cb4fb424a8cc7177fef986701d40f763c79f1
4
+ data.tar.gz: c591281ad736c5981881378c5f02aebe34d2770d
5
5
  SHA512:
6
- metadata.gz: cf74a760183582d0bedf897f870a39607e3f808e24a64e0e89084cb4d038884f7b5cc891cb0062859799d497d7089253ec09c997e8b5719c42c9563629951cb0
7
- data.tar.gz: 8fd03c0819fb1dc1e41deef051b3f3039b6e41c11f15509e4f96234decaec95d2776491ef384d3a7cdbde4eb8c7b3dd85b149bf702d93b2c2cc2b14ae3230728
6
+ metadata.gz: 9158b6f918b5bd8400fb1c5467058198e63b910b651bd5fc950e95f3481f84ba84c94a8e1e59f817185ff4b346e426bb3c4554eca1f22db8db5a5fff84c9b74d
7
+ data.tar.gz: efb3e652ed99710318b3fff185db47bd99234a8f1777e6ff77029150b2c05fa422dd5da7ee0e1bc8c2132ba3a269626422d2b44290750c9d772ca0edb1ee8f36
data/CHANGES.md CHANGED
@@ -1,9 +1,21 @@
1
+ ## 0.9.9 (2016-03-16)
2
+
3
+ * *BACKPORT* [#318](https://github.com/httprb/http/pull/318)
4
+ Remove redundant string allocations upon header names normalization.
5
+ ([@ixti])
6
+
7
+ * *BACKPORT* [#295](https://github.com/httprb/http/pull/295):
8
+ Fix redirect following when used with persistent mode.
9
+ ([@ixti])
10
+
11
+
1
12
  ## 0.9.8 (2015-09-29)
2
13
 
3
14
  * [#260](https://github.com/httprb/http/pull/258):
4
15
  Fixed global timeout persisting time left across requests when reusing connections.
5
16
  ([@zanker][])
6
17
 
18
+
7
19
  ## 0.9.7 (2015-09-19)
8
20
 
9
21
  * [#258](https://github.com/httprb/http/pull/258):
data/lib/http/headers.rb CHANGED
@@ -11,11 +11,11 @@ module HTTP
11
11
  include Enumerable
12
12
 
13
13
  # Matches HTTP header names when in "Canonical-Http-Format"
14
- CANONICAL_HEADER = /^[A-Z][a-z]*(-[A-Z][a-z]*)*$/
14
+ CANONICAL_NAME_RE = /^[A-Z][a-z]*(?:-[A-Z][a-z]*)*$/
15
15
 
16
16
  # Matches valid header field name according to RFC.
17
17
  # @see http://tools.ietf.org/html/rfc7230#section-3.2
18
- HEADER_NAME_RE = /^[A-Za-z0-9!#\$%&'*+\-.^_`|~]+$/
18
+ COMPLIANT_NAME_RE = /^[A-Za-z0-9!#\$%&'*+\-.^_`|~]+$/
19
19
 
20
20
  # Class constructor.
21
21
  def initialize
@@ -194,10 +194,11 @@ module HTTP
194
194
  # match {HEADER_NAME_RE}
195
195
  # @return [String] canonical HTTP header name
196
196
  def normalize_header(name)
197
- normalized = name[CANONICAL_HEADER]
198
- normalized ||= name.split(/[\-_]/).map(&:capitalize).join("-")
197
+ return name if name =~ CANONICAL_NAME_RE
199
198
 
200
- return normalized if normalized =~ HEADER_NAME_RE
199
+ normalized = name.split(/[\-_]/).each(&:capitalize!).join("-")
200
+
201
+ return normalized if normalized =~ COMPLIANT_NAME_RE
201
202
 
202
203
  fail InvalidHeaderNameError, "Invalid HTTP header field name: #{name.inspect}"
203
204
  end
@@ -54,6 +54,8 @@ module HTTP
54
54
  fail TooManyRedirectsError if too_many_hops?
55
55
  fail EndlessRedirectError if endless_loop?
56
56
 
57
+ @response.flush
58
+
57
59
  @request = redirect_to @response.headers[Headers::LOCATION]
58
60
  @response = yield @request
59
61
  end
data/lib/http/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module HTTP
2
- VERSION = "0.9.8".freeze
2
+ VERSION = "0.9.9".freeze
3
3
  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: 0.9.8
4
+ version: 0.9.9
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: 2015-09-29 00:00:00.000000000 Z
14
+ date: 2016-03-16 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: http_parser.rb
@@ -184,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  requirements: []
186
186
  rubyforge_project:
187
- rubygems_version: 2.4.5.1
187
+ rubygems_version: 2.2.5
188
188
  signing_key:
189
189
  specification_version: 4
190
190
  summary: HTTP should be easy