]> sjero.net Git - wget/commitdiff
Don't use hardcoded ports.
authorMicah Cowan <micah@cowan.name>
Thu, 12 Jun 2008 09:18:35 +0000 (02:18 -0700)
committerMicah Cowan <micah@cowan.name>
Thu, 12 Jun 2008 09:18:35 +0000 (02:18 -0700)
44 files changed:
tests/ChangeLog
tests/FTPServer.pm
tests/FTPTest.pm
tests/HTTPServer.pm
tests/HTTPTest.pm
tests/Test--no-content-disposition-trivial.px
tests/Test--no-content-disposition.px
tests/Test--spider-fail.px
tests/Test--spider-r--no-content-disposition-trivial.px
tests/Test--spider-r--no-content-disposition.px
tests/Test--spider-r-HTTP-Content-Disposition.px
tests/Test--spider-r.px
tests/Test--spider.px
tests/Test-E-k-K.px
tests/Test-E-k.px
tests/Test-HTTP-Content-Disposition-1.px
tests/Test-HTTP-Content-Disposition-2.px
tests/Test-HTTP-Content-Disposition.px
tests/Test-N--no-content-disposition-trivial.px
tests/Test-N--no-content-disposition.px
tests/Test-N-HTTP-Content-Disposition.px
tests/Test-N-current.px
tests/Test-N-no-info.px
tests/Test-N-old.px
tests/Test-N-smaller.px
tests/Test-N.px
tests/Test-O--no-content-disposition-trivial.px
tests/Test-O--no-content-disposition.px
tests/Test-O-HTTP-Content-Disposition.px
tests/Test-O-nonexisting.px
tests/Test-O.px
tests/Test-Restrict-Lowercase.px
tests/Test-Restrict-Uppercase.px
tests/Test-auth-basic.px
tests/Test-c-full.px
tests/Test-c-partial.px
tests/Test-c.px
tests/Test-ftp.px
tests/Test-nonexisting-quiet.px
tests/Test-noop.px
tests/Test-np.px
tests/Test-proxied-https-auth.px
tests/Test-proxy-auth-basic.px
tests/WgetTest.pm.in

