From 114b51ef6e45f74562deac1423177ddaf96ba6cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=27rysiek=27=20Wo=C5=BAniak?= <rysiek@hackerspace.pl> Date: Wed, 30 Sep 2020 00:24:06 +0000 Subject: [PATCH] minor bugfix: comparing plugins for caching purposes now done against X-Samizdat-Method response header --- service-worker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/service-worker.js b/service-worker.js index bc91e72..13b3014 100644 --- a/service-worker.js +++ b/service-worker.js @@ -456,13 +456,13 @@ let getResourceThroughSamizdat = (request, clientId, useStashed=true, doStash=tr // is newer than what we've stashed console.log('(COMMIT_UNKNOWN) checking freshness of stashed version of:', url, '\n+-- stashed from :', stashedResponse.headers.get('X-Samizdat-Method'), - '\n+-- fetched using :', reqInfo.method, + '\n+-- fetched using :', response.headers.get('X-Samizdat-Method'), '\n+-- stashed X-Samizdat-ETag :', stashedResponse.headers.get('X-Samizdat-ETag'), '\n+-- fetched X-Samizdat-ETag :', response.headers.get('X-Samizdat-ETag')) // if the method does not match, or if it matches but the ETag doesn't // we have a different response // which means *probably* fresher content - if ( ( stashedResponse.headers.get('X-Samizdat-Method') !== reqInfo.method ) + if ( ( stashedResponse.headers.get('X-Samizdat-Method') !== response.headers.get('X-Samizdat-Method') ) || ( stashedResponse.headers.get('X-Samizdat-ETag') !== response.headers.get('X-Samizdat-ETag') ) ) { // inform! console.log('(COMMIT_UNKNOWN) fetched version method or ETag differs from stashed for:', url) @@ -483,7 +483,7 @@ let getResourceThroughSamizdat = (request, clientId, useStashed=true, doStash=tr // ok, now we're in business console.log('(COMMIT_UNKNOWN) Stashing a successful fetch of:', url, - '\n+-- fetched using :', reqInfo.method, + '\n+-- fetched using :', response.headers.get('X-Samizdat-Method'), '\n+-- stashing using :', SamizdatPlugins[i].name) response.headers.forEach(function(v, k){ console.log('+-- Stashing header: ', k, ' :: ', v) -- GitLab