1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Don't use hardcoded ports.

This commit is contained in:
Micah Cowan 2008-06-12 02:18:35 -07:00
parent 484ba18aa7
commit f0f56db5cb
44 changed files with 152 additions and 93 deletions

View File

@ -1,5 +1,30 @@
2008-06-12 Micah Cowan <micah@cowan.name>
* FTPServer.pm, FTPTest.pm, HTTPServer.pm, HTTPTest.pm,
Test--no-content-disposition-trivial.px,
Test--no-content-disposition.px, Test--spider-fail.px,
Test--spider-r--no-content-disposition-trivial.px,
Test--spider-r--no-content-disposition.px,
Test--spider-r-HTTP-Content-Disposition.px, Test--spider-r.px,
Test--spider.px, Test-E-k-K.px, Test-E-k.px,
Test-HTTP-Content-Disposition-1.px,
Test-HTTP-Content-Disposition-2.px,
Test-HTTP-Content-Disposition.px,
Test-N--no-content-disposition-trivial.px,
Test-N--no-content-disposition.px,
Test-N-HTTP-Content-Disposition.px, Test-N-current.px,
Test-N-no-info.px, Test-N-old.px, Test-N-smaller.px, Test-N.px,
Test-O--no-content-disposition-trivial.px,
Test-O--no-content-disposition.px,
Test-O-HTTP-Content-Disposition.px, Test-O-nonexisting.px,
Test-O.px, Test-Restrict-Lowercase.px,
Test-Restrict-Uppercase.px, Test-auth-basic.px, Test-c-full.px,
Test-c-partial.px, Test-c.px, Test-ftp.px,
Test-nonexisting-quiet.px, Test-noop.px, Test-np.px,
Test-proxied-https-auth.px, Test-proxy-auth-basic.px,
WgetTest.pm.in: Use whatever ports are available, rather than
hard-coded ones.
* Test-proxied-https-auth.px: Better cleanup, so next test can
open the port.

View File

@ -748,7 +748,7 @@ sub __wildcard_to_regex
{
my %_attr_data = ( # DEFAULT
_localAddr => 'localhost',
_localPort => 8021,
_localPort => undef,
_reuseAddr => 1,
_rootDir => Cwd::getcwd(),
);
@ -781,6 +781,16 @@ sub new {
$self->{$attrname} = $self->_default_for($attrname);
}
}
# create server socket
"0" =~ /(0)/; # Perl 5.7 / IO::Socket::INET bug workaround.
$self->{_server_sock}
= IO::Socket::INET->new (LocalHost => $self->{_localAddr},
LocalPort => $self->{_localPort},
Listen => 1,
Reuse => $self->{_reuseAddr},
Proto => 'tcp',
Type => SOCK_STREAM)
or die "bind: $!";
return $self;
}
@ -803,21 +813,13 @@ sub run
my $old_ils = $/;
$/ = "\r\n";
# create server socket
"0" =~ /(0)/; # Perl 5.7 / IO::Socket::INET bug workaround.
my $server_sock = IO::Socket::INET->new (LocalHost => $self->{_localAddr},
LocalPort => $self->{_localPort},
Listen => 1,
Reuse => $self->{_reuseAddr},
Proto => 'tcp',
Type => SOCK_STREAM) or die "bind: $!";
if (!$initialized) {
$synch_callback->();
$initialized = 1;
}
$SIG{CHLD} = sub { wait };
my $server_sock = $self->{_server_sock};
# the accept loop
while (my $client_addr = accept (my $socket, $server_sock))
@ -929,6 +931,11 @@ sub run
$/ = $old_ils;
}
sub sockport {
my $self = shift;
return $self->{_server_sock}->sockport;
}
1;
# vim: et ts=4 sw=4

View File

@ -44,18 +44,24 @@ sub _setup_server {
close (FILE);
}
$self->{_server} = FTPServer->new (LocalAddr => 'localhost',
ReuseAddr => 1,
rootDir => "$self->{_workdir}/$self->{_name}/input") or die "Cannot create server!!!";
}
sub _launch_server {
my $self = shift;
my $synch_func = shift;
$self->{_server}->run ($synch_func);
}
my $server = FTPServer->new (LocalAddr => 'localhost',
LocalPort => '8021',
ReuseAddr => 1,
rootDir => "$self->{_workdir}/$self->{_name}/input") or die "Cannot create server!!!";
$server->run ($synch_func);
sub _substitute_port {
my $self = shift;
my $ret = shift;
$ret =~ s/{{port}}/$self->{_server}->sockport/eg;
return $ret;
}
1;

