]> sjero.net Git - wget/blobdiff - tests/HTTPServer.pm
[svn] Added testing for -np option.
[wget] / tests / HTTPServer.pm
index 88224f4f9be1c5b456ba7f2d6478462dc146b3a3..2d56160a16f708558de817fc3084a9f119bbd5c0 100755 (executable)
@@ -29,9 +29,12 @@ sub run {
         print STDERR "Accepted a new connection\n" if $log;
         while (my $req = $con->get_request) {
             my $url_path = $req->url->path;
-            if ($url_path =~ m{/$}) {
+            if ($url_path =~ m{/$}) { # append 'index.html'
                 $url_path .= 'index.html';
             }
+            if ($url_path =~ m{^/}) { # remove trailing '/'
+                $url_path = substr ($url_path, 1);
+            }
             if ($log) {
                 print STDERR "Method: ", $req->method, "\n";
                 print STDERR "Path: ", $url_path, "\n";