]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
Merge remote branch 'smcv/ready/sslcookie-auto'
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index 28020b500c830bafc52cf49c3ba75bc5dfca1ce4..ede194ff9aee945dc0fb471bedaa47bf93eda829 100644 (file)
@@ -12,7 +12,7 @@ use Encode;
 sub printheader ($) {
        my $session=shift;
        
 sub printheader ($) {
        my $session=shift;
        
-       if ($config{sslcookie}) {
+       if ($ENV{HTTPS} || $config{sslcookie}) {
                print $session->header(-charset => 'utf-8',
                        -cookie => $session->cookie(-httponly => 1, -secure => 1));
        }
                print $session->header(-charset => 'utf-8',
                        -cookie => $session->cookie(-httponly => 1, -secure => 1));
        }
@@ -116,7 +116,7 @@ sub cgi_signin ($$;$) {
                required => 'NONE',
                javascript => 0,
                params => $q,
                required => 'NONE',
                javascript => 0,
                params => $q,
-               action => $config{cgiurl},
+               action => cgiurl(),
                header => 0,
                template => {type => 'div'},
                stylesheet => 1,
                header => 0,
                template => {type => 'div'},
                stylesheet => 1,
@@ -198,7 +198,7 @@ sub cgi_prefs ($$) {
                required => 'NONE',
                javascript => 0,
                params => $q,
                required => 'NONE',
                javascript => 0,
                params => $q,
-               action => $config{cgiurl},
+               action => cgiurl(),
                template => {type => 'div'},
                stylesheet => 1,
                fieldsets => [
                template => {type => 'div'},
                stylesheet => 1,
                fieldsets => [
@@ -231,11 +231,11 @@ sub cgi_prefs ($$) {
        
        if ($form->submitted eq 'Logout') {
                $session->delete();
        
        if ($form->submitted eq 'Logout') {
                $session->delete();
-               redirect($q, $config{url});
+               redirect($q, baseurl(undef));
                return;
        }
        elsif ($form->submitted eq 'Cancel') {
                return;
        }
        elsif ($form->submitted eq 'Cancel') {
-               redirect($q, $config{url});
+               redirect($q, baseurl(undef));
                return;
        }
        elsif ($form->submitted eq 'Save Preferences' && $form->validate) {
                return;
        }
        elsif ($form->submitted eq 'Save Preferences' && $form->validate) {
@@ -283,7 +283,7 @@ sub check_banned ($$) {
 
        foreach my $b (@{$config{banned_users}}) {
                if (pagespec_match("", $b,
 
        foreach my $b (@{$config{banned_users}}) {
                if (pagespec_match("", $b,
-                       ip => $ENV{REMOTE_ADDR},
+                       ip => $session->remote_addr(),
                        name => defined $name ? $name : "",
                )) {
                        $banned=1;
                        name => defined $name ? $name : "",
                )) {
                        $banned=1;