Ensure parsing/toString symmetry in ContentDisposition name - #37133
Closed
yashsiwacha wants to merge 1 commit into
Closed
Ensure parsing/toString symmetry in ContentDisposition name#37133yashsiwacha wants to merge 1 commit into
yashsiwacha wants to merge 1 commit into
Conversation
Signed-off-by: Yash Siwach <yashsiwach07@gmail.com>
Member
|
See #37069 (comment) |
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.
Closes gh-37064
Overview
Currently, the parsing/
toString()process for thenameparameter inContentDispositionis not symmetric when it comes to quoted-pairs (characters like\"and\\).While
ContentDispositionalready correctly encodes and decodes quoted-pairs for thefilenameparameter, thenameparameter was written and read as a raw quoted string. As a result, formatting a name containing a quote or backslash produces malformed HTTP headers, and parsing them back yields corrupted names containing unescaped backslashes.Changes
ContentDisposition.toString()to encode thenameparameter usingencodeQuotedPairs(this.name).ContentDisposition.parse()to decode the parsednamevalue usingdecodeQuotedPairs(value)if a backslash is present.formatAndParseWithNameWithQuotesinContentDispositionTeststo assert formatting and parsing symmetry under nested quotes and backslashes.