uri-whatwg_parser 0.1.5 → 0.1.6
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 +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +1 -3
- data/lib/uri/whatwg_parser/host_parser.rb +1 -1
- data/lib/uri/whatwg_parser/version.rb +1 -1
- data/lib/uri/whatwg_parser.rb +14 -13
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 712c7079461310fdab82e79bea4491ce91a4a8b26827a338334a0e161520a8c0
|
|
4
|
+
data.tar.gz: 85871841fdee54a61c942134398bfb85e2e89f798144921464058e4edd2ea8fb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 42b046952ea2817c3db80edcc69bafbf86822c9b88f23837b4decb9d9693b0044f68b9a74c920707e16ee28121f2c03d6992df300227b32cf62a3995e7af7ee5
|
|
7
|
+
data.tar.gz: aa9c3d27934eec97f11f579cc2b194b5b88f0d69da5c224cb4ebf6fd13878c8a493a7e3391f7f985674e602629da303364aa49c7ed9b88f0b101b66c304db6d2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Ruby implementation of the [WHATWG URL Living Standard](https://url.spec.whatwg.org/).
|
|
4
4
|
|
|
5
|
-
The latest revision that this package implements of the standard is ([
|
|
6
|
-
|
|
7
|
-
NOTE: Some features haven't been implemented yet. Please see the TODO for details.
|
|
5
|
+
The latest revision that this package implements of the standard is ([18 August 2025](https://url.spec.whatwg.org/commit-snapshots/05a5d834deba31622390ee05a3dcbc22496b7bb5/)).
|
|
8
6
|
|
|
9
7
|
## Installation
|
|
10
8
|
|
|
@@ -227,7 +227,7 @@ class URI::WhatwgParser
|
|
|
227
227
|
validation_error = false
|
|
228
228
|
r = 10
|
|
229
229
|
|
|
230
|
-
if str.size >= 2 &&
|
|
230
|
+
if str.size >= 2 && str.start_with?("0x", "0X")
|
|
231
231
|
validation_error = true
|
|
232
232
|
str = str[2..-1]
|
|
233
233
|
r = 16
|
data/lib/uri/whatwg_parser.rb
CHANGED
|
@@ -126,22 +126,22 @@ module URI
|
|
|
126
126
|
@state = :path_or_authority_state
|
|
127
127
|
@pos += 1
|
|
128
128
|
else
|
|
129
|
-
@parse_result[:
|
|
129
|
+
@parse_result[:opaque] = ""
|
|
130
130
|
@state = :opaque_path_state
|
|
131
131
|
end
|
|
132
132
|
else
|
|
133
133
|
@buffer.clear
|
|
134
|
-
@pos
|
|
134
|
+
@pos = -1
|
|
135
135
|
@state = :no_scheme_state
|
|
136
136
|
end
|
|
137
137
|
end
|
|
138
138
|
|
|
139
139
|
def no_scheme_state(c)
|
|
140
|
-
raise ParseError, "scheme is missing" if @base.nil? || !@base[:opaque].nil? && c != "#"
|
|
140
|
+
raise ParseError, "scheme is missing" if @base.nil? || (!@base[:opaque].nil? && c != "#")
|
|
141
141
|
|
|
142
142
|
if !@base[:opaque].nil? && c == "#"
|
|
143
143
|
@parse_result[:scheme] = @base[:scheme]
|
|
144
|
-
@
|
|
144
|
+
@paths = @base_paths
|
|
145
145
|
@parse_result[:query] = @base[:query]
|
|
146
146
|
@parse_result[:fragment] = nil
|
|
147
147
|
@state = :fragment_state
|
|
@@ -180,10 +180,11 @@ module URI
|
|
|
180
180
|
elsif special_url? && c == "\\"
|
|
181
181
|
@state = :relative_slash_state
|
|
182
182
|
else
|
|
183
|
+
|
|
183
184
|
@parse_result[:userinfo] = @base[:userinfo]
|
|
184
185
|
@parse_result[:host] = @base[:host]
|
|
185
186
|
@parse_result[:port] = @base[:port]
|
|
186
|
-
@
|
|
187
|
+
@paths = @base_paths
|
|
187
188
|
@parse_result[:query] = @base[:query]
|
|
188
189
|
|
|
189
190
|
if c == "?"
|
|
@@ -396,7 +397,6 @@ module URI
|
|
|
396
397
|
@paths ||= []
|
|
397
398
|
|
|
398
399
|
if (c.nil? || c == "/") || (special_url? && c == "\/") || (c == "?" || c == "#")
|
|
399
|
-
|
|
400
400
|
if double_dot_path_segments?(@buffer)
|
|
401
401
|
shorten_url_path
|
|
402
402
|
if c != "/" || (special_url? && c == "\/")
|
|
@@ -408,6 +408,7 @@ module URI
|
|
|
408
408
|
if @parse_result[:scheme] == "file" && @paths.empty? && windows_drive_letter?(@buffer)
|
|
409
409
|
@buffer[1] = ":"
|
|
410
410
|
end
|
|
411
|
+
|
|
411
412
|
@paths << @buffer
|
|
412
413
|
end
|
|
413
414
|
|
|
@@ -433,13 +434,13 @@ module URI
|
|
|
433
434
|
@parse_result[:fragment] = nil
|
|
434
435
|
@state = :fragment_state
|
|
435
436
|
elsif c == " "
|
|
436
|
-
if rest.start_with?("?"
|
|
437
|
-
@parse_result[:
|
|
437
|
+
if rest.start_with?("?", "#")
|
|
438
|
+
@parse_result[:opaque] += "%20"
|
|
438
439
|
else
|
|
439
|
-
@parse_result[:
|
|
440
|
+
@parse_result[:opaque] += " "
|
|
440
441
|
end
|
|
441
442
|
elsif !c.nil?
|
|
442
|
-
@parse_result[:
|
|
443
|
+
@parse_result[:opaque] += percent_encode(c, C0_CONTROL_PERCENT_ENCODE_SET, @encoding)
|
|
443
444
|
end
|
|
444
445
|
end
|
|
445
446
|
|
|
@@ -488,10 +489,10 @@ module URI
|
|
|
488
489
|
end
|
|
489
490
|
|
|
490
491
|
def shorten_url_path
|
|
491
|
-
return if @
|
|
492
|
+
return if @paths.nil?
|
|
492
493
|
|
|
493
|
-
return true if @parse_result[:scheme] == "file" && @
|
|
494
|
-
@
|
|
494
|
+
return true if @parse_result[:scheme] == "file" && @paths.length == 1 && normalized_windows_drive_letter?(@paths.first)
|
|
495
|
+
@paths.pop
|
|
495
496
|
end
|
|
496
497
|
|
|
497
498
|
def rest
|