From: Will Budicm Date: Sat, 23 May 2020 01:50:19 +0000 (+1000) Subject: Implemented gzip encoding, size transfered now 1/3 or actual page. Takes 340ms. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=7c2d16a8663c53106aa962ea894f72954722f352;p=LifeLog.git Implemented gzip encoding, size transfered now 1/3 or actual page. Takes 340ms. --- diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 7d3ccb1..d1f6bed 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -28,6 +28,7 @@ use Gzip::Faster; #DEFAULT SETTINGS HERE! use lib "system/modules"; require Settings; +$CGI::POST_MAX = 1024 * 1024 * 5; # max 5B posts my $cgi = CGI->new; my $sss = new CGI::Session( "driver:File", $cgi, { Directory => &Settings::logPath } ); @@ -82,7 +83,7 @@ my $BGCOL = &Settings::bgcol; my $DEBUG = &Settings::debug; #END OF SETTINGS - +my $BUFFER; my $lang = Date::Language->new(Settings::language()); my $today = DateTime->now; @@ -211,62 +212,11 @@ else { #defaults $imgh = 120; } -print $cgi->header(-expires => "0s", -charset => "UTF-8"); -print $cgi->start_html( - -title => "Personal Log", - -BGCOLOR => $BGCOL, - -onload => "onBodyLoad('$toggle','".Settings::timezone()."','$today','".&Settings::sessionExprs."',$rs_cur);", - -style => [ - { -type => 'text/css', -src => "wsrc/$TH_CSS" }, - { -type => 'text/css', -src => 'wsrc/jquery-ui.css' }, - { -type => 'text/css', -src => 'wsrc/jquery-ui.theme.css' }, - { - -type => 'text/css', - -src => 'wsrc/jquery-ui-timepicker-addon.css' - }, - { -type => 'text/css', -src => 'wsrc/tip-skyblue/tip-skyblue.css' }, - { - -type => 'text/css', - -src => 'wsrc/tip-yellowsimple/tip-yellowsimple.css' - }, - - { -type => 'text/css', -src => 'wsrc/quill/katex.min.css' }, - { -type => 'text/css', -src => 'wsrc/quill/monokai-sublime.min.css' }, - { -type => 'text/css', -src => 'wsrc/quill/quill.snow.css' }, - { -type => 'text/css', -src => 'wsrc/jquery.sweet-dropdown.css' }, - - ], - -script => [ - { -type => 'text/javascript', -src => 'wsrc/main.js' }, - { -type => 'text/javascript', -src => 'wsrc/jquery.js' }, - { -type => 'text/javascript', -src => 'wsrc/jquery-ui.js' }, - { - -type => 'text/javascript', - -src => 'wsrc/jquery-ui-timepicker-addon.js' - }, - { - -type => 'text/javascript', - -src => 'wsrc/jquery-ui-sliderAccess.js' - }, - { -type => 'text/javascript', -src => 'wsrc/jquery.poshytip.js' }, - - { -type => 'text/javascript', -src => 'wsrc/quill/katex.min.js' }, - { -type => 'text/javascript', -src => 'wsrc/quill/highlight.min.js' }, - { -type => 'text/javascript', -src => 'wsrc/quill/quill.min.js' }, - { -type => 'text/javascript', -src => 'wsrc/jscolor.js' }, - { -type => 'text/javascript', -src => 'wsrc/moment.js' }, - { -type => 'text/javascript', -src => 'wsrc/moment-timezone-with-data.js' }, - { -type => 'text/javascript', -src => 'wsrc/jquery.sweet-dropdown.js'} - - ], -); - - my $st; my $sqlCAT = "SELECT ID, NAME, DESCRIPTION FROM CAT ORDER BY ID;"; my $sqlVWL = "$stmS STICKY = 1 $stmE"; -print qq(## Using db -> $dsn\n) if $DEBUG; +PrintB (qq(## Using db -> $dsn\n)) if $DEBUG; $st = $db->prepare($sqlCAT); $st->execute() or LifeLogException->throw($DBI::errstri); @@ -419,7 +369,7 @@ qq(
my $re_a_tag = qr/.*<\/a>/si; my $isInViewMode = rindex ($sqlVWL, 'PID<=') > 0 || rindex ($sqlVWL, 'ID_CAT=') > 0 || $prm_aa || rindex ($sqlVWL, 'REGEXP')>0; - print $cgi->pre("###[Session PARAMS->isV:$isInViewMode|vc=$prm_vc|xc=$prm_xc|aa: $prm_aa|xc_lst=$prm_xc_lst|\@xc_lst=@xc_lst|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG; + PrintB $cgi->pre("###[Session PARAMS->isV:$isInViewMode|vc=$prm_vc|xc=$prm_xc|aa: $prm_aa|xc_lst=$prm_xc_lst|\@xc_lst=@xc_lst|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG; if ( $log_start > 0 ) { @@ -447,7 +397,7 @@ qq( #Following is saying is in page selection, not view selection, or accounting on type of sticky entries. if( !$isInViewMode && !$prm_vc && !$prm_xc && !$rs_keys && !$rs_dat_from ){ $sqlVWL = "$stmS STICKY != 1 $stmE"; - print $cgi->pre("###2 -> ".$sqlVWL) if $DEBUG; + PrintB $cgi->pre("###2 -> ".$sqlVWL) if $DEBUG; ; &buildLog(traceDBExe($sqlVWL)); } @@ -456,7 +406,7 @@ qq( sub traceDBExe { my $sql = shift; try{ - print "do:$sql" if ($DEBUG); + PrintB("do:$sql") if ($DEBUG); my $st = $db->prepare($sql); $st -> execute() or LifeLogException->throw("Execute failed [$DBI::errstri]", show_trace=>1); return $st; @@ -467,7 +417,7 @@ sub traceDBExe { sub buildLog { my $pst = shift; - #print "## sqlVWL: $sqlVWL\n"; + #PrintB "## sqlVWL: $sqlVWL\n"; while ( my @row = $pst->fetchrow_array() ) { my $i = 0; $id = $row[$i++]; #ID must be rowid in LOG. @@ -1000,10 +950,10 @@ _TXT my $help = &help; ################################ - # Page printout from here! # + # Page PrintBout from here! # ################################ -print qq( +printB (qq(