Skip to content

asl97/simpleHttpServer

 
 

Repository files navigation

Simple multi-threaded file-based HTTP server

Functionality:
  • multi-threaded using thread pool
  • support for index.html and index.htm, if there isn't one, it generate one on the fly like the SimpleHttpServer
  • support for GET requests only
  • support for static content only
  • support for mime types
  • support for 200, 206 and 404 HTTP response status codes
  • support for single range HTTP GET requests (RFC 2616)
Install:
  1. clone repository from github

    $ git clone https://github.com/ercchy/simpleHttpServer.git simpleHttpServer
    
  2. create virtual enviroment

    $ virtualenv simpleserver
    $ source simpleserver/bin/activate
    
  3. install requirements for server

    $ pip install -r requirements.txt
    
  4. run tests to check if eveything is OK

    $ nosetests .
    

Run:

  1. run server

    $ python run.py
    
  2. open latest Chrome browser

  3. everything works?

  4. copy larger mp4 video file to static_files folder

    • rename file to test_5.mp4
    • open url: http://localhost:5555/test_5.mp4
    • video should start streaming beautifully
    • move video timeline to different position
    • see how nicely simple HTTP server handles range requests

Possibilities:

  • Command line parameters for run.py
  • Add dynamic url routes and views
  • Templating
  • And so much more ...

Changelog:

  • Improve usability by added support for index.html
  • Clone this git repository

About

simpleHttpServer

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%