protocol-http 0.12.3 → 0.13.0

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
  SHA256:
3
- metadata.gz: 612f8d39d751eed9e5feea86fa2e13410db39212516781b27123df10b734e617
4
- data.tar.gz: 8452e8012d6030e6df8939affbc360ba9821856caec1a67880156214b672d9b9
3
+ metadata.gz: aaedc5d52136df376d80d220a1fe0a849e1b2dbcd7162045a2fc808b3f4e7469
4
+ data.tar.gz: 85b18d9212f2c5d3b544602356e5648b2fa221d0be36e79e7ca43cb7f9b84ada
5
5
  SHA512:
6
- metadata.gz: 7138cc65436789faf0448ab30bd550bc2f733c37c06fec803e764127fea244b68bdcde6f6abab29b54f31b126e647c402071b18f5b8e47ff01d65069e604b8f2
7
- data.tar.gz: 6dd655dec1ef6216811e1f03b30669c31d7e951c7a5195cec41f82cfdf665b3b1e6cd201d7b5418498ff2b116198b482a5c7f5fe47b4176819435890bed48bda
6
+ metadata.gz: c26eb5dee058f7770b71de427c645401cd730945b68f3e0003a6bf927a9fde97e59550b8d99b84d43b77a38b7885dfe993611d696dfbb42f0380e6ea28f10bb8
7
+ data.tar.gz: 14d81adb51cf9c1312d93f1c80e81af7122d60bc5ab3f9428505ceef8074343ed74edd08757d3a776bf5c0d73de59db671b9daf24de86a75d2105ac61b3a10c3
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+ #
3
+ # Copyright, 2017, by Samuel G. D. Williams. <http://www.codeotaku.com>
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the "Software"), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in
13
+ # all copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ # THE SOFTWARE.
22
+
23
+ require_relative 'split'
24
+
25
+ module Protocol
26
+ module HTTP
27
+ module Header
28
+ # Header value which is split by newline charaters (e.g. cookies).
29
+ class Connection < Split
30
+ KEEP_ALIVE = 'keep-alive'
31
+ CLOSE = 'close'
32
+ UPGRADE = 'upgrade'
33
+
34
+ def initialize(value)
35
+ super(value.downcase)
36
+ end
37
+
38
+ def << value
39
+ super(value.downcase)
40
+ end
41
+
42
+ def keep_alive?
43
+ self.include?(KEEP_ALIVE)
44
+ end
45
+
46
+ def close?
47
+ self.include?(CLOSE)
48
+ end
49
+
50
+ def upgrade?
51
+ self.include?(UPGRADE)
52
+ end
53
+ end
54
+ end
55
+ end
56
+ end
@@ -23,6 +23,7 @@
23
23
  require_relative 'header/split'
24
24
  require_relative 'header/multiple'
25
25
  require_relative 'header/cookie'
26
+ require_relative 'header/connection'
26
27
 
27
28
  module Protocol
28
29
  module HTTP
@@ -145,7 +146,7 @@ module Protocol
145
146
  'location' => false,
146
147
  'max-forwards' => false,
147
148
 
148
- 'connection' => Split,
149
+ 'connection' => Header::Connection,
149
150
 
150
151
  # Headers specifically for proxies:
151
152
  'via' => Split,
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Protocol
22
22
  module HTTP
23
- VERSION = "0.12.3"
23
+ VERSION = "0.13.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.3
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-15 00:00:00.000000000 Z
11
+ date: 2019-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: covered
@@ -96,6 +96,7 @@ files:
96
96
  - lib/protocol/http/cookie.rb
97
97
  - lib/protocol/http/error.rb
98
98
  - lib/protocol/http/header/authorization.rb
99
+ - lib/protocol/http/header/connection.rb
99
100
  - lib/protocol/http/header/cookie.rb
100
101
  - lib/protocol/http/header/multiple.rb
101
102
  - lib/protocol/http/header/split.rb
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
129
  - !ruby/object:Gem::Version
129
130
  version: '0'
130
131
  requirements: []
131
- rubygems_version: 3.0.3
132
+ rubygems_version: 3.0.6
132
133
  signing_key:
133
134
  specification_version: 4
134
135
  summary: Provides abstractions to handle HTTP protocols.