index 3ce03f9891ee60f75b74959f7f86ba8caddaf5e6..9067fdfb5c8c98048ddd5e57eb8b9de4dd7bdfb4 100644 (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.
 
index d8ad8b0c919a049f80d9e530237c095c99259153..8c7cada7cd728368631eb3f951a73e62c6938c32 100644 (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
index 0e9e0715508948517473a96d0d90eadf44281045..eed2eb89e930df48128d1e36781a7dbe0249b20a 100644 (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;
index a307b737310cb644abb489d1132d06211d02e38f..dbfa3ef1ce8cea7d87c2c1d140d5634b018a60b9 100644 (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
index cd4fb2e2e777b8318009f840d2c3fcc4e82bf44b..0fdcb8f0e4e3b622239be7328f3b3466a0056469 100644 (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;
index 1d64125a2d5359e31ff80b5a6d2f685afb80d9d5..6a5b1def49ae32fd7ce3f3ef8e75fa8ed8c553cf 100755 (executable)
@@ -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;
 
index d5433f0009c3680b3a37b52fa1ee74a1ee716c17..4975913b63229e6ef398aa960a8897f56b6d9299 100755 (executable)
@@ -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;
 
index c5a299d1ad09583a18f02cdb4246f022009c6e28..b30ef755f44894758459da415043304338c90231 100755 (executable)
@@ -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;
 
index 0e290c28b2d2cd2d18409af59f3e266033310d47..1e850d4086bd53db9f8e3faa868094b3db5b4f0d 100755 (executable)
@@ -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;
 
index 0e3c00ed06f0890acb84c5cc21720fb07cfe7415..4eba8579d2f1faae66eeddc0aaf0c553238b06d6 100755 (executable)
@@ -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;
 
index e70f6b409282015203aabe6bb812c962b898302b..09f93fa3d3f1f76464bb9e54c2465cb437f2aaf5 100755 (executable)
@@ -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;
 
index 7b8d460f107d1ee59784f7973e43241841102b59..a315d97491df450ab551bb9bdd333a2608cfb130 100755 (executable)
@@ -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;
 
index f412c762afcd759d61af80fa9185ac98f0330667..dbc97135aa352bb78f27993c53f08b107203e625 100755 (executable)
@@ -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;
 
index 71d51ea15808505b808f521baf5689adaa5cec82..d71c39e5da0a782507348ed2feb5fd310ae44407 100755 (executable)
@@ -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;
 
index 3bf441df6d070fbd8c61d82526c52a241879f2c8..4581ed71c65af49456b00c80215d8d7bee24d8f4 100755 (executable)
@@ -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;
 
index ffc9eb25af43643c7fc75beeb5e39c906d449c84..01fb09017d6ce8b08d4a506b34241d29563a417d 100755 (executable)
@@ -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;
 
index 03eb2beeebae2269a0870d616a3de866b5bf962b..46c16a179155bbd65eb6964222bf4b6a5694aab6 100755 (executable)
@@ -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;
 
index 0f4b285b6190ec4a3779226d9250bfd36a3e81d5..3b6eb2c9aaf98e4d3e286e6ef2669aba967076e9 100755 (executable)
@@ -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;
 
index 390d369b0c3539f85ab93cb21929a70a5fbf200c..c58f451aa8036b0e99f7c0a725ca531b3b5d9f62 100755 (executable)
@@ -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;
 
index dbec7c67572619da92ab51a71df7beba932251ef..78fe522ff12c664f29c82b2d1b89607123257c5b 100755 (executable)
@@ -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;
 
index 42aa39ad8c6f0ac2691b0de0ab9b3288c2df7c52..32f877105fbbcfdb15f51b0038a01c27a5d89285 100755 (executable)
@@ -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;
 
index 16086ae8a8e62bde6a046bec5dccef05c4bd765a..b8e05a9475b407020b4666e2d93873a9a7c12e4f 100755 (executable)
@@ -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;
 
index bd83f644dbd3218a961892fa24bceda9b39095ef..301a9101f077364d46af0bea835261eacd2c1915 100755 (executable)
@@ -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;
 
index ee9a84e09e12630f60c1028f5b0cfc6241e19bfe..6ae116e51028d5577818e3e2d2f24915c29cbe30 100755 (executable)
@@ -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;
 
index 9ad44c29c14f4f26951666d9bee3106af7263fb8..71e34d96136980298092d841e5660a8772faaf50 100755 (executable)
@@ -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;
 
index 610698751ced01378cb12eddce0a8c391dd6e31c..2e235e08a9d9c5dff55429b8a87392bd964a2fa2 100755 (executable)
@@ -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;
 
index be25960c8416758e33d797cbc6fb2c4f4b3bf1aa..501fd44d407d045ed9f46bab2fa86344ac641765 100755 (executable)
@@ -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;
 
index 47cab0717586c58d7dc19a9b40ab33576899bba6..592f0fec2303c72ae1c778a8a8d49502b3c7c381 100755 (executable)
@@ -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;
 
index b0a5aa4096abe79786e46a2d523313d932722402..934f54aa968f3f81e2fbb6fca4a77b704cc1979b 100755 (executable)
@@ -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;
 
index 347dc38e068617fdf4701d8aac0f98d2750a92aa..89744fc883b350e7984a39218bb0125039cde15d 100755 (executable)
@@ -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;
 
index e584d060f5899881ef5df6c1e48e2d3e2549f87f..1f4e8efe65fae32ab829ab52dbcb9c129ef0200f 100755 (executable)
@@ -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;
 
index fab08d438277e40e6c2aad0eb608568d788c8504..2b35f1e40037c805f8d1de1a5e46e104b912cf13 100755 (executable)
@@ -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;
 
index cefa172232bcecd4eb06a589f736c57edcd583cf..14fa81f4373296429e0cbc051abd2eaeb60877c2 100755 (executable)
@@ -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;
 
index 527d4200e8f40a12a6261047a02a7c4afa72830c..750136090ac23a03d00fa6a325c27f645b9ca761 100755 (executable)
@@ -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;
 
index bb9304b927115460d031549541ddb7bc816b57d5..f277a023897f4818c6e8468a5cb52a401e7f32d7 100755 (executable)
@@ -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;
 
index ddf1d4be19b96db31da0b6f318a797110b3d553b..022342423e81f3ebe68bd43efefa28f8d2309b06 100755 (executable)
@@ -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;
 
index 58b45f722f7e6d56d905992a3ebb42f96a344d4e..8c61eb06e46d37041156af27e82c197202e64b58 100755 (executable)
@@ -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;
 
index 5925e38b4f5fafac65e96e9e83add4d1629ca7ca..8cef5a55f8f9ca26c91a06dbdba787484cbe7a76 100755 (executable)
@@ -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;
 
index 45f24390450bff7b76f42b31d5934ef7fdd63995..2766b5c597e825a618ee210e54009bfaa3315563 100755 (executable)
@@ -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;
 
index e45c8af375377da0715691b7b944aa8b4b10ce52..14bd851c0a79a21e0ee76c7f0640305db4bee295 100755 (executable)
@@ -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;
 
index 8a14b32d19b0518367b8368b116f9b90203af89b..28d13eeced2d7d69f58b7362583197d8996c8756 100755 (executable)
@@ -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;
 
index b1de60b963f48295daaf3b9dc6abe3eea724d5f7..b732d553bab3f626a5d5e0e4260bfa88d21340e6 100755 (executable)
@@ -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";
 
index 5566e22f1421d4d26666cdc899d835aa47200e16..e440a3927900b9c2c7ca14f17f3fb457548b64ce 100755 (executable)
@@ -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;
 
index 915759dfcdd84f4011ab1cfb26d591e147639e7e..357babe1118b6dd350763dd8db985b26d0d3bfc2 100644 (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'})) {