uri-idna 0.2.1 → 0.3.0
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 +17 -1
- data/README.md +4 -2
- data/lib/uri/idna/base_processing.rb +14 -8
- data/lib/uri/idna/data/bidi_classes.rb +1973 -0
- data/lib/uri/idna/data/codepoint_classes.rb +1226 -0
- data/lib/uri/idna/data/joining_types.rb +839 -0
- data/lib/uri/idna/data/leading_combiners.rb +321 -0
- data/lib/uri/idna/data/scripts.rb +108 -0
- data/lib/uri/idna/data/unicode_version.rb +10 -0
- data/lib/uri/idna/data/uts46.rb +8460 -8180
- data/lib/uri/idna/data/virama_combining_classes.rb +67 -0
- data/lib/uri/idna/idna2008/processing.rb +13 -28
- data/lib/uri/idna/punycode.rb +11 -9
- data/lib/uri/idna/uts46/mapping.rb +39 -37
- data/lib/uri/idna/uts46/options.rb +4 -0
- data/lib/uri/idna/uts46/processing.rb +14 -15
- data/lib/uri/idna/validation/bidi.rb +34 -52
- data/lib/uri/idna/validation/contextj.rb +62 -0
- data/lib/uri/idna/validation/contexto.rb +61 -0
- data/lib/uri/idna/validation/idna_permitted.rb +30 -0
- data/lib/uri/idna/validation/label.rb +1 -14
- data/lib/uri/idna/validation/leading_combining.rb +23 -0
- data/lib/uri/idna/version.rb +1 -1
- metadata +16 -11
- data/lib/uri/idna/data/idna.rb +0 -4697
- data/lib/uri/idna/intranges.rb +0 -57
- data/lib/uri/idna/validation/codepoint.rb +0 -128
@@ -1,8 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative "../intranges"
|
4
|
-
require_relative "../data/idna"
|
5
|
-
|
6
3
|
module URI
|
7
4
|
module IDNA
|
8
5
|
module Validation
|
@@ -11,7 +8,7 @@ module URI
|
|
11
8
|
# 4.1. Input to IDNA Registration
|
12
9
|
# https://datatracker.ietf.org/doc/html/rfc5891#section-4.1
|
13
10
|
def check_nfc(label)
|
14
|
-
return if label.unicode_normalized?(:nfc)
|
11
|
+
return if label.ascii_only? || label.unicode_normalized?(:nfc)
|
15
12
|
|
16
13
|
raise Error, "Label must be in Unicode Normalization Form NFC"
|
17
14
|
end
|
@@ -38,16 +35,6 @@ module URI
|
|
38
35
|
raise Error, "Label must not begin with `xn--`"
|
39
36
|
end
|
40
37
|
|
41
|
-
# 4.2.3.2. Leading Combining Marks
|
42
|
-
# https://datatracker.ietf.org/doc/html/rfc5891#section-4.2.3.2
|
43
|
-
def check_leading_combining(label)
|
44
|
-
cp = label[0].ord
|
45
|
-
return if cp < 256
|
46
|
-
return unless Intranges.contain?(cp, INITIAL_COMBINERS)
|
47
|
-
|
48
|
-
raise Error, "Label begins with an illegal combining character"
|
49
|
-
end
|
50
|
-
|
51
38
|
def check_dot(label)
|
52
39
|
raise Error, "Label must not contain a U+002E ( . ) FULL STOP" if label.include?(".")
|
53
40
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "../data/leading_combiners"
|
4
|
+
|
5
|
+
module URI
|
6
|
+
module IDNA
|
7
|
+
module Validation
|
8
|
+
# 4.2.3.2. Leading Combining Marks
|
9
|
+
# https://datatracker.ietf.org/doc/html/rfc5891#section-4.2.3.2
|
10
|
+
module LeadingCombining
|
11
|
+
class << self
|
12
|
+
LEADING_COMBINERS_REGEX = Regexp.new(LEADING_COMBINERS).freeze
|
13
|
+
|
14
|
+
def call(label)
|
15
|
+
return unless label[0].match?(LEADING_COMBINERS_REGEX)
|
16
|
+
|
17
|
+
raise Error, "Label begins with an illegal combining character"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/uri/idna/version.rb
CHANGED
metadata
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-idna
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Svyatoslav Kryukov
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-05-09 00:00:00.000000000 Z
|
12
11
|
dependencies: []
|
13
12
|
description: Internationalized Domain Names in Applications (IDNA)
|
14
13
|
email:
|
15
|
-
-
|
14
|
+
- me@skryukov.dev
|
16
15
|
executables: []
|
17
16
|
extensions: []
|
18
17
|
extra_rdoc_files: []
|
@@ -23,18 +22,26 @@ files:
|
|
23
22
|
- lib/uri-idna.rb
|
24
23
|
- lib/uri/idna.rb
|
25
24
|
- lib/uri/idna/base_processing.rb
|
26
|
-
- lib/uri/idna/data/
|
25
|
+
- lib/uri/idna/data/bidi_classes.rb
|
26
|
+
- lib/uri/idna/data/codepoint_classes.rb
|
27
|
+
- lib/uri/idna/data/joining_types.rb
|
28
|
+
- lib/uri/idna/data/leading_combiners.rb
|
29
|
+
- lib/uri/idna/data/scripts.rb
|
30
|
+
- lib/uri/idna/data/unicode_version.rb
|
27
31
|
- lib/uri/idna/data/uts46.rb
|
32
|
+
- lib/uri/idna/data/virama_combining_classes.rb
|
28
33
|
- lib/uri/idna/idna2008/options.rb
|
29
34
|
- lib/uri/idna/idna2008/processing.rb
|
30
|
-
- lib/uri/idna/intranges.rb
|
31
35
|
- lib/uri/idna/punycode.rb
|
32
36
|
- lib/uri/idna/uts46/mapping.rb
|
33
37
|
- lib/uri/idna/uts46/options.rb
|
34
38
|
- lib/uri/idna/uts46/processing.rb
|
35
39
|
- lib/uri/idna/validation/bidi.rb
|
36
|
-
- lib/uri/idna/validation/
|
40
|
+
- lib/uri/idna/validation/contextj.rb
|
41
|
+
- lib/uri/idna/validation/contexto.rb
|
42
|
+
- lib/uri/idna/validation/idna_permitted.rb
|
37
43
|
- lib/uri/idna/validation/label.rb
|
44
|
+
- lib/uri/idna/validation/leading_combining.rb
|
38
45
|
- lib/uri/idna/version.rb
|
39
46
|
- lib/uri/idna/whatwg/processing.rb
|
40
47
|
homepage: https://github.com/skryukov/uri-idna
|
@@ -47,7 +54,6 @@ metadata:
|
|
47
54
|
homepage_uri: https://github.com/skryukov/uri-idna
|
48
55
|
source_code_uri: https://github.com/skryukov/uri-idna
|
49
56
|
rubygems_mfa_required: 'true'
|
50
|
-
post_install_message:
|
51
57
|
rdoc_options: []
|
52
58
|
require_paths:
|
53
59
|
- lib
|
@@ -62,8 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
68
|
- !ruby/object:Gem::Version
|
63
69
|
version: '0'
|
64
70
|
requirements: []
|
65
|
-
rubygems_version: 3.
|
66
|
-
signing_key:
|
71
|
+
rubygems_version: 3.6.2
|
67
72
|
specification_version: 4
|
68
|
-
summary:
|
73
|
+
summary: Internationalized Domain Names for Ruby (IDNA2008, UTS46 and WHATWG)
|
69
74
|
test_files: []
|