diff options
-rw-r--r-- | src/ui/documentwidget.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 9c8be416..e1be27c2 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1939,13 +1939,19 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) { | |||
1939 | } | 1939 | } |
1940 | else { | 1940 | else { |
1941 | /* Only accept redirects that use gemini scheme. */ | 1941 | /* Only accept redirects that use gemini scheme. */ |
1942 | const iString *dstUrl = absoluteUrl_String(d->mod.url, &resp->meta); | 1942 | const iString *dstUrl = absoluteUrl_String(d->mod.url, &resp->meta); |
1943 | const iRangecc srcScheme = urlScheme_String(d->mod.url); | ||
1944 | const iRangecc dstScheme = urlScheme_String(dstUrl); | ||
1943 | if (d->redirectCount >= 5) { | 1945 | if (d->redirectCount >= 5) { |
1944 | showErrorPage_DocumentWidget_(d, tooManyRedirects_GmStatusCode, dstUrl); | 1946 | showErrorPage_DocumentWidget_(d, tooManyRedirects_GmStatusCode, dstUrl); |
1945 | } | 1947 | } |
1946 | else if (equalCase_Rangecc(urlScheme_String(dstUrl), | 1948 | /* Redirects with the same scheme are automatic, and switching automatically |
1947 | cstr_Rangecc(urlScheme_String(d->mod.url)))) { | 1949 | between "gemini" and "titan" is allowed. */ |
1948 | /* Redirects with the same scheme are automatic. */ | 1950 | else if (equalRangeCase_Rangecc(dstScheme, srcScheme) || |
1951 | (equalCase_Rangecc(srcScheme, "titan") && | ||
1952 | equalCase_Rangecc(dstScheme, "gemini")) || | ||
1953 | (equalCase_Rangecc(srcScheme, "gemini") && | ||
1954 | equalCase_Rangecc(dstScheme, "titan"))) { | ||
1949 | visitUrl_Visited(visited_App(), d->mod.url, transient_VisitedUrlFlag); | 1955 | visitUrl_Visited(visited_App(), d->mod.url, transient_VisitedUrlFlag); |
1950 | postCommandf_Root(as_Widget(d)->root, | 1956 | postCommandf_Root(as_Widget(d)->root, |
1951 | "open doc:%p redirect:%d url:%s", d, d->redirectCount + 1, cstr_String(dstUrl)); | 1957 | "open doc:%p redirect:%d url:%s", d, d->redirectCount + 1, cstr_String(dstUrl)); |