linkheaders-processor 0.1.19 → 0.1.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +13 -11
- data/README.md +1 -1
- data/lib/linkheaders/processor/version.rb +1 -1
- data/lib/linkheaders/processor.rb +17 -12
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 88db7265719e8b2f1d6fa9f804d6970dc411f6ff609cdff6fbf21f9e904d76d8
|
4
|
+
data.tar.gz: b504685f471206e45bae949bc3f423c2ed9e9aedca7c0d27784c5ca6d6a78e02
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1973c63103587b077879d1d53fa50cc5f9b1102a3dd8db2e56d792ceaa0d60addcb8a3edeb50069fa3263c2f4820e09cdd9714579c4d0b119ab2cbbe5e44122
|
7
|
+
data.tar.gz: ce8c65a0e657430caca6abff60c435aa79bc659f6623017ddb9d7e90d2988c7f51650ca7f89df58b2c5db2a1b904c8137da7c66c1557d08f80208304cef6ba8d
|
data/Gemfile.lock
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
linkheaders-processor (0.1.
|
4
|
+
linkheaders-processor (0.1.21)
|
5
5
|
json (~> 2.0)
|
6
6
|
json-ld (~> 3.2)
|
7
7
|
json-ld-preloaded (~> 3.2)
|
8
8
|
link_header (~> 0.0.8)
|
9
9
|
metainspector (~> 5.11.2)
|
10
10
|
rest-client (~> 2.1)
|
11
|
-
securerandom
|
11
|
+
securerandom
|
12
12
|
|
13
13
|
GEM
|
14
14
|
remote: https://rubygems.org/
|
@@ -16,10 +16,11 @@ GEM
|
|
16
16
|
addressable (2.8.5)
|
17
17
|
public_suffix (>= 2.0.2, < 6.0)
|
18
18
|
ast (2.4.2)
|
19
|
+
bcp47_spec (0.2.1)
|
19
20
|
diff-lcs (1.5.0)
|
20
21
|
domain_name (0.5.20190701)
|
21
22
|
unf (>= 0.0.5, < 1.0.0)
|
22
|
-
faraday (1.10.
|
23
|
+
faraday (1.10.3)
|
23
24
|
faraday-em_http (~> 1.0)
|
24
25
|
faraday-em_synchrony (~> 1.0)
|
25
26
|
faraday-excon (~> 1.1)
|
@@ -58,16 +59,16 @@ GEM
|
|
58
59
|
domain_name (~> 0.5)
|
59
60
|
json (2.6.2)
|
60
61
|
json-canonicalization (0.3.2)
|
61
|
-
json-ld (3.
|
62
|
+
json-ld (3.3.0)
|
62
63
|
htmlentities (~> 4.3)
|
63
64
|
json-canonicalization (~> 0.3, >= 0.3.2)
|
64
65
|
link_header (~> 0.0, >= 0.0.8)
|
65
66
|
multi_json (~> 1.15)
|
66
67
|
rack (>= 2.2, < 4)
|
67
|
-
rdf (~> 3.
|
68
|
-
json-ld-preloaded (3.
|
69
|
-
json-ld (~> 3.
|
70
|
-
rdf (~> 3.
|
68
|
+
rdf (~> 3.3)
|
69
|
+
json-ld-preloaded (3.3.0)
|
70
|
+
json-ld (~> 3.3)
|
71
|
+
rdf (~> 3.3)
|
71
72
|
link_header (0.0.8)
|
72
73
|
metainspector (5.11.2)
|
73
74
|
addressable (~> 2.7)
|
@@ -83,7 +84,7 @@ GEM
|
|
83
84
|
mime-types-data (~> 3.2015)
|
84
85
|
mime-types-data (3.2023.0808)
|
85
86
|
multi_json (1.15.0)
|
86
|
-
multipart-post (2.
|
87
|
+
multipart-post (2.3.0)
|
87
88
|
nesty (1.0.2)
|
88
89
|
netrc (0.11.0)
|
89
90
|
nokogiri (1.15.4-x86_64-linux)
|
@@ -96,7 +97,8 @@ GEM
|
|
96
97
|
rack (3.0.8)
|
97
98
|
rainbow (3.1.1)
|
98
99
|
rake (13.0.6)
|
99
|
-
rdf (3.
|
100
|
+
rdf (3.3.1)
|
101
|
+
bcp47_spec (~> 0.2)
|
100
102
|
link_header (~> 0.0, >= 0.0.8)
|
101
103
|
regexp_parser (2.5.0)
|
102
104
|
rest-client (2.1.0)
|
@@ -132,7 +134,7 @@ GEM
|
|
132
134
|
parser (>= 3.1.1.0)
|
133
135
|
ruby-progressbar (1.11.0)
|
134
136
|
ruby2_keywords (0.0.5)
|
135
|
-
securerandom (0.
|
137
|
+
securerandom (0.2.2)
|
136
138
|
unf (0.1.4)
|
137
139
|
unf_ext
|
138
140
|
unf_ext (0.0.8.2)
|
data/README.md
CHANGED
@@ -96,28 +96,33 @@ module LinkHeaders
|
|
96
96
|
def split_http_link_headers_and_process(parts)
|
97
97
|
newlinks = Array.new
|
98
98
|
parts.each do |part, _index|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
99
|
+
warn "link is: #{part}" # <https://s11.no/2022/a2a-fair-metrics/70-rda-r1-01m-t2-type-charset/test-apple-data.csv>;rel="item";type="text/csv;charset=UTF-8"
|
100
|
+
|
101
|
+
# this is crazy hard, because we can't rely on quotes!
|
102
|
+
part = part + ";"
|
103
|
+
href = part[/<([^\]]+)>;/, 1]
|
104
|
+
next unless href
|
105
|
+
part = part.gsub(/<([^\]]+)>\s?;\s?/, "") # now only ;rel="item";type="text/csv;charset=UTF-8"; pro=gram
|
106
|
+
pieces = part.scan(/(\S+?\s?=\s?"[^"]+?"\s?);?/).flatten # ["rel=\"item\"", "type=\"text/csv;charset=UTF-8\""] and the non-quoted stuff is ignored
|
107
|
+
pieces.each do |p|
|
108
|
+
part = part.gsub(p, "") # now just ";;prog=gram;"
|
109
|
+
end
|
110
|
+
rest = part.split(";") # ["", "", "prog=gram"]
|
109
111
|
|
110
112
|
sections = {}
|
111
|
-
|
113
|
+
pieces.concat(rest).each do |s| # can be more than one link property "rel='preconnect'"
|
112
114
|
s.strip!
|
113
|
-
unless m = s.match(%r{(\w+?)
|
115
|
+
unless m = s.match(%r{(\w+?)\s?=\s?"?([\w\;\:\d\.\,\=\#\-\+\/\s]+)"?})
|
116
|
+
warn " NO PATTERN MATCH ON #{s}"
|
114
117
|
next
|
115
118
|
end # can be rel="cite-as describedby" --> two relations in one! or "linkset+json"
|
116
119
|
|
117
120
|
relation = m[1] # rel"
|
118
121
|
value = m[2] # "preconnect"
|
122
|
+
warn "section relation #{relation} value #{value}"
|
119
123
|
sections[relation] = value # value could hold multiple relation types sections[:rel] = "preconnect"
|
120
124
|
end
|
125
|
+
|
121
126
|
next unless sections['rel'] # the relation is required!
|
122
127
|
|
123
128
|
anchor = sections['anchor'] || default_anchor
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linkheaders-processor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Wilkinson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: securerandom
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
89
|
+
version: '0'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: metainspector
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -153,6 +153,7 @@ metadata:
|
|
153
153
|
homepage_uri: https://github.com/markwilkinson/linkheader-processor
|
154
154
|
source_code_uri: https://github.com/markwilkinson/linkheader-processor
|
155
155
|
changelog_uri: https://github.com/markwilkinson/linkheader-processor/blob/master/CHANGELOG.md
|
156
|
+
documentation_uri: https://www.rubydoc.info/gems/linkheaders-processor/
|
156
157
|
post_install_message:
|
157
158
|
rdoc_options: []
|
158
159
|
require_paths:
|