tool_writeout_json: fix encoding of control characters #11414
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Control characters without a shorthand e.g. %06 were being encoded as "u0006" instead of "\u0006".
See curl/trurl#214 (comment).
I tried to add a test for this that gets a response with
Foo: %hex[%06%07%08]hex%
in the headers, and checks thatheader_json
also contains"foo": "\u0006\u0007\b"
, but nghttpx doesn't seem to like that.Maybe I could use a test that checks the entireThat actually doesn't seem to work because-w %{json}
output, and testsfilename_effecitive
?curl -Ow '%{json}\n' example.org/file%06.html
downloads tofile%06.html
, and outputs"filename_effective": "file%06.html"
; when using-O
the path from the URL is not url decoded.Testing this would be easier using the
--expand-foo '{{json:something}}'
introduced by #11346, so maybe that PR could add a test for this instead.