Affichage des articles dont le libellé est python httpd. Afficher tous les articles
Affichage des articles dont le libellé est python httpd. Afficher tous les articles

mardi 29 septembre 2009

httpd'n'breakfast

3 months ago, i was tchatting with a friend on "how to share quickly my directory".
Oh, i forget to say.. my friend is a python-lover :)

Result 1 :
python -c 'import SimpleHTTPServer;SimpleHTTPServer.test()'
so nice ! this httpd is ok and chrooted :) but not multihtread ...
My friend is magic :
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import SocketServer
import BaseHTTPServer
import sys, os
import CGIHTTPServer
port = 8000
class ThreadingCGIServer(SocketServer.ThreadingMixIn, BaseHTTPServer.HTTPServer):
    pass
server = ThreadingCGIServer(('', port), CGIHTTPServer.CGIHTTPRequestHandler)
print "Serveur demarre sur le port %s." % port
try:
    while 1:
        sys.stdout.flush()
        server.handle_request()
except KeyboardInterrupt:
    print "Fini !"


Ok, you can finding another source on then net, it's not a creation but keep this in your home :) 
Another good source :
http://www.crashdump.fr/reseaux/serveur-http-python-en-une-ligne-649/
http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python
http://mollacademy.gcu.info/doku.php?id=python:httpd