View File

@ -120,6 +120,7 @@ sub send_response {
next;
}
# fill in content
$content = $self->_substitute_port($content);
$resp->content($content);
print STDERR "HTTP::Response with content: \n", $resp->as_string if $log;
}
@ -207,6 +208,13 @@ sub verify_auth_basic {
}
}
sub _substitute_port {
my $self = shift;
my $ret = shift;
$ret =~ s/{{port}}/$self->sockport/eg;
return $ret;
}
1;
# vim: et ts=4 sw=4

View File

@ -30,17 +30,26 @@ my $VERSION = 0.01;
}
sub _setup_server {}
sub _setup_server {
my $self = shift;
$self->{_server} = HTTPServer->new (LocalAddr => 'localhost',
ReuseAddr => 1)
or die "Cannot create server!!!";
}
sub _launch_server {
my $self = shift;
my $synch_func = shift;
my $server = HTTPServer->new (LocalAddr => 'localhost',
LocalPort => '8080',
ReuseAddr => 1) or die "Cannot create server!!!";
$server->run ($self->{_input}, $synch_func);
$self->{_server}->run ($self->{_input}, $synch_func);
}
sub _substitute_port {
my $self = shift;
my $ret = shift;
$ret =~ s/{{port}}/$self->{_server}->sockport/eg;
return $ret;
}
1;

View File

@ -32,7 +32,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:8080/dummy.html";
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:{{port}}/dummy.html";
my $expected_error_code = 0;

View File

@ -33,7 +33,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:8080/dummy.html";
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:{{port}}/dummy.html";
my $expected_error_code = 0;

View File

@ -32,7 +32,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:8080/nonexistent";
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:{{port}}/nonexistent";
my $expected_error_code = 256;

View File

@ -14,8 +14,8 @@ my $mainpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -28,8 +28,8 @@ my $secondpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -42,8 +42,8 @@ my $thirdpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/dummy.txt">text file</a>.
Also, another <a href="http://localhost:{{port}}/againnonexistent">broken link</a>.
</p>
</body>
</html>
@ -89,7 +89,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:8080/";
my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:{{port}}/";
my $expected_error_code = 0;

View File

@ -14,8 +14,8 @@ my $mainpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -28,8 +28,8 @@ my $secondpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -42,8 +42,8 @@ my $thirdpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/dummy.txt">text file</a>.
Also, another <a href="http://localhost:{{port}}/againnonexistent">broken link</a>.
</p>
</body>
</html>
@ -90,7 +90,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:8080/";
my $cmdline = $WgetTest::WGETPATH . " --spider -r --no-content-disposition http://localhost:{{port}}/";
my $expected_error_code = 0;

View File

@ -14,8 +14,8 @@ my $mainpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -28,8 +28,8 @@ my $secondpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -42,8 +42,8 @@ my $thirdpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/dummy.txt">text file</a>.
Also, another <a href="http://localhost:{{port}}/againnonexistent">broken link</a>.
</p>
</body>
</html>
@ -90,7 +90,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider -r http://localhost:8080/";
my $cmdline = $WgetTest::WGETPATH . " --spider -r http://localhost:{{port}}/";
my $expected_error_code = 0;

View File

@ -14,8 +14,8 @@ my $mainpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/secondpage.html">second page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/secondpage.html">second page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -28,8 +28,8 @@ my $secondpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:8080/nonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/thirdpage.html">third page</a>.
Also, a <a href="http://localhost:{{port}}/nonexistent">broken link</a>.
</p>
</body>
</html>
@ -42,8 +42,8 @@ my $thirdpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/dummy.txt">text file</a>.
Also, another <a href="http://localhost:8080/againnonexistent">broken link</a>.
Some text and a link to a <a href="http://localhost:{{port}}/dummy.txt">text file</a>.
Also, another <a href="http://localhost:{{port}}/againnonexistent">broken link</a>.
</p>
</body>
</html>
@ -89,7 +89,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider -r http://localhost:8080/";
my $cmdline = $WgetTest::WGETPATH . " --spider -r http://localhost:{{port}}/";
my $expected_error_code = 0;

