Index: tools/FreeBSD7_x/g_list.pl
===================================================================
--- tools/FreeBSD7_x/g_list.pl	(revision 6711)
+++ tools/FreeBSD7_x/g_list.pl	(revision 6958)
@@ -12,4 +12,5 @@
 
 my $HTML=1;
+my @HTTP_BODY = ();
 
 #laden van tool file
@@ -19,5 +20,5 @@
 #programma gestopt kan worden
 sub printline {
-  print "$_[0] \n";
+  push(@HTTP_BODY,  "$_[0] \n");
 };
 
@@ -25,8 +26,8 @@
   foreach $file ( sort @filelist) {
     if( $HTML) {
-      print "$file<BR>\n";
+      printline("$file<BR>");
     }
     else {
-      print "$file\n";
+      printline($file);
     };
   };
@@ -53,8 +54,8 @@
   foreach $node (listnodes( )) {
     if( $HTML) {
-      print "$node<BR>\n";
+      printline("$node<BR>");
     }
     else {
-      print "$node\n";
+      printline("$node\n");
     };
   };
@@ -79,9 +80,7 @@
 if( $browser=~/curl|wget|fetch/i) {
   $HTML=0;
-  printline("Content-type: text/html\n\n");
 }
 else {
   $HTML=1;
-  printline("Content-type: text/html\n\n");
   printline("<HTML>");
   printline("<TITLE>Genesis $title</TITLE>");
@@ -131,9 +130,11 @@
 #plaats de sluit HTML tags
 if( $HTML) {
-  print <<EOF;
-</BODY>
-</HTML>
-EOF
-}
+  printline("</BODY></HTML>");
+}
+
+$output = join('',@HTTP_BODY);
+print "Content-Length: " . length($output) . " \n";
+print "Content-type: text/html\n\n";
+print $output;
 
 
@@ -161,5 +162,5 @@
     my $node = $dir;
     if( ! $HTML ) {
-      print "$node\n";
+      printline("$node");
     }
     else {
@@ -268,10 +269,10 @@
 
    if( $main) {
-     printf "<TR bgcolor=$color><TD ROWSPAN=%d VALIGN=TOP><B>$if</TD>\n",(1+$subs{$if})*3,$subs{$if};
+     printline("<TR bgcolor=$color><TD ROWSPAN=%d VALIGN=TOP><B>$if</TD>\n",(1+$subs{$if})*3,$subs{$if});
      $c=4;
    }
    else {
      $c=3;
-     print "<TR bgcolor=$color>";
+     printline("<TR bgcolor=$color>");
    };
    $cfg=~s/</&lt;/gi;
@@ -322,6 +323,8 @@
     printline("<PRE>$pr</PRE>");
   }
-  else {
-    print $pr;
-  };
-};
+
+  $output = join('',@HTTP_BODY);
+  print "Content-Length: " . length($output) . " \n";
+  print "Content-type: text/html\n\n";
+  print $output;
+};
