webserver.php
changeset 40 bd3372a2afc1
parent 38 87fe0dec1536
child 43 2634d550a97b
--- a/webserver.php	Mon Sep 01 13:05:52 2008 -0400
+++ b/webserver.php	Mon Sep 01 13:06:50 2008 -0400
@@ -93,7 +93,7 @@
    */
   
   var $response_code = 0;
-  
+    
   /**
    * Content type set by the current handler function
    * @var string
@@ -1010,20 +1010,23 @@
           return true;
         }
         
-        // $this->header('Transfer-encoding: chunked');
-        $this->header("Content-length: " . strlen($output));
-        $headers = implode("\r\n", $this->response_headers);
-        
-        // write headers
-        $this->send_client_headers($socket, $this->response_code, $this->content_type, $headers);
-        
-        // chunk output
-        // $output = dechex(strlen($output)) . "\r\n$output";
-        
-        // write body
-        $socket->write($output);
-        
-        $this->headers_sent = false;
+        if ( !$this->headers_sent )
+        {
+          // $this->header('Transfer-encoding: chunked');
+          $this->header("Content-length: " . strlen($output));
+          $headers = implode("\r\n", $this->response_headers);
+          
+          // write headers
+          $this->send_client_headers($socket, $this->response_code, $this->content_type, $headers);
+          
+          // chunk output
+          // $output = dechex(strlen($output)) . "\r\n$output";
+          
+          // write body
+          $socket->write($output);
+          
+          $this->headers_sent = false;
+        }
         
         break;
       case 'sysuuid':