Changeset 451

Show
Ignore:
Timestamp:
04/01/06 15:39:24
Author:
ko
Message:

* fixed skip for broken url
* add timeout option

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Aggregator/Xango.pm

    r442 r451  
    55 
    66package Plagger::Plugin::Aggregator::Xango; 
    7 #sub Xango::DEBUG { 1 }; 
    87use strict; 
    98use base qw( Plagger::Plugin::Aggregator::Simple ); 
     
    1817        Alias => 'xgbroker', 
    1918        HandlerAlias => 'xghandler', 
    20         HttpCompArgs => [ Agent => "Plagger/$Plagger::VERSION (http://plagger.org/)" ], 
     19        HttpCompArgs => [ Agent => "Plagger/$Plagger::VERSION (http://plagger.org/)", Timeout => $self->conf->{timeout} || 10 ], 
    2120        %{$self->conf->{xango_args} || {}}, 
    2221    ); 
     
    102101    my $url    = $job->uri; 
    103102    if ($r->code =~ /^30[12]$/) { 
    104         $_[KERNEL]->post($_[HEAP]->{BROKER_ALIAS}, 'enqueue_job', Xango::Job->new(uri => URI->new($r->header('location')), redirect => $redirect)); 
     103        $url = $r->header('location'); 
     104        return unless $url =~ m!^https?://!i; 
     105        $_[KERNEL]->post($_[HEAP]->{BROKER_ALIAS}, 'enqueue_job', Xango::Job->new(uri => URI->new($url), redirect => $redirect)); 
     106        return; 
    105107    } else { 
    106108        return unless $r->is_success; 
     
    113115            if (@feeds) { 
    114116                $url = $feeds[0]; 
     117                return unless $url =~ m!^https?://!i; 
    115118                $_[KERNEL]->post($_[HEAP]->{BROKER_ALIAS}, 'enqueue_job', Xango::Job->new(uri => URI->new($url), redirect => $redirect)); 
    116             } else { 
    117                 return; 
    118119            } 
     120            return; 
    119121        } 
    120122    }