[RfC] HTTP_Server
| From: | Stephan Schmidt | Date: | Mon, 21 Jul 2003 19:54:18 +0000 |
| Subject: | [RfC] HTTP_Server | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-18508@lists.php.net to get a copy of this message | ||
Hi,
I developed a small class, based on Net_Server that allows you to run
your own webserver, fully written in PHP CLI. So there's no need for
Apache or any other webserver. The server analyses a request, calls the
appropriate method. The developer has to implement these methods to
build the response for the request.
You can do whatever you like to build the response, you just have to
return a response code, some optional headers and the body.
Then the server will return a valid HTTP Response to the client.
You can take a look at a quick hack at:
http://www.php-tools.de/PEAR/HTTP/Server.phps
It's already working, but there's some work to do, before I could
release it (implement error handling, transform reponse codes, use a
resource as response body for larger responses).
If you want to test it, use this script:
<?PHP
require_once 'HTTP/Server.php';
$server = new HTTP_Server('localhost', 80);
$server->setDebugMode('text');
$server->start();
?>
Run it in CLI mode and open "http://localhost/" with
your browser. You
should see some text that has been returned by the server.
Just imagine a server that pulls content from shared memory or databases
instead of a file system.
I'd like to release this class as HTTP_Server, hope you agree.
Stephan