Fixed config check code

This commit is contained in:
Jamie Cameron
2013-03-07 23:29:42 -08:00
parent f37703ca89
commit c02e4454ab
2 changed files with 9 additions and 5 deletions

View File

@@ -41,16 +41,20 @@ elsif ($err) {
if (time() - $config{'last_check'} > 6*60*60) {
my $sz = &check_server_download_size();
$config{'last_check'} = time();
$config{'last_size'} = $sz;
&save_module_config();
}
if ($config{'last_size'}) {
my $jar = $config{'minecraft_jar'} ||
$config{'minecraft_dir'}."/"."minecraft_server.jar";
my @st = stat($jar);
if (@st && $sz && $st[7] != $sz) {
print "<center>\n";
if (@st && $st[7] != $config{'last_size'}) {
print "<table width=100%><tr bgcolor=#ff8888>".
"<td align=center><br>";
print &ui_form_start("download.cgi");
print "<b>$text{'index_upgradedesc'}</b>\n";
print &ui_form_end([ [ undef, $text{'index_upgrade'} ] ]);
print "</center>\n";
print "</td></tr></table>\n";
}
}

View File

@@ -589,13 +589,13 @@ return undef if (!ref($h));
# Read headers
my $line;
($line = &read_http_connection($_[0])) =~ tr/\r\n//d;
($line = &read_http_connection($h)) =~ tr/\r\n//d;
if ($line !~ /^HTTP\/1\..\s+(200)(\s+|$)/) {
return undef;
}
my %header;
while(1) {
$line = &read_http_connection($_[0]);
$line = &read_http_connection($h);
$line =~ tr/\r\n//d;
$line =~ /^(\S+):\s+(.*)$/ || last;
$header{lc($1)} = $2;