Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zaml: rework strings for correctness and speed
This changes the implementation of string output in the ZAML encoder. On my test that delivers around a fifty percent reduction in output time, from 4.11 to 1.89 seconds on my test of ~ 35,000 output strings. It also adds a bunch of tests to validate the correctness of binary output handling, and some test inputs derived from various security related UTF-8 encoding problems to validate that (sadly) we pass them through as binary data. Optimally we would treat binary and text input as distinct in the parser and compiler of Puppet, then only allow legal UTF-8 in strings - but that is not the world in which we live. It finally fixes a bug in the binary output along the way - which, thankfully, nobody actually seems to have run into since I introduced it in ea0dd14. Because the Ruby BASE64 encoder will split lines at the 60 character mark, a long binary input would end up with embedded newlines in places that were not legal for YAML. Instead of just emitting that, we run through the string encoder over the transformed data, which leads to a solid output format that works entirely as expected. Signed-off-by: Daniel Pittman <daniel@puppetlabs.com> Conflicts: lib/puppet/util/zaml.rb spec/unit/util/zaml_spec.rb Signed-off-by: Daniel Pittman <daniel@puppetlabs.com>
- Loading branch information
Daniel Pittman
committed
Sep 18, 2012
1 parent
4d4a75a
commit 83defc0
Showing
2 changed files
with
138 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters