* Fixed the problem with rendering the webUI... The recursive loop counter was set to 1000, and that was triggering when reading a file longer than 1000 lines. Pushed the counter up to 500000 to prevent this in the future, but still allow infinite loops to exit before too long.

* Added 'CGI::Carp "fatalsToBrowser"' to striker to make error handling better, and print out the HTML header when the loop detector fires in a browser.
* Updated System->check_if_configured() return '0' instead of an empty string when not configured.
* Added the 'test' parameter for debugging to Template->get().

Signed-off-by: Digimer <digimer@alteeve.ca>
main
Digimer 6 years ago
parent 2c23c6beba
commit 3f83e3c310
  1. 3
      Anvil/Tools/Log.pm
  2. 2
      Anvil/Tools/System.pm
  3. 1
      Anvil/Tools/Template.pm
  4. 16
      cgi-bin/striker

@ -251,7 +251,8 @@ sub entry
$anvil->data->{loop}{count} = 0 if not defined $anvil->data->{loop}{count};
$anvil->data->{loop}{count}++;
print $THIS_FILE." ".__LINE__."; [ Debug ] - level: [".$level."], defaults::log::level: [".$anvil->data->{defaults}{'log'}{level}."], logging secure? [".$anvil->Log->secure."], loop::count: [".$anvil->data->{loop}{count}."]\n" if $test;
if ($anvil->data->{loop}{count} > 1000)
# The counter needs to be longer than any conceivable file line count we might read.
if ($anvil->data->{loop}{count} > 500000)
{
if ($anvil->environment eq "html")
{

@ -494,6 +494,8 @@ sub check_if_configured
modified_date => $modified_date,
}});
$configured = 0 if not defined $configured;
$configured = 0 if $configured eq "";
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { configured => $configured }});
return($configured);
}

@ -121,6 +121,7 @@ sub get
my $parameter = shift;
my $anvil = $self->parent;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
my $test = defined $parameter->{test} ? $parameter->{test} : 0;
my $file = defined $parameter->{file} ? $parameter->{file} : "";
my $language = defined $parameter->{language} ? $parameter->{language} : $anvil->Words->language({debug => $debug});

@ -13,6 +13,7 @@ use warnings;
use Anvil::Tools;
use Data::Dumper;
use NetAddr::IP;
use CGI::Carp "fatalsToBrowser";
# Turn off buffering
$| = 1;
@ -24,16 +25,11 @@ if (($running_directory =~ /^\./) && ($ENV{PWD}))
$running_directory =~ s/^\./$ENV{PWD}/;
}
my $anvil = Anvil::Tools->new({log_level => 2, log_secure => 1});
my $anvil = Anvil::Tools->new();
$anvil->Log->level({set => 2});
### NOTE: We'll print the headers only when we need to. If we print them here, it will block cookies being set.
# Set the log level to 2. Setting 3 slows he program down a LOT.
# Read the config and then connect to the database.
$anvil->Storage->read_config();
### Setup some variables.
# Setup some variables.
$anvil->data->{skin}{url} = $anvil->data->{path}{urls}{skins}."/".$anvil->Template->skin;
$anvil->data->{form}{body} = "";
$anvil->data->{form}{error_massage} = "";
@ -65,10 +61,10 @@ if (not $anvil->data->{sys}{database}{connections})
# If any jobs are pending/running, show the "unavailable" option.
my $configured = $anvil->System->check_if_configured;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { configured => $configured }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { configured => $configured }});
my $available = $configured ? check_availability($anvil) : 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => {available => $available }});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {available => $available }});
if (not $configured)
{
# If there is no user account yet, then the system is new and needs to be reconfigured.

Loading…
Cancel
Save