Bugzilla – Attachment 8937 Details for
Bug 6267
custom http user-agent in check-url.pl (fix for books.google.com 401 error)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 6267 custom http user-agent in check-url.pl (fix for books.google.com 401 error)
Bug-6267-custom-http-user-agent-in-check-urlpl-fix.patch (text/plain), 2.53 KB, created by
Chris Cormack
on 2012-04-05 21:23:16 UTC
(
hide
)
Description:
Bug 6267 custom http user-agent in check-url.pl (fix for books.google.com 401 error)
Filename:
MIME Type:
Creator:
Chris Cormack
Created:
2012-04-05 21:23:16 UTC
Size:
2.53 KB
patch
obsolete
>From 6601630ac75069655880b09eba0c43116ac9797f Mon Sep 17 00:00:00 2001 >From: MJ Ray <mjr@phonecoop.coop> >Date: Thu, 5 Apr 2012 13:18:07 +0100 >Subject: [PATCH] Bug 6267 custom http user-agent in check-url.pl (fix for > books.google.com 401 error) > >Patch by Judit with a small change to the help wording. >Sponsored by CALYX information essentials. > >Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz> >--- > misc/cronjobs/check-url.pl | 15 ++++++++++++--- > 1 files changed, 12 insertions(+), 3 deletions(-) > >diff --git a/misc/cronjobs/check-url.pl b/misc/cronjobs/check-url.pl >index 3936b49..e1d3144 100755 >--- a/misc/cronjobs/check-url.pl >+++ b/misc/cronjobs/check-url.pl >@@ -85,9 +85,10 @@ use C4::Biblio; > sub new { > > my $self = {}; >- my ($class, $timeout) = @_; >+ my ($class, $timeout, $agent) = @_; > > my $uagent = new LWP::UserAgent; >+ $uagent->agent( $agent ) if $agent; > $uagent->timeout( $timeout) if $timeout; > $self->{ user_agent } = $uagent; > $self->{ bad_url } = { }; >@@ -156,6 +157,7 @@ my $host = ''; > my $host_pro = ''; > my $html = 0; > my $uriedit = "/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber="; >+my $agent = ''; > my $timeout = 15; > GetOptions( > 'verbose' => \$verbose, >@@ -163,6 +165,7 @@ GetOptions( > 'help' => \$help, > 'host=s' => \$host, > 'host-pro=s' => \$host_pro, >+ 'agent=s' => \$agent; > 'timeout=i', => \$timeout, > ); > >@@ -184,7 +187,7 @@ sub bibediturl { > # Check all URLs from all current Koha biblio records > # > sub check_all_url { >- my $checker = C4::URL::Checker->new($timeout); >+ my $checker = C4::URL::Checker->new($timeout,$agent); > $checker->{ host_default } = $host; > > my $context = new C4::Context( ); >@@ -243,7 +246,7 @@ check-url.pl - Check URLs from 856$u field. > > =over > >-=item check-url.pl [--verbose|--help] [--host=http://default.tld] >+=item check-url.pl [--verbose|--help] [--agent=agent-string] [--host=http://default.tld] > > Scan all URLs found in 856$u of bib records > and display if resources are available or not. >@@ -274,6 +277,12 @@ record in edit mode. With this parameter B<--host-pro> is required. > > Server host used to link to biblio record editing page. > >+=item B<--agent=agent-string> >+ >+Change default libwww user-agent string to custom. Some sites do >+not like libwww user-agent and return false 40x failure codes, >+so this allows Koha to report itself as Koha, or a browser. >+ > =item B<--timeout=15> > > Timeout for fetching URLs. By default 15 seconds. >-- >1.7.5.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 6267
:
8913
|
8937
|
9769
|
9833