-
Notifications
You must be signed in to change notification settings - Fork 603
Bug 5523: Do not percent-encode URI suffixes #2289
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rousskov
wants to merge
5
commits into
squid-cache:master
Choose a base branch
from
measurement-factory:SQUID-111-bug5523-encoded-uri-query-regression
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
857dc4a
Bug 5523: Do not encode URI query
rousskov 36d46f5
fixup: Remove unused PathChars() [-Wunused-function]
rousskov f47c9e6
fixup: Restore rfc1738_unescape() calls
rousskov fd45a1a
Remove Ftp::Gateway::decodedRequestUriPath()
rousskov cd53bfb
fixup: Remove a comment made stale by other branch changes
rousskov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -142,7 +142,6 @@ class Gateway : public Ftp::Client | |
|
|
||
| int checkAuth(const HttpHeader * req_hdr); | ||
| void checkUrlpath(); | ||
| std::optional<SBuf> decodedRequestUriPath() const; | ||
| void buildTitleUrl(); | ||
| void writeReplyBody(const char *, size_t len); | ||
| void completeForwarding() override; | ||
|
|
@@ -2304,15 +2303,7 @@ ftpReadQuit(Ftp::Gateway * ftpState) | |
| ftpState->serverComplete(); | ||
| } | ||
|
|
||
| /// absolute request URI path after successful decoding of all pct-encoding sequences | ||
| std::optional<SBuf> | ||
| Ftp::Gateway::decodedRequestUriPath() const | ||
| { | ||
| return AnyP::Uri::Decode(request->url.absolutePath()); | ||
| } | ||
|
|
||
| /// \prec !ftpState->flags.try_slash_hack | ||
| /// \prec ftpState->decodedRequestUriPath() | ||
| static void | ||
| ftpTrySlashHack(Ftp::Gateway * ftpState) | ||
| { | ||
|
|
@@ -2325,9 +2316,10 @@ ftpTrySlashHack(Ftp::Gateway * ftpState) | |
| wordlistDestroy(&ftpState->pathcomps); | ||
|
|
||
| /* Build the new path */ | ||
| // XXX: Conversion to c-string effectively truncates where %00 was decoded | ||
| safe_free(ftpState->filepath); | ||
| ftpState->filepath = SBufToCstring(ftpState->decodedRequestUriPath().value()); | ||
| const auto path = SBufToCstring(ftpState->request->url.absolutePath()); | ||
| rfc1738_unescape(path); | ||
| ftpState->filepath = path; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Empty lines removal, |
||
|
|
||
| /* And off we go */ | ||
| ftpGetFile(ftpState); | ||
|
|
@@ -2382,15 +2374,13 @@ ftpFail(Ftp::Gateway *ftpState) | |
| " reply code " << code << "flags(" << | ||
| (ftpState->flags.isdir?"IS_DIR,":"") << | ||
| (ftpState->flags.try_slash_hack?"TRY_SLASH_HACK":"") << "), " << | ||
| "decodable_filepath=" << bool(ftpState->decodedRequestUriPath()) << ' ' << | ||
| "mdtm=" << ftpState->mdtm << ", size=" << ftpState->theSize << | ||
| "slashhack=" << (slashHack? "T":"F")); | ||
|
|
||
| /* Try the / hack to support "Netscape" FTP URL's for retrieving files */ | ||
| if (!ftpState->flags.isdir && /* Not a directory */ | ||
| !ftpState->flags.try_slash_hack && !slashHack && /* Not doing slash hack */ | ||
| ftpState->mdtm <= 0 && ftpState->theSize < 0 && /* Not known as a file */ | ||
| ftpState->decodedRequestUriPath()) { | ||
| ftpState->mdtm <= 0 && ftpState->theSize < 0) { /* Not known as a file */ | ||
|
|
||
| switch (ftpState->state) { | ||
|
|
||
|
|
||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constand AAA aside, these changes restore pre ff60b10 code. Polishing that code is out of this PR scope, and I will remove the remaining cosmetic improvements if requested.