Bugzilla – Attachment 31975 Details for
Bug 12758
Failure when loading or parsing XSLT stylesheets over HTTPS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12758: Workaround for loading stylesheets over https
Bug-12758-Workaround-for-loading-stylesheets-over-.patch (text/plain), 2.58 KB, created by
Marcel de Rooy
on 2014-10-02 12:24:03 UTC
(
hide
)
Description:
Bug 12758: Workaround for loading stylesheets over https
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2014-10-02 12:24:03 UTC
Size:
2.58 KB
patch
obsolete
>From 4ba66357606f638d8a8da4258644358035cd720d Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Wed, 24 Sep 2014 17:01:00 +0200 >Subject: [PATCH] Bug 12758: Workaround for loading stylesheets over https >Content-Type: text/plain; charset=utf-8 > >LibXML does not like https references when loading xml with the location >parameter. This can be resolved by reading the file into a string and >passing it to load_xml via the string parameter. > >Note that LWP::UserAgent will only load the file if LWP::Protocol::https >is installed. This is an optional perl dependency in Koha. I mark it as >required now. > >Also note that if your stylesheet contains an import with a https >reference, this fix is not enough. The load_xml call will not fail, but >the succeeding call to parse_stylesheet will still fail. As a workaround, >make your import file accessible via http. > >NOTE: Some code taken from report 12172. With thanks to Martin Renvoize. > >Test plan: >Take for example OPACXSLTDetailsDisplay and replace it by a https ref. >Check opac detail display. >Note that replacing OPACXSLTResultsDisplay by some https ref would also test >repeating the call. >--- > C4/Installer/PerlDependencies.pm | 4 ++-- > Koha/XSLT_Handler.pm | 13 ++++++++++++- > 2 files changed, 14 insertions(+), 3 deletions(-) > >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index ad1f5a6..50887ec 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -738,8 +738,8 @@ our $PERL_DEPS = { > 'min_ver' => '0.91', > }, > 'LWP::Protocol::https' => { >- 'usage' => 'OverDrive integration', >- 'required' => '0', >+ 'usage' => 'Core', >+ 'required' => '1', > 'min_ver' => '5.836', > }, > }; >diff --git a/Koha/XSLT_Handler.pm b/Koha/XSLT_Handler.pm >index 0779f2f..a4c854a 100644 >--- a/Koha/XSLT_Handler.pm >+++ b/Koha/XSLT_Handler.pm >@@ -311,7 +311,18 @@ sub _load { > > sub _load_xml_args { > my $self = shift; >- return $_[1]? { 'string' => $_[1]//'' }: { 'location' => $_[0]//'' }; >+ my $https_code = $self->_https_workaround(@_); >+ return $https_code || $_[1]? >+ { 'string' => $https_code // $_[1] }: { 'location' => $_[0]//'' }; >+} >+ >+sub _https_workaround { # Routine added for bug 12758 (part 1) >+ my ( $self, $file, $code ) = @_; >+ return if $file!~/^https/i; >+ require LWP::UserAgent; >+ my $ua = LWP::UserAgent->new( ssl_opts => { verify_hostname => 0 } ); >+ my $resp = $ua->get( $file ); >+ return $resp->decoded_content if $resp->is_success; #undef otherwise > } > > # _set_error >-- >1.7.7.6
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 12758
:
31974
|
31975
|
136711
|
136712
|
136713
|
138199
|
138200
|
138201
|
140790
|
140791
|
140792
|
142768
|
142770
|
142771
|
142772
|
143504