summaryrefslogtreecommitdiff
path: root/rhautoimport.pm
diff options
context:
space:
mode:
Diffstat (limited to 'rhautoimport.pm')
-rw-r--r--rhautoimport.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/rhautoimport.pm b/rhautoimport.pm
index 4ea0808..83bf17b 100644
--- a/rhautoimport.pm
+++ b/rhautoimport.pm
@@ -59,7 +59,7 @@ sub get_dropboxes
sub fetch_parse_rss
{
- my ($url, $ua_str) = @_;
+ my ($url, $ua_str, $headers) = @_;
my $uri = URI->new($url);
$ua_str = "Radio Helsinki - Automatic Import" unless $ua_str;
@@ -67,6 +67,12 @@ sub fetch_parse_rss
my $ua = LWP::UserAgent->new;
$ua->agent($ua_str);
$ua->env_proxy;
+ if (defined $headers) {
+ while(my ($field, $value) = each %{$headers}) {
+ $ua->default_header($field, $value);
+ }
+ }
+
my $res = URI::Fetch->fetch($uri, UserAgent => $ua);
return (0, URI::Fetch->errstr) unless $res;
return (0, "This feed has been permanently removed") if $res->status == URI::Fetch::URI_GONE();