Exemplo n.º 1
0
 function execute(Mpass_Request $client)
 {
     $input = "";
     $input = $client->read(1024);
     sleep(10);
     $str = "Hello World! " . microtime(true) . "<pre>{$input}</pre>";
     $response = "HTTP/1.1 200 OK\r\n" . "Connection: close\r\n" . "Content-Type: text/html\r\n" . "Content-Length:" . strlen($str) . "\r\n" . "\r\n" . $str;
     $client->write($response);
     return TRUE;
 }
Exemplo n.º 2
0
 function execute(Mpass_Request $client)
 {
     try {
         $header = '';
         $header = $client->read(1024);
         $request = new RequestModel($header);
         $handle = HandleFactory::getResponseHandle($request->isStatic());
         $response = $handle->handle($header);
         $client->write($response);
         Mpass_Log::record($header, __METHOD__);
         return true;
     } catch (Exception $e) {
         $EResponse = 'HTTP/1.0 ' . $e->getCode() . ' ' . $e->getMessage() . chr(13) . chr(10);
         $EResponse .= 'Date:' . date("D, d M Y G:i:s \\G\\M\\T") . chr(13) . chr(10) . chr(13) . chr(10);
         $client->write($EResponse);
         Mpass_Log::record($EResponse, __METHOD__);
         return true;
     }
 }