protocol-http 0.15.1 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/lib/protocol/http/body/rewindable.rb +4 -0
- data/lib/protocol/http/header/etags.rb +48 -0
- data/lib/protocol/http/headers.rb +5 -0
- data/lib/protocol/http/version.rb +1 -1
- data/protocol-http.gemspec +3 -3
- metadata +13 -13
- data/Rakefile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41b2d4778c0f87995ae41473f3f441d2af2752cb003c8f5c5a940317a4d261d3
|
4
|
+
data.tar.gz: fb501b5a733885122789b24316f4678a2799d32b7d36ebd69976a2813752d1be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 11e68c65957d8fb04ac828c75bf7176f5247dcc20d1ee3429bcb138616c6673c6669f061fa798d7faa1947d6734025e62c835408d1ee3c1f0a316eda19126470
|
7
|
+
data.tar.gz: 7eace33160810f3aaefbbb404c92144cd386af715ea083fe2abfb683a045306677c2e1b48a92099e5e6fb19d47594ac118ae43732cd0b10a85db608484a27559
|
data/.travis.yml
CHANGED
@@ -2,14 +2,16 @@ language: ruby
|
|
2
2
|
dist: xenial
|
3
3
|
cache: bundler
|
4
4
|
|
5
|
+
script: bundle exec rspec
|
6
|
+
|
5
7
|
matrix:
|
6
8
|
include:
|
7
|
-
- rvm: 2.4
|
8
9
|
- rvm: 2.5
|
9
10
|
- rvm: 2.6
|
10
11
|
- rvm: 2.7
|
11
12
|
- rvm: 2.6
|
12
13
|
env: COVERAGE=PartialSummary,Coveralls
|
14
|
+
- rvm: 2.7
|
13
15
|
- rvm: truffleruby
|
14
16
|
- rvm: jruby-head
|
15
17
|
env: JRUBY_OPTS="--debug -X+O"
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright, 2020, 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 ETags < Split
|
30
|
+
def initialize(value)
|
31
|
+
super(value.downcase)
|
32
|
+
end
|
33
|
+
|
34
|
+
def << value
|
35
|
+
super(value.downcase)
|
36
|
+
end
|
37
|
+
|
38
|
+
def wildcard?
|
39
|
+
self.include?('*')
|
40
|
+
end
|
41
|
+
|
42
|
+
def match?(etag)
|
43
|
+
wildcard? || self.include?(etag)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -25,6 +25,7 @@ require_relative 'header/multiple'
|
|
25
25
|
require_relative 'header/cookie'
|
26
26
|
require_relative 'header/connection'
|
27
27
|
require_relative 'header/cache_control'
|
28
|
+
require_relative 'header/etags'
|
28
29
|
require_relative 'header/vary'
|
29
30
|
|
30
31
|
module Protocol
|
@@ -168,6 +169,10 @@ module Protocol
|
|
168
169
|
'via' => Split,
|
169
170
|
'x-forwarded-for' => Split,
|
170
171
|
|
172
|
+
# Cache validations:
|
173
|
+
'if-match' => Header::ETags,
|
174
|
+
'if-none-match' => Header::ETags,
|
175
|
+
|
171
176
|
# Headers which may be specified multiple times, but which can't be concatenated:
|
172
177
|
'www-authenticate' => Multiple,
|
173
178
|
'proxy-authenticate' => Multiple,
|
data/protocol-http.gemspec
CHANGED
@@ -15,12 +15,12 @@ Gem::Specification.new do |spec|
|
|
15
15
|
f.match(%r{^(test|spec|features)/})
|
16
16
|
end
|
17
17
|
|
18
|
-
spec.required_ruby_version = '~> 2.
|
18
|
+
spec.required_ruby_version = '~> 2.5'
|
19
19
|
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
22
|
spec.add_development_dependency "covered"
|
23
23
|
spec.add_development_dependency "bundler"
|
24
|
-
spec.add_development_dependency "
|
25
|
-
spec.add_development_dependency "rspec"
|
24
|
+
spec.add_development_dependency "bake-bundler"
|
25
|
+
spec.add_development_dependency "rspec"
|
26
26
|
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.
|
4
|
+
version: 0.16.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: 2020-
|
11
|
+
date: 2020-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: covered
|
@@ -39,33 +39,33 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: bake-bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
61
|
+
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
68
|
+
version: '0'
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- samuel.williams@oriontransfer.co.nz
|
@@ -79,7 +79,6 @@ files:
|
|
79
79
|
- ".travis.yml"
|
80
80
|
- Gemfile
|
81
81
|
- README.md
|
82
|
-
- Rakefile
|
83
82
|
- lib/protocol/http.rb
|
84
83
|
- lib/protocol/http/accept_encoding.rb
|
85
84
|
- lib/protocol/http/body/buffered.rb
|
@@ -100,6 +99,7 @@ files:
|
|
100
99
|
- lib/protocol/http/header/cache_control.rb
|
101
100
|
- lib/protocol/http/header/connection.rb
|
102
101
|
- lib/protocol/http/header/cookie.rb
|
102
|
+
- lib/protocol/http/header/etags.rb
|
103
103
|
- lib/protocol/http/header/multiple.rb
|
104
104
|
- lib/protocol/http/header/split.rb
|
105
105
|
- lib/protocol/http/header/vary.rb
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - "~>"
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
version: '2.
|
128
|
+
version: '2.5'
|
129
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - ">="
|