diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-15 11:01:56 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-15 11:01:56 +0300 |
commit | b10087331ff28acbc368361ba14dba3a70b7dc90 (patch) | |
tree | c9fe060826b4bfc606d5d77eb64cc5b1da9112f0 /src | |
parent | 3121e8067a613680433724f0c0eb30254e622649 (diff) |
Don’t cache content of “about:” pages
Diffstat (limited to 'src')
-rw-r--r-- | src/gmutil.c | 6 | ||||
-rw-r--r-- | src/gmutil.h | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 10 |
3 files changed, 16 insertions, 1 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index a919d621..2138caa3 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -88,6 +88,12 @@ void cleanUrlPath_String(iString *d) { | |||
88 | deinit_String(&clean); | 88 | deinit_String(&clean); |
89 | } | 89 | } |
90 | 90 | ||
91 | iRangecc urlProtocol_String(const iString *d) { | ||
92 | iUrl url; | ||
93 | init_Url(&url, d); | ||
94 | return url.protocol; | ||
95 | } | ||
96 | |||
91 | iRangecc urlHost_String(const iString *d) { | 97 | iRangecc urlHost_String(const iString *d) { |
92 | iUrl url; | 98 | iUrl url; |
93 | init_Url(&url, d); | 99 | init_Url(&url, d); |
diff --git a/src/gmutil.h b/src/gmutil.h index 8dda84d0..9e8c5934 100644 --- a/src/gmutil.h +++ b/src/gmutil.h | |||
@@ -70,6 +70,7 @@ struct Impl_Url { | |||
70 | 70 | ||
71 | void init_Url (iUrl *, const iString *text); | 71 | void init_Url (iUrl *, const iString *text); |
72 | 72 | ||
73 | iRangecc urlProtocol_String (const iString *); | ||
73 | iRangecc urlHost_String (const iString *); | 74 | iRangecc urlHost_String (const iString *); |
74 | const iString * absoluteUrl_String (const iString *, const iString *urlMaybeRelative); | 75 | const iString * absoluteUrl_String (const iString *, const iString *urlMaybeRelative); |
75 | iString * makeFileUrl_String (const iString *localFilePath); | 76 | iString * makeFileUrl_String (const iString *localFilePath); |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index d425b8a9..891e7650 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -595,6 +595,9 @@ static iBool updateFromHistory_DocumentWidget_(iDocumentWidget *d) { | |||
595 | postCommandf_App("document.changed doc:%p url:%s", d, cstr_String(d->mod.url)); | 595 | postCommandf_App("document.changed doc:%p url:%s", d, cstr_String(d->mod.url)); |
596 | return iTrue; | 596 | return iTrue; |
597 | } | 597 | } |
598 | else if (!isEmpty_String(d->mod.url)) { | ||
599 | fetch_DocumentWidget_(d); | ||
600 | } | ||
598 | return iFalse; | 601 | return iFalse; |
599 | } | 602 | } |
600 | 603 | ||
@@ -956,7 +959,12 @@ static iBool handleCommand_DocumentWidget_(iDocumentWidget *d, const char *cmd) | |||
956 | checkResponse_DocumentWidget_(d); | 959 | checkResponse_DocumentWidget_(d); |
957 | d->scrollY = d->initialNormScrollY * size_GmDocument(d->doc).y; | 960 | d->scrollY = d->initialNormScrollY * size_GmDocument(d->doc).y; |
958 | d->state = ready_RequestState; | 961 | d->state = ready_RequestState; |
959 | setCachedResponse_History(d->mod.history, response_GmRequest(d->request)); | 962 | /* The response may be cached. */ { |
963 | const iRangecc proto = urlProtocol_String(d->mod.url); | ||
964 | if (!equal_Rangecc(&proto, "about")) { | ||
965 | setCachedResponse_History(d->mod.history, response_GmRequest(d->request)); | ||
966 | } | ||
967 | } | ||
960 | iReleasePtr(&d->request); | 968 | iReleasePtr(&d->request); |
961 | updateVisible_DocumentWidget_(d); | 969 | updateVisible_DocumentWidget_(d); |
962 | postCommandf_App("document.changed url:%s", cstr_String(d->mod.url)); | 970 | postCommandf_App("document.changed url:%s", cstr_String(d->mod.url)); |