webserver.php
changeset 64 ee64bb096f56
parent 63 af239423ed15
child 67 c4aefad02ce4
equal deleted inserted replaced
63:af239423ed15 64:ee64bb096f56
   263           $targetuser = $targetuser['uid'];
   263           $targetuser = $targetuser['uid'];
   264         }
   264         }
   265         if ( is_string($targetgroup) )
   265         if ( is_string($targetgroup) )
   266         {
   266         {
   267           $targetgroup = posix_getgrnam($targetgroup);
   267           $targetgroup = posix_getgrnam($targetgroup);
   268           $targetgroup = $targetgroup['uid'];
   268           $targetgroup = $targetgroup['gid'];
   269         }
   269         }
   270         // make sure all info is valid
   270         // make sure all info is valid
   271         if ( !is_int($targetuser) || !is_int($targetgroup) )
   271         if ( !is_int($targetuser) || !is_int($targetgroup) )
   272         {
   272         {
   273           burnout('Invalid user or group specified');
   273           burnout('Invalid user or group specified');
   621       // set client header SERVER variables
   621       // set client header SERVER variables
   622       foreach ( $_SERVER as $key => $_ )
   622       foreach ( $_SERVER as $key => $_ )
   623       {
   623       {
   624         if ( preg_match('/^HTTP_/', $key) )
   624         if ( preg_match('/^HTTP_/', $key) )
   625           unset($_SERVER[$key]);
   625           unset($_SERVER[$key]);
       
   626       }
       
   627       if ( !isset($_SERVER['SERVER_SOFTWARE']) )
       
   628       {
       
   629         $_SERVER['SERVER_SOFTWARE'] =& $this->server_string;
   626       }
   630       }
   627       unset($client_headers[0]);
   631       unset($client_headers[0]);
   628       foreach ( $client_headers as $line )
   632       foreach ( $client_headers as $line )
   629       {
   633       {
   630         if ( !preg_match('/^([A-z0-9-]+): (.+)$/is', $line, $match) )
   634         if ( !preg_match('/^([A-z0-9-]+): (.+)$/is', $line, $match) )
  2124     $port = substr($peer, strrpos($peer, ':') + 1);
  2128     $port = substr($peer, strrpos($peer, ':') + 1);
  2125   }
  2129   }
  2126   
  2130   
  2127   function write($data)
  2131   function write($data)
  2128   {
  2132   {
  2129     return @fwrite($this->sock, $data);
  2133     $data = str_split($data, 8096);
       
  2134     foreach ( $data as $chunk )
       
  2135     {
       
  2136       while ( !@fwrite($this->sock, $chunk) )
       
  2137       {
       
  2138         usleep(50000);
       
  2139       }
       
  2140     }
       
  2141     return true;
  2130   }
  2142   }
  2131   
  2143   
  2132   function is_eof()
  2144   function is_eof()
  2133   {
  2145   {
  2134     return feof($this->sock);
  2146     return feof($this->sock);