tool_writeout_json: fix encoding of control characters#11414
Closed
emanuele6 wants to merge 1 commit intocurl:masterfrom
Closed
tool_writeout_json: fix encoding of control characters#11414emanuele6 wants to merge 1 commit intocurl:masterfrom
emanuele6 wants to merge 1 commit intocurl:masterfrom
Conversation
Control characters without a special escape sequence e.g. %00 or %06 were being encoded as "u0006" instead of "\u0006".
bagder
approved these changes
Jul 9, 2023
Member
|
I'm fine with delaying adding a test case for this until #11346 has been merged, which will not happen until the feature window opens again. |
Member
|
Thanks! |
Contributor
Author
|
I figure out a way this could be tested: curl -w '%{json}\n' -o $'foo\x06\x07\x08' file:///dev/nullBefore this patch, that will output |
bch
pushed a commit
to bch/curl
that referenced
this pull request
Jul 19, 2023
Control characters without a special escape sequence e.g. %00 or %06 were being encoded as "u0006" instead of "\u0006". Ref: curl/trurl#214 (comment) Closes curl#11414
ptitSeb
pushed a commit
to wasix-org/curl
that referenced
this pull request
Sep 25, 2023
Control characters without a special escape sequence e.g. %00 or %06 were being encoded as "u0006" instead of "\u0006". Ref: curl/trurl#214 (comment) Closes curl#11414
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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_jsonalso 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.htmldownloads tofile%06.html, and outputs"filename_effective": "file%06.html"; when using-Othe 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.