use strict;
use warnings;
+no warnings qw(experimental::signatures);
use Syntax::Keyword::Try;
use Exception::Class ('HTMLIndexProcessorPluginException');
use feature qw(signatures);
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'};
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"
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