Skip to content
Snippets Groups Projects
Commit 2974d935 authored by Benjamin Drung's avatar Benjamin Drung
Browse files

Add support for HTTPS with basic HTTP authentication

Thanks: Pali <pali.rohar@gmail.com>
LP: #1015131
parent 28fd5e32
No related branches found
No related tags found
No related merge requests found
Description: Add support for HTTPS with basic HTTP authentication
Author: Pali <pali.rohar@gmail.com>
Bug-Ubuntu: https://launchpad.net/bugs/1015131
--- a/apt-mirror
+++ b/apt-mirror
@@ -68,6 +68,15 @@
HTTP and FTP Auth or non-standard port:
deb http://user:pass@example.com:8080/debian stable main contrib non-free
+HTTPS with sending Basic HTTP authentication information (plaintext username and password) for all requests:
+(this was default behaviour of Wget 1.10.2 and prior and is needed for some servers with new version of Wget)
+set auth_no_challenge 1
+deb https://user:pass@example.com:443/debian stable main contrib non-free
+
+HTTPS without checking certificate:
+set no_check_certificate 1
+deb https://example.com:443/debian stable main contrib non-free
+
Source Mirroring:
deb-src http://example.com/debian stable main contrib non-free
@@ -103,6 +112,8 @@
"_tilde" => 0,
"limit_rate" => '100m',
"run_postmirror" => 1,
+ "auth_no_challenge" => 0,
+ "no_check_certificate" => 0,
"postmirror_script" => '$var_path/postmirror.sh'
);
@@ -198,11 +209,15 @@
my $i = 0;
my $pid;
my $nthreads = get_variable("nthreads");
+ my @args = ();
local $| = 1;
@urls = @_;
$nthreads = @urls if @urls < $nthreads;
+ if(get_variable("auth_no_challenge") == 1) { push(@args, "--auth-no-challenge"); }
+ if(get_variable("no_check_certificate") == 1) { push(@args, "--no-check-certificate"); }
+
print "Downloading " . scalar(@urls) . " $stage files using $nthreads threads...\n";
while(scalar @urls) {
@@ -216,7 +231,7 @@
die("apt-mirror: can't do fork in download_urls") if $pid < 0;
if($pid == 0) {
- exec 'wget', '--no-cache', '--limit-rate='.get_variable("limit_rate"), '-t', '5', '-r', '-N', '-l', 'inf', '-o', get_variable("var_path") . "/$stage-log.$i", '-i', get_variable("var_path") . "/$stage-urls.$i";
+ exec 'wget', '--no-cache', '--limit-rate='.get_variable("limit_rate"), '-t', '5', '-r', '-N', '-l', 'inf', '-o', get_variable("var_path") . "/$stage-log.$i", '-i', get_variable("var_path") . "/$stage-urls.$i", @args;
# shouldn't reach this unless exec fails
die("\n\nCould not run wget, please make sure its installed and in your path\n\n");
}
......@@ -3,3 +3,4 @@ additional_archs.patch
create_dirs.patch
lock.patch
architecture-match.patch
apt-mirror-https.patch
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment