commit 8fdc2fde6f60b95d63c5499d04439d1ffdf3e9db1487dcecfa6c9616358f014d from: Johannes Thyssen Tishman date: Fri Jun 19 09:01:36 2026 UTC gotwebd: refresh site to "redirect" after login Some mobile browsers (e.g. Fennec and Vanadium, Firefox and Chromium based browsers, respectively) don't redirect to the repositories index when launched with the authentication URL after login. This was reproduced programmatically using dart's url_launcher library[0], as well as by using "Open with" from the context menu in Termux when selecting the authentication URL. The issue is discussed in a StackOverflow thread[1], which suggests the workaround implemented here. Instead of redirecting using a HTTP 307 'Temporary Redirect' response, reply with 200 'OK' and perform a client-side "redirection" using an HTML 'meta http-equiv="refresh"' tag. ok stsp@ and op@ [0] https://pub.dev/packages/url_launcher [1] https://stackoverflow.com/questions/4694089/sending-browser-cookies-during-a-302-redirect commit - dc70a51316a58c9950d7ddb957c292472c61b263dcb690b43154606f803401fe commit + 8fdc2fde6f60b95d63c5499d04439d1ffdf3e9db1487dcecfa6c9616358f014d blob - 156a3f313fc90a6df2aac13a704945f76eadec7ba8ee43b7320ba28603a58236 blob + d53549f02e62626fd8b9d3f7bff8277dccb0f5e5c1c0c49c637a9d79f321aaf4 --- gotwebd/auth.c +++ gotwebd/auth.c @@ -291,7 +291,6 @@ do_login(struct request *c) char *token = NULL; const char *identifier = NULL; const time_t validity = 24 * 60 * 60; /* 1 day */ - struct gotweb_url url; struct gotwebd_repo *repo; int r; @@ -398,9 +397,10 @@ logged_in: goto err; } - memset(&url, 0, sizeof(url)); - url.action = INDEX; - gotweb_reply(c, 307, "text/html", &url); + if (gotweb_reply(c, 200, "text/html", NULL) == -1) + return; + gotweb_render_fake_redirect(c->tp); + return; err: blob - c847e0c272361c2cad1c16a4790eddd58a58db761cf1bc1621ccd266d3368ee5 blob + 89508f5e4e693d889e9fdf58f6023c4ea46f1c401abfa84291325ec4923697a9 --- gotwebd/gotwebd.h +++ gotwebd/gotwebd.h @@ -667,6 +667,7 @@ int gotweb_render_blame(struct template *); int gotweb_render_patch(struct template *); int gotweb_render_rss(struct template *); int gotweb_render_unauthorized(struct template *); +int gotweb_render_fake_redirect(struct template *); /* parse.y */ struct gotwebd_repo * gotwebd_new_repo(const char *); blob - 2021ad223878857aef27e1b8ae89f5b4b0c870d5a9bdfb0e0197f62a8c24e0bd blob + 983b65414e6c1e07212a8abadfd201546689211ca16080339203979c02cc6fca --- gotwebd/pages.tmpl +++ gotwebd/pages.tmpl @@ -1468,3 +1468,21 @@ date: {{ datebuf }} {{ " UTC" }} {{ "\n" }} {{ define gotweb_render_unauthorized(struct template *tp) }}

Wrong or missing authentication code

{{ end }} + +{{ define gotweb_render_fake_redirect(struct template *tp) }} +{! + struct gotweb_url url; + memset(&url, 0, sizeof(url)); + url.action = INDEX; +!} + + + + + +

+ Please click here + {{ " " }} if the page does not redirect automatically. + + +{{ end }}