]> lifelog.hopto.org Git - LifeLog.git/commitdiff
Header response settings fixed for lighttpd.
authorWill Budic <redacted>
Mon, 5 Jun 2023 20:23:57 +0000 (06:23 +1000)
committerWill Budic <redacted>
Mon, 5 Jun 2023 20:23:57 +0000 (06:23 +1000)
htdocs/cgi-bin/favicon.ico [moved from htdocs/favicon.ico with 100% similarity]
htdocs/cgi-bin/system/modules/HTMLIndexProcessorPlugin.pm
htdocs/cgi-bin/system/modules/MarkdownPlugin.pm
lighttpd.conf

index 96c90ddaab96a6c0dd30d8f411accba3ad6740ec..cc86a2b17b443720665bc9c530d657aec97ed95d 100644 (file)
@@ -2,6 +2,7 @@ package HTMLIndexProcessorPlugin;
 
 use strict;
 use warnings;
+no warnings qw(experimental::signatures);
 use Syntax::Keyword::Try;
 use Exception::Class ('HTMLIndexProcessorPluginException');
 use feature qw(signatures);
@@ -32,24 +33,31 @@ sub convert ($self, $parser, $property) {
     my ($buffer,$title, $link, $body_attrs, $body_on_load, $give_me);
     my $cgi          = CGI -> new();
     my $cgi_action   = $cgi-> param('action');    
-    my $cgi_doc      = $cgi-> param('doc');
+    my $cgi_doc      = $cgi-> param('doc'); 
     my $tree         = $parser-> anon($property);
     die "Tree property '$property' is not available!" if(!$tree or ref($tree) ne 'CNFNode');    
 
 try{
-    if ($cgi_action and $cgi_action eq 'load'){
-        $buffer  = $cgi->header(expires => "+0s", -charset => "UTF-8");
-        $buffer .= $cgi->start_html();
-        $buffer .= ${loadDocument($parser, $cgi_doc)} 
-    }else{
-        if (exists $parser->{'HTTP_HEADER'}){            
-            $buffer .= $parser-> {'HTTP_HEADER'};
-        }else{ 
-            if(exists $parser -> collections()->{'%HTTP_HEADER'}){
-                my %http_hdr = $parser -> collection('%HTTP_HEADER');
-                $buffer = $cgi->header(%http_hdr);
-            }
+
+
+    if (exists $parser->{'HTTP_HEADER'}){            
+        $buffer .= $parser-> {'HTTP_HEADER'};
+    }else{ 
+        if(exists $parser -> collections()->{'%HTTP_HEADER'}){
+            my %http_hdr = $parser -> collection('%HTTP_HEADER');
+            $buffer = $cgi->header(%http_hdr);
         }
+    }
+
+    if ($cgi_action and $cgi_action eq 'load'){        
+        $buffer .= $cgi->start_html(); my 
+        $load = loadDocument($parser, $cgi_doc);
+        if($load){
+           $buffer .= $$load if $load;        
+        }else{
+           $buffer .= "Document is empty: $cgi_doc\n"
+        }        
+    }else{
         $title  = $tree  -> {'Title'} if exists $tree->{'Title'};
         $link   = $tree  -> {'HEADER'};
         $body_attrs   = $tree -> {'Body'} if exists $tree -> {'Body'};
index f1da337146921c054eec57592255783144779740..b196eff6d77a9d31be822b52e093cda7d4b89ae4 100644 (file)
@@ -2,6 +2,7 @@ package MarkdownPlugin;
 
 use strict;
 use warnings;
+no warnings qw(experimental::signatures);
 use Syntax::Keyword::Try;
 use Exception::Class ('MarkdownPluginException');
 use feature qw(signatures);
index a9ee492faecdc611f9c97e79fa7a4af6e22fffc4..1ecdd2acf121c4a39ff090fd84b1e5daf4cad4e9 100644 (file)
@@ -1,13 +1,15 @@
 server.document-root = "/home/will/dev/LifeLog/htdocs/cgi-bin" 
-
+dir-listing.activate = "enable"
 server.port = 80
 
 mimetype.assign = (
   ".html" => "text/html",  
+  ".md"   => "text/plain",
   ".txt" => "text/plain",
   ".jpg" => "image/jpeg",
   ".gif" => "image/gif",
   ".png" => "image/png",
+  ".ico" => "image/ico",
   ".svg" => "image/svg+xml",
   ".css" => "text/css",
   ".js" => "text/javascript"
@@ -29,21 +31,21 @@ server.modules = (
 
 
 index-file.names = ( "index.html" )
-server.breakagelog = "/home/will/dev/LifeLog/dbLifeLog/lighttpd_server.log"
-cgi.assign = ( ".pl"  => "/usr/local/bin/perl", ".cgi" => "/usr/local/bin/perl" )
+server.breakagelog = "/home/will/dev/LifeLog/lighttpd_server.log"
+cgi.assign = ( ".pl"  => "/usr/bin/perl", ".cgi" => "/usr/bin/perl" )
 cgi.x-sendfile = "disable"
 
 
 $SERVER["socket"] == ":443" {
 #
-#ssl.engine = "disable"
+ssl.engine = "enable"
 ## Selfsigned SSL Certificate location created with openssl req -x509 -newkey rsa:4096 -sha256 ...etc...
 #https://www.interserver.net/tips/kb/how-to-configure-ssl-in-lighttpd/
 ssl.pemfile = "/home/will/dev/nomad.pem"
 server.name = "nomad.net"
-
 }
 
 # Create soft link in cgi-bin: to desired static pages directory.
 # with i.e: ln -s /home/will/dev/LifeLog/htdocs/ static
 $HTTP["url"] =~ "^/static($|/)" { server.dir-listing = "enable" }
+$HTTP["url"] =~ "^docs($|/)" { server.dir-listing = "enable" }
\ No newline at end of file