uri-idna 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -7
- data/README.md +1 -1
- data/lib/uri/idna/base_processing.rb +18 -6
- 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 +8459 -8179
- data/lib/uri/idna/data/virama_combining_classes.rb +67 -0
- data/lib/uri/idna/idna2008/processing.rb +16 -37
- data/lib/uri/idna/punycode.rb +11 -9
- data/lib/uri/idna/uts46/mapping.rb +40 -37
- data/lib/uri/idna/uts46/processing.rb +22 -26
- data/lib/uri/idna/validation/bidi.rb +38 -56
- 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 +2 -13
- data/lib/uri/idna/validation/leading_combining.rb +23 -0
- data/lib/uri/idna/version.rb +1 -1
- metadata +15 -7
- 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 -122
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a31f65444a2088912d65c6755cf7e1cb16ae1936c801245b29804f55414a6b67
|
4
|
+
data.tar.gz: 1538c13b89e089e53f7d249ac6b3ce628e163bbd65d30f36cddc2b97007382b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d26a6d183474bc619cf282d712874c06a91a522207c539ee9a1c67bf51474b3084e67dea2a1f2315b1852204eeea5b3df67bc20412a26d5bd18561dc3899833e
|
7
|
+
data.tar.gz: 3b2d6a1ed2a1e79e55e9569959a5fcc86203e22696c03bbce33b788681385072026c4dcab2888346249856ffd0ea9a66a13071caa5309ba8c8cb7040af9a7d2e
|
data/CHANGELOG.md
CHANGED
@@ -5,23 +5,33 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog],
|
6
6
|
and this project adheres to [Semantic Versioning].
|
7
7
|
|
8
|
-
## [
|
8
|
+
## [0.2.2] - 2023-11-25
|
9
|
+
|
10
|
+
### Changed
|
11
|
+
|
12
|
+
- Internal implementation moved to regex-based algorithm to improve performance. ([@skryukov])
|
13
|
+
|
14
|
+
## [0.2.1] - 2023-11-15
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
|
18
|
+
- Various performance and memory optimizations. ([@skryukov])
|
9
19
|
|
10
20
|
## [0.2.0] - 2023-11-14
|
11
21
|
|
12
22
|
### Added
|
13
23
|
|
14
|
-
- WHATWG IDNA functions
|
24
|
+
- WHATWG IDNA functions. ([@skryukov])
|
15
25
|
|
16
26
|
### Changed
|
17
27
|
|
18
|
-
- **BREAKING!** Names of options updated to match UTS46 flags
|
19
|
-
- Unicode version updated to 15.1
|
20
|
-
- UTS46 functions now support Revision 31
|
28
|
+
- **BREAKING!** Names of options updated to match UTS46 flags. ([@skryukov])
|
29
|
+
- Unicode version updated to 15.1. ([@skryukov])
|
30
|
+
- UTS46 functions now support Revision 31. ([@skryukov])
|
21
31
|
|
22
32
|
### Fixed
|
23
33
|
|
24
|
-
- IDNA2008 functions now support not only labels, but full domains
|
34
|
+
- IDNA2008 functions now support not only labels, but full domains. ([@skryukov])
|
25
35
|
|
26
36
|
## [0.1.0] - 2023-08-05
|
27
37
|
|
@@ -31,7 +41,9 @@ and this project adheres to [Semantic Versioning].
|
|
31
41
|
|
32
42
|
[@skryukov]: https://github.com/skryukov
|
33
43
|
|
34
|
-
[Unreleased]: https://github.com/skryukov/uri-idna/compare/v0.2.
|
44
|
+
[Unreleased]: https://github.com/skryukov/uri-idna/compare/v0.2.2...HEAD
|
45
|
+
[0.2.2]: https://github.com/skryukov/uri-idna/compare/v0.2.1...v0.2.2
|
46
|
+
[0.2.1]: https://github.com/skryukov/uri-idna/compare/v0.2.0...v0.2.1
|
35
47
|
[0.2.0]: https://github.com/skryukov/uri-idna/compare/v0.1.0...v0.2.0
|
36
48
|
[0.1.0]: https://github.com/skryukov/uri-idna/commits/v0.1.0
|
37
49
|
|
data/README.md
CHANGED
@@ -256,7 +256,7 @@ To specify Unicode version, use `VERSION` environment variable, e.g. `VERSION=15
|
|
256
256
|
|
257
257
|
By default, used Unicode version is the one used by the Ruby version (`RbConfig::CONFIG["UNICODE_VERSION"]`).
|
258
258
|
|
259
|
-
To set directory for generated files, use `
|
259
|
+
To set directory for generated files, use `DEST_DIR` environment variable, e.g. `DEST_DIR=lib/uri/idna/data bundle exec rake idna:generate`.
|
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
|
|
@@ -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?
|
@@ -60,6 +66,12 @@ module URI
|
|
60
66
|
|
61
67
|
[labels, trailing_dot]
|
62
68
|
end
|
69
|
+
|
70
|
+
def check_bidi?
|
71
|
+
return @check_bidi if instance_variable_defined?(:@check_bidi)
|
72
|
+
|
73
|
+
@check_bidi = options.check_bidi? && Validation::Bidi.check?(domain_name)
|
74
|
+
end
|
63
75
|
end
|
64
76
|
end
|
65
77
|
end
|