From 20805809f42d8fa152aca46d0b737e90b308092a Mon Sep 17 00:00:00 2001 From: Yorhel Date: Tue, 21 Oct 2014 09:53:53 +0200 Subject: Use TUWF's reqBaseURI() instead of $self->{uri} on site links TUWF properly detects HTTPS and includes this in the returned URL, so this change ensures that all URLs adopt properly to HTTP and HTTPS. --- lib/VNDB/Handler/Misc.pm | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/VNDB/Handler/Misc.pm') diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm index d801c667..357779bc 100644 --- a/lib/VNDB/Handler/Misc.pm +++ b/lib/VNDB/Handler/Misc.pm @@ -350,7 +350,8 @@ sub setlang { my $browser = VNDB::L10N->get_handle()->language_tag(); - (my $ref = $self->reqHeader('Referer')||'/') =~ s/^\Q$self->{url}//; + my $b = $self->reqBaseURI(); + (my $ref = $self->reqHeader('Referer')||'/') =~ s/^\Q$b//; $self->resRedirect($ref, 'post'); if($lang ne $self->{l10n}->language_tag()) { $self->authInfo->{id} @@ -396,6 +397,7 @@ sub prefs { sub opensearch { my $self = shift; + my $h = $self->reqBaseURI(); $self->resHeader('Content-Type' => 'application/opensearchdescription+xml'); xml; tag 'OpenSearchDescription', @@ -403,12 +405,12 @@ sub opensearch { tag 'ShortName', 'VNDB'; tag 'LongName', 'VNDB.org visual novel search'; tag 'Description', 'Search visual vovels on VNDB.org'; - tag 'Image', width => 16, height => 16, type => 'image/x-icon', $self->{url}.'/favicon.ico' + tag 'Image', width => 16, height => 16, type => 'image/x-icon', "$h/favicon.ico" if -s "$VNDB::ROOT/www/favicon.ico"; - tag 'Url', type => 'text/html', method => 'get', template => $self->{url}.'/v/all?q={searchTerms}', undef; - tag 'Url', type => 'application/opensearchdescription+xml', rel => 'self', template => $self->{url}.'/opensearch.xml', undef; + tag 'Url', type => 'text/html', method => 'get', template => "$h/v/all?q={searchTerms}", undef; + tag 'Url', type => 'application/opensearchdescription+xml', rel => 'self', template => "$h/opensearch.xml", undef; tag 'Query', role => 'example', searchTerms => 'Tsukihime', undef; - tag 'moz:SearchForm', $self->{url}.'/v/all'; + tag 'moz:SearchForm', "$h/v/all"; end 'OpenSearchDescription'; } -- cgit v1.2.3