Bugzilla – Attachment 27899 Details for
Bug 12172
Remote XSLT style sheets fail to fetch under https under recent LWP::Simple
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12172: Use LWP::UserAgent for remote XSLT fetch
Bug-12172-Use-LWPUserAgent-for-remote-XSLT-fetch.patch (text/plain), 1.94 KB, created by
Martin Renvoize
on 2014-05-01 17:36:57 UTC
(
hide
)
Description:
Bug 12172: Use LWP::UserAgent for remote XSLT fetch
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2014-05-01 17:36:57 UTC
Size:
1.94 KB
patch
obsolete
>From ad7558f571ec8bb649fc8c70a2d28ad814280959 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Thu, 1 May 2014 18:04:50 +0100 >Subject: [PATCH] Bug 12172: Use LWP::UserAgent for remote XSLT fetch > >This patch re-enables proper handling of https hosted remote xslt >style sheets with recent releases of LWP (libwww-perl-5.837 and >prior do not need this patch). >--- > C4/XSLT.pm | 26 +++++++++----------------- > 1 file changed, 9 insertions(+), 17 deletions(-) > >diff --git a/C4/XSLT.pm b/C4/XSLT.pm >index d85b048..5b1ed47 100644 >--- a/C4/XSLT.pm >+++ b/C4/XSLT.pm >@@ -33,7 +33,7 @@ use C4::Reserves; > use Encode; > use XML::LibXML; > use XML::LibXSLT; >-use LWP::Simple; >+use LWP::UserAgent; > > use vars qw($VERSION @ISA @EXPORT); > >@@ -43,7 +43,6 @@ BEGIN { > @ISA = qw(Exporter); > @EXPORT = qw( > &XSLTParse4Display >- &GetURI > ); > } > >@@ -53,19 +52,6 @@ C4::XSLT - Functions for displaying XSLT-generated content > > =head1 FUNCTIONS > >-=head2 GetURI >- >-GetURI file and returns the xslt as a string >- >-=cut >- >-sub GetURI { >- my ($uri) = @_; >- my $string; >- $string = get $uri ; >- return $string; >-} >- > =head2 transformMARCXML4XSLT > > Replaces codes with authorized values in a MARC::Record object >@@ -229,8 +215,14 @@ sub XSLTParse4Display { > my $xslt = XML::LibXSLT->new(); > my $style_doc; > if ( $xslfilename =~ /^https?:\/\// ) { >- my $xsltstring = GetURI($xslfilename); >- $style_doc = $parser->parse_string($xsltstring); >+ my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } ); >+ my $response = $ua->get($xslfilename); >+ if ( $response->is_success ) { >+ my $xsltstring = $response->decoded_content; >+ $style_doc = $parser->parse_string($xsltstring); >+ } else { >+ warn "Cannot fetch remote XSLT file"; >+ } > } else { > use Cwd; > $style_doc = $parser->parse_file($xslfilename); >-- >1.7.10.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 12172
: 27899