Bug 8952: (follow-up) using_https does not deal with Plack

When using Plack, the https method returns 'OFF'.
We have to test this value before sending the value to templates.

Test plan:
1/ Fill your OPACBaseUrl

2/ Configure apache for using http
3/ Check the social networks links (should be http://OPACBaseUrl)

4/ Launch Plack
5/ Check the social networks link (should be http://OPACBaseUrl)
6/ Stop Plack

7/ Configure apache for using https
  sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -out
/etc/apache2/server.crt -keyout /etc/apache2/server.key
and add in you virtualhost (with :443)
    SSLEngine on
    SSLCertificateFile /etc/apache2/server.crt
    SSLCertificateKeyFile /etc/apache2/server.key
  a2enmod ssl
  service apache2 restart
8/ Check the social networks links (should be https://OPACBaseUrl)

FIXME: Under Plack, with ssl actived, the CGI->https() method always
returns 'OFF'.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
Jonathan Druart 2013-05-23 17:28:25 +02:00 committed by Galen Charlton
parent a1febe1c1e
commit 3070650200

View file

@ -307,6 +307,12 @@ sub get_template_and_user {
}
# these template parameters are set the same regardless of $in->{'type'}
# Set the using_https variable for templates
# FIXME Under Plack the CGI->https method always returns 'OFF'
my $https = $in->{query}->https();
my $using_https = (defined $https and $https ne 'OFF') ? 1 : 0;
$template->param(
"BiblioDefaultView".C4::Context->preference("BiblioDefaultView") => 1,
EnhancedMessagingPreferences => C4::Context->preference('EnhancedMessagingPreferences'),
@ -325,7 +331,7 @@ sub get_template_and_user {
singleBranchMode => C4::Context->preference("singleBranchMode"),
XSLTDetailsDisplay => C4::Context->preference("XSLTDetailsDisplay"),
XSLTResultsDisplay => C4::Context->preference("XSLTResultsDisplay"),
using_https => $in->{'query'}->https() ? 1 : 0,
using_https => $using_https,
noItemTypeImages => C4::Context->preference("noItemTypeImages"),
marcflavour => C4::Context->preference("marcflavour"),
persona => C4::Context->preference("persona"),