aboutsummaryrefslogtreecommitdiffstats
path: root/lib/WWW/StrawViewer.pm
diff options
context:
space:
mode:
authortrizen <trizen@protonmail.com>2020-02-26 13:50:43 +0200
committertrizen <trizen@protonmail.com>2020-02-26 13:50:43 +0200
commit1659520ed4f2bf9a3039a5c59218fa32fddb6580 (patch)
tree211b743a68638152535508e9fa2ec9788763df4c /lib/WWW/StrawViewer.pm
parent4322b0c7166a83de85af28402a1a2aed2178f530 (diff)
downloadfair-viewer-1659520ed4f2bf9a3039a5c59218fa32fddb6580.tar.lz
fair-viewer-1659520ed4f2bf9a3039a5c59218fa32fddb6580.tar.xz
fair-viewer-1659520ed4f2bf9a3039a5c59218fa32fddb6580.zip
- Don't cache resposes with code >= 300.
- Added support for session cookies, as some instances of "invidio.us", such as "invidiou.sh", seems to require cookies to be enabled. The instance can be changed in the configuration file by modifying the value of "api_host".
Diffstat (limited to 'lib/WWW/StrawViewer.pm')
-rw-r--r--lib/WWW/StrawViewer.pm3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/WWW/StrawViewer.pm b/lib/WWW/StrawViewer.pm
index 3c8a302..99331d5 100644
--- a/lib/WWW/StrawViewer.pm
+++ b/lib/WWW/StrawViewer.pm
@@ -271,6 +271,7 @@ sub set_lwp_useragent {
$self->{lwp} = $lwp->new(
+ cookie_jar => {}, # temporary cookies
timeout => $self->get_lwp_timeout,
show_progress => $self->get_debug,
agent => $self->get_lwp_agent,
@@ -284,7 +285,7 @@ sub set_lwp_useragent {
my ($response) = @_;
my $code = $response->code;
- $code >= 400 # do not cache any bad response
+ $code >= 300 # do not cache any bad response
or $response->request->method ne 'GET' # cache only GET requests
# don't cache if "cache-control" specifies "max-age=0" or "no-store"