PWebS HTTP Server

[ home | news | project page | documentation | download | author ]

home

What is pwebs

PWebS is an HTTP server written in Python. It's in an early stage of development, and is not indicated for any use other than testing. However the basic features are working.

The server was only tested on Linux. By the way, being written in such a multi-platform language like Python there are good chance that it will work on other platforms too. The only point that is sure that it doesn't work on Windows is the CGI execution. The actual implementation uses the fork() and exec() sequence to start the program; these functions are unknown unde Windows..

Currently implemented features

  • The server is based on a multi-thread architecture, for every connection a new thread is spawned (instead of a new process with fork())
    When reached max_clients the connections will be queued and served later.
  • Support for HTTP GET and POST methods.
  • CGI/1.1 support. It is possible to run CGI programs using both GET or POST
  • methods to pass data to the scripts.
  • PHP support through the CGI interface. Most Php scripts are working, the only limitations, at the moment, is the lacks of Sessions support.
  • The configuration of the server is all done in the config file. From here it's possible to set many parameters of the server.
  • The "MIME <==> extension" association is done using an external file (mime.types)
  • Directory listing: if a directory doesn't contain a suitable index document, an address like http://host.com/dir1/ will return the HTML formatted list of the files in that directory
  • Caching system. All the pages (statics or dinamically generated) are cached (this aspect is configurable) in memory to improve the speed of the server and reduce the overall load. When the cache is full (reached cache_max_size) some pages will be trashed out of the cache, using a LRU (Least Recently Used) algoritm, implemented with a separated stack.
  • When the file on disc is modified, the copy in cache is refreshed
  • Log System. Requests and server errors are all logged in two separeted files (access_log and error_log). The logs are like the default Apache logs. When the log files are bigger than 1 Mb, they are moved to a new "gzipped" file.
  • Server Side Includes. At the moment Pwebs implement only a little subset of SSI features. This site make use of SSI and it has been developed with Pwebs.
  • setuid(): A different user can be specified in the config file (usually nobody) and the server will drop root privilegies.

Todo

  • Keep-Alive connections
  • Improve SSI parser
  • Find bottle-necks
  • Add support for Apache modules (this is a little bit tricky..)
  • React better under heavy load. When the server receive too many contemporary connections, there are too many opened file descriptors and the OS is not too much happy. (Tested with ab, the Apache Benchmark software)

If you are interested in this project, please let me know: any help is welcome.


$Id: index.shtml,v 1.6 2003/04/02 19:44:11 matteomerli Exp $ SourceForge Logo