Fix module page restore after full page reload (Ctrl+F5) - #1737
Open
sanchez90 wants to merge 1 commit into
Open
Conversation
Only consume the one-shot goto file on a real page request (when REQUEST_URI is present). A background request with an empty REQUEST_URI could otherwise read and delete the goto file before the "/" request that follows an ?xnavigation=1 redirect, breaking page restore after Ctrl+F5.
Collaborator
|
Hello,
I wonder what would cause I'm not saying the fix is incorrect in principle, and I'm aware of the race in various scenarios. But, I'd prefer to fully understand the reasons why one of the other changes was made. |
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.
Fix module page restore after full page reload (Ctrl+F5)
Fixes: #1736
Problem
After a full page reload (Ctrl+F5), authentic-theme sometimes fails to restore
the module page and lands on the dashboard instead.
Root cause
The one-shot "goto" file (written on
?xnavigation=1redirects to/) isread and deleted by
init_vars()viaget_theme_temp_data('goto'). Abackground/non-CGI request with an empty
REQUEST_URIcan consume thisfile before the real
/request runsinit_vars(), sonav_detector()findsno goto target and falls back to
/sysinfo.cgi.This is a server-side race; it is distinct from (and complementary to) the
existing
pragma_no_cachelogic, which only addresses the browser-sideheuristic cache of the root page.
Fix
Only consume the goto file on a real page request (when
REQUEST_URIispresent). Background requests with an empty
REQUEST_URIleave the fileuntouched, so the actual
/request still finds it.Testing
Reproduced on Webmin 2.660 / authentic-theme 26.60 with a custom module:
/mod/lands on/sysinfo.cgi(goto consumed by anempty-
REQUEST_URIbackground request)./mod/restores/mod/.Verified that official modules (e.g.
/sshd/) continue to restore correctly.