aboutsummaryrefslogtreecommitdiff
path: root/Plugin
diff options
context:
space:
mode:
authorDavid Phillips <david@sighup.nz>2019-09-29 13:30:29 +1300
committerDavid Phillips <david@sighup.nz>2019-09-29 13:30:29 +1300
commit892c385e04880f723567b3611eb945093f1eed8b (patch)
treececc0887f316a208b3cd39169e3066e054d5b107 /Plugin
parent675510557f7499251ac8db3f19b1ca9a692c3f08 (diff)
downloadidalius-master.tar.xz
URL_Title: clear globals before parsingHEADmaster
This patch prevents accidental leakage of content-type header and charset between calls to get_title. Without clearing these, it is possible for a URL title to be decoded from the wrong charset if a URL was previously titled with a differing charset to the current one. This patch clears these stale values to guarantee accurate charset decoding per URL.
Diffstat (limited to 'Plugin')
-rw-r--r--Plugin/URL_Title.pm4
1 files changed, 3 insertions, 1 deletions
diff --git a/Plugin/URL_Title.pm b/Plugin/URL_Title.pm
index 14b963d..d787d90 100644
--- a/Plugin/URL_Title.pm
+++ b/Plugin/URL_Title.pm
@@ -88,7 +88,9 @@ sub get_title
my $html = $response->{content};
- $title = "";
+ $charset = undef;
+ $content_type = undef;
+ $title = undef;
my $p = HTML::Parser->new(api_version => 3);
$p->handler( start => \&start_handler, "tagname,attr,self" );
$p->parse($html);