webserver.php
changeset 40 bd3372a2afc1
parent 38 87fe0dec1536
child 43 2634d550a97b
equal deleted inserted replaced
39:38dbcda3cf20 40:bd3372a2afc1
    91    * HTTP response code set by the handler function
    91    * HTTP response code set by the handler function
    92    * @var int
    92    * @var int
    93    */
    93    */
    94   
    94   
    95   var $response_code = 0;
    95   var $response_code = 0;
    96   
    96     
    97   /**
    97   /**
    98    * Content type set by the current handler function
    98    * Content type set by the current handler function
    99    * @var string
    99    * @var string
   100    */
   100    */
   101   
   101   
  1008         if ( $output == '__break__' )
  1008         if ( $output == '__break__' )
  1009         {
  1009         {
  1010           return true;
  1010           return true;
  1011         }
  1011         }
  1012         
  1012         
  1013         // $this->header('Transfer-encoding: chunked');
  1013         if ( !$this->headers_sent )
  1014         $this->header("Content-length: " . strlen($output));
  1014         {
  1015         $headers = implode("\r\n", $this->response_headers);
  1015           // $this->header('Transfer-encoding: chunked');
  1016         
  1016           $this->header("Content-length: " . strlen($output));
  1017         // write headers
  1017           $headers = implode("\r\n", $this->response_headers);
  1018         $this->send_client_headers($socket, $this->response_code, $this->content_type, $headers);
  1018           
  1019         
  1019           // write headers
  1020         // chunk output
  1020           $this->send_client_headers($socket, $this->response_code, $this->content_type, $headers);
  1021         // $output = dechex(strlen($output)) . "\r\n$output";
  1021           
  1022         
  1022           // chunk output
  1023         // write body
  1023           // $output = dechex(strlen($output)) . "\r\n$output";
  1024         $socket->write($output);
  1024           
  1025         
  1025           // write body
  1026         $this->headers_sent = false;
  1026           $socket->write($output);
       
  1027           
       
  1028           $this->headers_sent = false;
       
  1029         }
  1027         
  1030         
  1028         break;
  1031         break;
  1029       case 'sysuuid':
  1032       case 'sysuuid':
  1030         // requested one of the system's icon images
  1033         // requested one of the system's icon images
  1031         $uri_parts = explode('/', $_SERVER['REQUEST_URI']);
  1034         $uri_parts = explode('/', $_SERVER['REQUEST_URI']);