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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e0be96c995cea54b44d066d20834e442c4f228ddaeccfb47288c61ebcc35f120
|
4
|
+
data.tar.gz: 366f2c3f1c9e20e9ad5bd65b61a4c8a6bda1612d35f30089858424dcdc2af3a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90bf436ab38aee10300a5d3f0ccc9700884ce7b98f99552cf9092f3b60224e75c79d7fb611e3791bdd9965b74717fef8e1425efcebbee0ee21dff5987bf2201f
|
7
|
+
data.tar.gz: 4e03e4bbf53ae6f2f1349efef8fed20869d2dd3f9b3af1a4e15e826899ed0ea58be2803ab866ce83bdc34198bdba184ef5c27aa19b3b4e3dd2547d3850d6cb8f
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning].
|
|
7
7
|
|
8
8
|
## [Unreleased]
|
9
9
|
|
10
|
+
## [0.3.0] - 2025-05-09
|
11
|
+
|
12
|
+
### Fixed
|
13
|
+
|
14
|
+
- Allow empty labels in UTS46 and WHATWG. ([@skryukov])
|
15
|
+
- Update comment in data-files to mention rake command. ([@skryukov])
|
16
|
+
|
17
|
+
## [0.2.2] - 2023-11-25
|
18
|
+
|
19
|
+
### Changed
|
20
|
+
|
21
|
+
- Internal implementation moved to regex-based algorithm to improve performance. ([@skryukov])
|
22
|
+
|
10
23
|
## [0.2.1] - 2023-11-15
|
11
24
|
|
12
25
|
### Changed
|
@@ -37,7 +50,10 @@ and this project adheres to [Semantic Versioning].
|
|
37
50
|
|
38
51
|
[@skryukov]: https://github.com/skryukov
|
39
52
|
|
40
|
-
[Unreleased]: https://github.com/skryukov/uri-idna/compare/v0.
|
53
|
+
[Unreleased]: https://github.com/skryukov/uri-idna/compare/v0.3.0...HEAD
|
54
|
+
[0.3.0]: https://github.com/skryukov/uri-idna/compare/v0.2.2...v0.3.0
|
55
|
+
[0.2.2]: https://github.com/skryukov/uri-idna/compare/v0.2.1...v0.2.2
|
56
|
+
[0.2.1]: https://github.com/skryukov/uri-idna/compare/v0.2.0...v0.2.1
|
41
57
|
[0.2.0]: https://github.com/skryukov/uri-idna/compare/v0.1.0...v0.2.0
|
42
58
|
[0.1.0]: https://github.com/skryukov/uri-idna/commits/v0.1.0
|
43
59
|
|
data/README.md
CHANGED
@@ -155,7 +155,7 @@ char.downcase.ord
|
|
155
155
|
#=> 12068
|
156
156
|
|
157
157
|
# but UTS46 mapping does it's thing:
|
158
|
-
URI::IDNA::UTS46::Mapping.call(char).ord
|
158
|
+
URI::IDNA::UTS46::Mapping.call(char).ord
|
159
159
|
#=> 22823
|
160
160
|
|
161
161
|
# so here is a full example:
|
@@ -203,7 +203,7 @@ URI::IDNA.whatwg_to_ascii("2003_rules.com")
|
|
203
203
|
|
204
204
|
##### Options
|
205
205
|
|
206
|
-
- `be_strict`: `true` -
|
206
|
+
- `be_strict`: `true` - defines value of `use_std3_ascii_rules` UTS46 option.
|
207
207
|
|
208
208
|
```ruby
|
209
209
|
require "uri/idna"
|
@@ -260,6 +260,8 @@ To set directory for generated files, use `DEST_DIR` environment variable, e.g.
|
|
260
260
|
|
261
261
|
Unicode data cached in the `tmp` directory by default, to change it, use `CACHE_DIR` environment variable, e.g. `CACHE_DIR=~/.cache/unicode_data bundle exec rake idna:generate`.
|
262
262
|
|
263
|
+
_Note: `rake idna:generate` might generate different results on different versions of Ruby due to usage of built-in Unicode normalization methods._
|
264
|
+
|
263
265
|
### Inspect Unicode data
|
264
266
|
|
265
267
|
To inspect Unicode data, run `bundle exec rake 'idna:inspect[<HEX_CODE>]'`.
|
@@ -1,27 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require_relative "validation/label"
|
4
|
-
require_relative "validation/codepoint"
|
5
4
|
require_relative "validation/bidi"
|
6
5
|
|
7
6
|
module URI
|
8
7
|
module IDNA
|
9
8
|
class BaseProcessing
|
9
|
+
class << self
|
10
|
+
def default_options
|
11
|
+
@default_options ||= options_class.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def options_class
|
15
|
+
raise NotImplementedError, "Implement #options_class method"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
10
19
|
def initialize(domain_name, **options)
|
11
20
|
@domain_name = domain_name
|
12
|
-
@options = options_class.new(**options)
|
21
|
+
@options = options.any? ? self.class.options_class.new(**options) : self.class.default_options
|
13
22
|
end
|
14
23
|
|
15
24
|
private
|
16
25
|
|
17
26
|
attr_reader :domain_name, :options
|
18
27
|
|
19
|
-
def options_class
|
20
|
-
raise NotImplementedError, "Implement #options_class method"
|
21
|
-
end
|
22
|
-
|
23
28
|
def punycode_decode(label)
|
24
29
|
raise Error, "Label contains non-ASCII code point" unless label.ascii_only?
|
30
|
+
raise Error, "A-label must not end with a hyphen" if label[-1] == "-"
|
25
31
|
|
26
32
|
code = label[ACE_PREFIX.length..]
|
27
33
|
raise Error, "Malformed A-label, no Punycode eligible content found" if code.empty?
|
@@ -39,7 +45,7 @@ module URI
|
|
39
45
|
labels, trailing_dot = split_domain(domain)
|
40
46
|
|
41
47
|
labels.map! do |label|
|
42
|
-
raise Error, "Empty label" if label.empty?
|
48
|
+
raise Error, "Empty label" if label.empty? && options.verify_dns_length?
|
43
49
|
|
44
50
|
yield label
|
45
51
|
end
|
@@ -56,7 +62,7 @@ module URI
|
|
56
62
|
labels = domain.split(".", -1)
|
57
63
|
trailing_dot = labels[-1] && labels[-1].empty? ? labels.pop : false
|
58
64
|
|
59
|
-
raise Error, "Empty domain" if labels.empty? || labels == [""]
|
65
|
+
raise Error, "Empty domain" if (labels.empty? || labels == [""]) && options.verify_dns_length?
|
60
66
|
|
61
67
|
[labels, trailing_dot]
|
62
68
|
end
|