diff options
| author | Paul Buetow <paul@buetow.org> | 2026-07-07 14:53:53 +0300 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-07-07 14:53:53 +0300 |
| commit | 1f28ff5ac4a8a466113296d9510fe91f8cd13bc3 (patch) | |
| tree | 5739ceca594a5310f199ffbadd32923cb1c52941 /yhttpd/src/sock | |
| parent | 4dd00e26756300c0280ba4a724b1dcfa7e5ea33d (diff) | |
ychat: redirect to login page on invalid session (not blank page)
When a chat request carried an invalid/expired tmpid (no matching
session), reqp::parse returned early with an empty response, leaving
the browser with a blank page -- e.g. after a server restart (sessions
are in-memory) or reloading a bookmarked frameset URL with a stale
tmpid.
Instead serve a small redirect.html page that does a top-level JS
redirect (top.location.href) back to the login page (httpd.startsite,
i.e. index.html). Using a *top-level* redirect matters because the
chat UI is a frameset of iframes (stream/online/input) that each
reload with ?tmpid=... ; a plain in-iframe redirect would render three
stacked login forms inside the frameset, while top.location sends the
whole chat window back to the login form. top === self when this page
is loaded directly (no parent frameset), so one line covers both
cases. A noscript <a> link is included as a fallback.
The redirect response is built in the p_sess==NULL branch (mirroring
the header-wrapping at the end of parse()) and returned, so the normal
template-render path -- which would re-render the originally-requested
frame -- does not run.
Diffstat (limited to 'yhttpd/src/sock')
0 files changed, 0 insertions, 0 deletions