View File

@ -32,7 +32,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:8080/index.html";
my $cmdline = $WgetTest::WGETPATH . " --spider http://localhost:{{port}}/index.html";
my $expected_error_code = 0;

View File

@ -13,7 +13,7 @@ my $mainpage = <<EOF;
<title>Main Page Title</title>
</head>
<body>
<a href="http://localhost:8080/subpage.php">Secondary Page</a>
<a href="http://localhost:{{port}}/subpage.php">Secondary Page</a>
</body>
</html>
EOF
@ -60,7 +60,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -d -r -nd -E -k -K http://localhost:8080/index.php";
my $cmdline = $WgetTest::WGETPATH . " -d -r -nd -E -k -K http://localhost:{{port}}/index.php";
my $expected_error_code = 0;

View File

@ -13,7 +13,7 @@ my $mainpage = <<EOF;
<title>Main Page Title</title>
</head>
<body>
<a href="http://localhost:8080/subpage.php">Secondary Page</a>
<a href="http://localhost:{{port}}/subpage.php">Secondary Page</a>
</body>
</html>
EOF
@ -60,7 +60,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -r -nd -E -k http://localhost:8080/index.php";
my $cmdline = $WgetTest::WGETPATH . " -r -nd -E -k http://localhost:{{port}}/index.php";
my $expected_error_code = 0;

View File

@ -37,7 +37,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -e contentdisposition=on http://localhost:8080/dummy.html";
my $cmdline = $WgetTest::WGETPATH . " -e contentdisposition=on http://localhost:{{port}}/dummy.html";
my $expected_error_code = 0;

View File

@ -37,7 +37,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:8080/dummy.html";
my $cmdline = $WgetTest::WGETPATH . " --no-content-disposition http://localhost:{{port}}/dummy.html";
my $expected_error_code = 0;

View File

@ -33,7 +33,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -e contentdisposition=on http://localhost:8080/dummy.html";
my $cmdline = $WgetTest::WGETPATH . " -e contentdisposition=on http://localhost:{{port}}/dummy.html";
my $expected_error_code = 0;

View File

@ -24,7 +24,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N --no-content-disposition http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -N --no-content-disposition http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -25,7 +25,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N --no-content-disposition http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -N --no-content-disposition http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -26,7 +26,7 @@ my %urls = (
);
my $cmdline = $WgetTest::WGETPATH . " -N --content-disposition "
. "http://localhost:8080/dummy.txt";
. "http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -33,7 +33,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -32,7 +32,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -31,7 +31,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -34,7 +34,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -24,7 +24,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -N http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -23,7 +23,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -O out --no-content-disposition http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -O out --no-content-disposition http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -24,7 +24,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -O out --no-content-disposition http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -O out --no-content-disposition http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -24,7 +24,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -O out http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -O out http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -23,7 +23,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --quiet -O out http://localhost:8080/nonexistent";
my $cmdline = $WgetTest::WGETPATH . " --quiet -O out http://localhost:{{port}}/nonexistent";
my $expected_error_code = 256;

View File

@ -23,7 +23,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -O out http://localhost:8080/dummy.txt";
my $cmdline = $WgetTest::WGETPATH . " -O out http://localhost:{{port}}/dummy.txt";
my $expected_error_code = 0;

View File

@ -32,7 +32,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --restrict-file-names=lowercase http://localhost:8080/SomePage.html";
my $cmdline = $WgetTest::WGETPATH . " --restrict-file-names=lowercase http://localhost:{{port}}/SomePage.html";
my $expected_error_code = 0;

View File

@ -32,7 +32,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --restrict-file-names=uppercase http://localhost:8080/SomePage.html";
my $cmdline = $WgetTest::WGETPATH . " --restrict-file-names=uppercase http://localhost:{{port}}/SomePage.html";
my $expected_error_code = 0;

View File

@ -25,7 +25,7 @@ my %urls = (
);
my $cmdline = $WgetTest::WGETPATH . " --user=fiddle-dee-dee --password=Dodgson"
. " http://localhost:8080/needs-auth.txt";
. " http://localhost:{{port}}/needs-auth.txt";
my $expected_error_code = 0;

View File

@ -27,7 +27,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -37,7 +37,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -27,7 +27,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:8080/somefile.txt";
my $cmdline = $WgetTest::WGETPATH . " -c http://localhost:{{port}}/somefile.txt";
my $expected_error_code = 0;

