]> sjero.net Git - wget/blobdiff - tests/HTTPServer.pm
[svn] Add synchronization between client and server processes and testing of recursiv...
[wget] / tests / HTTPServer.pm
index 6747359ec648cde68f435f1946194a4bb0b434af..8950a22de2309d7cb37cfff7dd0863c9005e2873 100755 (executable)
@@ -16,9 +16,16 @@ my $CRLF = "\015\012"; # "\r\n" is not portable
 my $log = undef;
 
 sub run {
-    my ($self, $urls) = @_;
+    my ($self, $urls, $synch_callback) = @_;
+    my $initialized = 0;
+
+    while (1) {
+        if (!$initialized) {
+            $synch_callback->();
+            $initialized = 1;
+        }        
                                 
-    while (my $con = $self->accept) {
+        my $con = $self->accept();
         print STDERR "Accepted a new connection\n" if $log;
         while (my $req = $con->get_request) {
             my $url_path = $req->url->path;
@@ -77,7 +84,6 @@ sub run {
         }
         print STDERR "Closing connection\n" if $log;
         $con->close;
-        undef($con);
     }
 }