Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,26 @@
}
}

// Method of downloading files that is wget friendly
// This method serves requests for /download/filename.ext from THIS mirror
if (preg_match("|^download/(.+?)$|", $URI, $match)) {
$filename = $match[1];

include $_SERVER['DOCUMENT_ROOT'] . "/include/do-download.inc";
$filename = get_actual_download_file($filename);

if ($filename) {
// Found the file, so we do a redirect to the file directly
status_header(200);
download_file($MYSITE, $filename);
} else {
// File missing on the server
status_header(404);
include $_SERVER['DOCUMENT_ROOT'] . "/include/get-download.inc";
}

exit;
}

// ============================================================================
// Nice URLs for download files, so wget works completely well with download links
Expand Down
8 changes: 5 additions & 3 deletions include/site.inc
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,11 @@ function print_mirror_box($countryname, $countrycode, $mirrors, $file = null, $d
<?php
$url = $mirror["url"];
$urltitle = substr($url, strpos($url, '//') + 2, -1);
if ($file) {
$what = $direct_download ? "this" : "a";
$url = $mirror["url"] . "get/$file/from/$what/mirror";

if ($file && $direct_download) {
$url = $mirror["url"] . "download/$file";
} elseif ($file && !$direct_download) {
$url = $mirror["url"] . "get/$file/from/a/mirror";
}
?>
<div class="entry">
Expand Down