summaryrefslogtreecommitdiff
path: root/src/ui/documentwidget.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-11-06 21:59:39 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-11-06 21:59:39 +0200
commita3af3912421d5848bce9eac7031da406bac2ba5b (patch)
treeff62ad49b9a95da4e863ccbc60ff2fdf02692f13 /src/ui/documentwidget.c
parent4f92d0b2930a023fd4a000aabf797e5a37061b81 (diff)
Automatic redirects to the same scheme
IssueID #16
Diffstat (limited to 'src/ui/documentwidget.c')
-rw-r--r--src/ui/documentwidget.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index f1506fc3..1b6e485a 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -694,7 +694,7 @@ static void showErrorPage_DocumentWidget_(iDocumentWidget *d, enum iGmStatusCode
694 iBool useBanner = iTrue; 694 iBool useBanner = iTrue;
695 if (meta) { 695 if (meta) {
696 switch (code) { 696 switch (code) {
697 case nonGeminiRedirect_GmStatusCode: 697 case schemeChangeRedirect_GmStatusCode:
698 case tooManyRedirects_GmStatusCode: 698 case tooManyRedirects_GmStatusCode:
699 appendFormat_String(src, "\n=> %s\n", cstr_String(meta)); 699 appendFormat_String(src, "\n=> %s\n", cstr_String(meta));
700 break; 700 break;
@@ -1031,12 +1031,15 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
1031 if (d->redirectCount >= 5) { 1031 if (d->redirectCount >= 5) {
1032 showErrorPage_DocumentWidget_(d, tooManyRedirects_GmStatusCode, dstUrl); 1032 showErrorPage_DocumentWidget_(d, tooManyRedirects_GmStatusCode, dstUrl);
1033 } 1033 }
1034 else if (equalCase_Rangecc(urlScheme_String(dstUrl), "gemini")) { 1034 else if (equalCase_Rangecc(urlScheme_String(dstUrl),
1035 cstr_Rangecc(urlScheme_String(d->mod.url)))) {
1036 /* Redirects with the same scheme are automatic. */
1035 postCommandf_App( 1037 postCommandf_App(
1036 "open redirect:%d url:%s", d->redirectCount + 1, cstr_String(dstUrl)); 1038 "open redirect:%d url:%s", d->redirectCount + 1, cstr_String(dstUrl));
1037 } 1039 }
1038 else { 1040 else {
1039 showErrorPage_DocumentWidget_(d, nonGeminiRedirect_GmStatusCode, dstUrl); 1041 /* Scheme changes must be manually approved. */
1042 showErrorPage_DocumentWidget_(d, schemeChangeRedirect_GmStatusCode, dstUrl);
1040 } 1043 }
1041 iReleasePtr(&d->request); 1044 iReleasePtr(&d->request);
1042 } 1045 }