View File

@ -21,7 +21,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -S ftp://localhost:8021/afile.txt";
my $cmdline = $WgetTest::WGETPATH . " -S ftp://localhost:{{port}}/afile.txt";
my $expected_error_code = 0;

View File

@ -23,7 +23,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " --quiet http://localhost:8080/nonexistent";
my $cmdline = $WgetTest::WGETPATH . " --quiet http://localhost:{{port}}/nonexistent";
my $expected_error_code = 256;

View File

@ -33,7 +33,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " http://localhost:8080/";
my $cmdline = $WgetTest::WGETPATH . " http://localhost:{{port}}/";
my $expected_error_code = 0;

View File

@ -14,7 +14,7 @@ my $mainpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/firstlevel/secondpage.html">second page</a>.
Some text and a link to a <a href="http://localhost:{{port}}/firstlevel/secondpage.html">second page</a>.
</p>
</body>
</html>
@ -27,7 +27,7 @@ my $secondpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/firstlevel/lowerlevel/thirdpage.html">third page</a>.
Some text and a link to a <a href="http://localhost:{{port}}/firstlevel/lowerlevel/thirdpage.html">third page</a>.
</p>
</body>
</html>
@ -40,7 +40,7 @@ my $thirdpage = <<EOF;
</head>
<body>
<p>
Some text and a link to a <a href="http://localhost:8080/higherlevelpage.html">higher level page</a>.
Some text and a link to a <a href="http://localhost:{{port}}/higherlevelpage.html">higher level page</a>.
</p>
</body>
</html>
@ -69,7 +69,7 @@ my $higherlevelpage = <<EOF;
<p>
This page is on a higher level in the URL path hierarchy. Therefore, it
should not be downloaded. Wget should not visit the following link to a
<a href="http://localhost:8080/firstlevel/fourthpage.html">fourth page</a>.
<a href="http://localhost:{{port}}/firstlevel/fourthpage.html">fourth page</a>.
</p>
</body>
</html>
@ -119,7 +119,7 @@ my %urls = (
},
);
my $cmdline = $WgetTest::WGETPATH . " -np -nH -r http://localhost:8080/firstlevel/";
my $cmdline = $WgetTest::WGETPATH . " -np -nH -r http://localhost:{{port}}/firstlevel/";
my $expected_error_code = 0;

View File

@ -91,7 +91,7 @@ my $pid = &fork_server;
sleep 1;
my $cmdline = $WgetTest::WGETPATH . " --user=fiddle-dee-dee"
. " --password=Dodgson -e https_proxy=localhost:8080"
. " --password=Dodgson -e https_proxy=localhost:{{port}}"
. " --no-check-certificate"
. " https://no.such.domain/needs-auth.txt";

View File

@ -25,7 +25,7 @@ my %urls = (
);
my $cmdline = $WgetTest::WGETPATH . " --debug --user=fiddle-dee-dee --password=Dodgson"
. " -e http_proxy=localhost:8080 http://no.such.domain/needs-auth.txt";
. " -e http_proxy=localhost:{{port}} http://no.such.domain/needs-auth.txt";
my $expected_error_code = 0;

View File

@ -78,11 +78,13 @@ sub run {
# Call wget
chdir ("$self->{_workdir}/$self->{_name}/output");
# print "Calling $self->{_cmdline}\n";
my $cmdline = $self->{_cmdline};
$cmdline = $self->_substitute_port($cmdline);
print "Calling $cmdline\n";
my $errcode =
($self->{_cmdline} =~ m{^/.*})
? system ($self->{_cmdline})
: system ("$self->{_workdir}/../src/$self->{_cmdline}");
($cmdline =~ m{^/.*})
? system ($cmdline)
: system ("$self->{_workdir}/../src/$cmdline");
# Shutdown server
# if we didn't explicitely kill the server, we would have to call
@ -166,7 +168,9 @@ sub _verify_download {
or return "Test failed: file $filename not downloaded\n";
my $content = <FILE>;
$content eq $filedata->{'content'}
my $expected_content = $filedata->{'content'};
$expected_content = $self->_substitute_port($expected_content);
$content eq $expected_content
or return "Test failed: wrong content for file $filename\n";
if (exists($filedata->{'timestamp'})) {