better error checking

This commit is contained in:
Jamie Cameron
2013-07-05 23:45:20 -07:00
parent fec93dd5f1
commit 7467f93fd9
3 changed files with 4 additions and 2 deletions

View File

@@ -35,6 +35,7 @@ if ($in{'new'} && !-d $config{'minecraft_dir'}) {
# Download to temp file
my $temp = &transname();
$progress_callback_url = &get_server_jar_url();
$progress_callback_url || &error($text{'download_eurl'});
my ($host, $port, $page, $ssl) = &parse_http_url($progress_callback_url);
&http_download($host, $port, $page, $temp, undef, \&progress_callback, $ssl);

View File

@@ -263,6 +263,7 @@ download_emkdir=Directory creation failed!
download_err=Failed to setup Minecraft server
download_edir=Missing or non-absolute install directory
download_euser=User to run as does not exist
download_eurl=Failed to get server download URL
backup_title=Scheduled Backup
backup_header=Options for scheduled world backup

View File

@@ -11,7 +11,7 @@ our ($module_root_directory, %text, %gconfig, $root_directory, %config,
$module_name, $remote_user, $base_remote_user, $gpgpath,
$module_config_directory, @lang_order_list, @root_directories);
our $history_file = "$module_config_directory/history.txt";
our $download_page_url = "https://minecraft.net/download";
our $download_page_url = "http://minecraft.net/download";
our $playtime_dir = "$module_config_directory/playtime";
&foreign_require("webmin");
@@ -584,7 +584,7 @@ my ($host, $port, $page, $ssl) = &parse_http_url($download_page_url);
return undef if (!$host);
my ($out, $err);
&http_download($host, $port, $page, \$out, \$err, undef, $ssl);
return undef if (!$err);
return undef if ($err);
$out =~ /"((http|https):[^"]+minecraft_server[^"]+\.jar)"/ || return undef;
return $1;
}