[Koha-bugs] [Bug 6267] New: custom http user-agent in check-url.pl (fix for books.google.com 401 error)
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Tue Apr 26 03:43:24 CEST 2011
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=6267
Bug #: 6267
Summary: custom http user-agent in check-url.pl (fix for
books.google.com 401 error)
Classification: Unclassified
Change sponsored?: ---
Product: Koha
Version: rel_3_2
Platform: All
OS/Version: All
Status: NEW
Severity: trivial
Priority: P5
Component: Command-line Utilities
AssignedTo: gmcharlt at gmail.com
ReportedBy: judit at calyx.net.au
QAContact: koha-bugs at lists.koha-community.org
After running check-url.pl on couple of Koha instances i noticed that every
single URL from books.google.com came back with 401 Unauthorized error, even
though the URLs were very much alive.
I have changed the http user-agent, and now it works OK.
Here is my fix:
koha/koha.git/misc/cronjobs# diff check-url.pl check-url-calyx.pl
88c88
< my ($class, $timeout) = @_;
---
> my ($class, $timeout, $agent) = @_;
91a92
> $uagent->agent( $agent) if $agent;
159a161
> my $agent = '';
166a169
> 'agent=s' => \$agent,
187c190
< my $checker = C4::URL::Checker->new($timeout);
---
> my $checker = C4::URL::Checker->new($timeout,$agent);
246c249
< =item check-url.pl [--verbose|--help] [--host=http://default.tld]
---
> =item check-url.pl [--verbose|--help|--agent] [--host=http://default.tld]
266a270,275
> =item B<--agent>
>
> Change default libwww user-agent string to custom.
> Some sites does not like libwww user agent and so check-url gives
> error even if the site works from browser.
>
Please note that i am not a perl developer. The patch has been tested on
several Koha installs, but there might be a nicer solution out there.
Sponsored by CALYX information essentials.
--
Configure bugmail: http://bugs.koha-community.org/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
More information about the Koha-bugs
mailing list