canon 0.3.47 → 0.3.48
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/CLAUDE.md +1 -1
- data/lib/canon/version.rb +1 -1
- data/lib/canon/xml/c14n.rb +21 -23
- 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: fcfa53c5436e38941e6c789536bf9c268fb5b587930aeaca6020c22993def0a2
|
|
4
|
+
data.tar.gz: a814221d4dd934e35f8f6eb1169f8694fadf2e2fd60e49a9f8f61e6355ff9853
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1ac2772108ab1d9cae92a479a98c94cbc02bff2a431a64e3dc9052ff4df5ec595a38c81849c3d9ddc1c1329b6a86bdfbb7d3aeae6b5bbacfa2d6d8d283acc0a6
|
|
7
|
+
data.tar.gz: 7794b9a9392eaa18bb43b85ec7a2e830d3c0f172bfd827e13b7e3f6290c82cb6b3491312090f8230671c1a7442e722a7c1b3d66a44398965b89ab4664ec11a4d
|
data/CLAUDE.md
CHANGED
|
@@ -145,7 +145,7 @@ Engine A/B testing: `CANON_XML_BACKEND=nokogiri bundle exec rspec` (or `=moxml`
|
|
|
145
145
|
|
|
146
146
|
### C14N Engines
|
|
147
147
|
|
|
148
|
-
`Canon::Xml::C14n.canonicalize`
|
|
148
|
+
`Canon::Xml::C14n.canonicalize` uses leptris' native C-side C14N 1.1 by DEFAULT (since libleptris 1.9.178 / gem 1.9.178.0) — 23x faster than the Ruby processor through canon's API (1MB document). The native parse runs `noblanks: true` (compact bytes, matching the Ruby lane's product), relative namespace URIs raise identically, and document-level PIs serialize in spec-correct document order (the Ruby processor's root-first order was non-conformant for prolog PIs). `CANON_C14N_BACKEND=ruby` forces the Ruby processor. `canonicalize_subset` and `with_comments: true` always use the Ruby processor. The parity spec (`spec/canon/xml/c14n_engine_parity_spec.rb`) pins byte-identity; its pending cases track intentional divergences (document-order PIs) and the canon-side CR-reference finding.
|
|
149
149
|
|
|
150
150
|
### YAML Engines
|
|
151
151
|
|
data/lib/canon/version.rb
CHANGED
data/lib/canon/xml/c14n.rb
CHANGED
|
@@ -23,39 +23,37 @@ module Canon
|
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
# leptris' C-side C14N 1.1 — 23x faster than the Ruby processor
|
|
26
|
-
# through canon's own API (1MB document) and
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
# (
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
#
|
|
34
|
-
#
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
#
|
|
39
|
-
#
|
|
40
|
-
# root-first order is non-conformant for prolog PIs).
|
|
41
|
-
# Relative namespace URIs raise exactly as the Ruby lane does.
|
|
42
|
-
# Comments mode keeps the Ruby path (the native seam exposes no
|
|
43
|
-
# with-comments form).
|
|
26
|
+
# through canon's own API (1MB document) and the DEFAULT lane
|
|
27
|
+
# since libleptris 1.9.178 (gem 1.9.178.0): the leptris#1117
|
|
28
|
+
# families are closed by the native parse-policy knob
|
|
29
|
+
# (`noblanks: true` — same compact bytes as the Ruby lane's
|
|
30
|
+
# parse) and by the canonicalizer itself (whitespace-only PI
|
|
31
|
+
# data dropped, document-level "\n" separators inserted). The
|
|
32
|
+
# one residual byte difference vs the Ruby lane is intentional
|
|
33
|
+
# and a correctness improvement: document-level PIs now
|
|
34
|
+
# serialize in document order (REC-xml-c14n 2.1) instead of
|
|
35
|
+
# the Ruby lane's non-conformant root-first reorder. Relative
|
|
36
|
+
# namespace URIs raise exactly as the Ruby lane does.
|
|
37
|
+
# Comments mode keeps the Ruby path regardless (the native
|
|
38
|
+
# seam exposes no with-comments form). CANON_C14N_BACKEND=ruby
|
|
39
|
+
# forces the stdlib lane.
|
|
44
40
|
def self.native_canonicalize(xml, with_comments)
|
|
45
41
|
return nil if with_comments
|
|
46
42
|
return nil if RUBY_ENGINE == "opal"
|
|
47
|
-
return nil
|
|
43
|
+
return nil if ENV["CANON_C14N_BACKEND"].to_s.casecmp("ruby").zero?
|
|
48
44
|
return nil unless Canon::XmlBackend.moxml? &&
|
|
49
45
|
Canon::XmlParsing.moxml_adapter_name == :leptris
|
|
50
46
|
return nil unless native_c14n_available?
|
|
51
47
|
|
|
52
48
|
validate_relative_namespaces!(xml)
|
|
53
49
|
|
|
54
|
-
doc = Canon::XmlParsing.moxml_context.parse(xml,
|
|
55
|
-
|
|
50
|
+
doc = Canon::XmlParsing.moxml_context.parse(xml,
|
|
51
|
+
readonly: true,
|
|
52
|
+
strict: false,
|
|
53
|
+
noblanks: true)
|
|
56
54
|
begin
|
|
57
|
-
doc.native.
|
|
58
|
-
|
|
55
|
+
doc.native.c14n(::Leptris::XML::FFI::C14N_1_1, nil,
|
|
56
|
+
mode: ::Leptris::XML::FFI::C14N_MODE_CANONICAL)
|
|
59
57
|
ensure
|
|
60
58
|
doc.free
|
|
61
59
|
end
|