Advertisement
ajithkp560

Simple HTTP Server Python

Jun 5th, 2012
415
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. #Visit www.teamopenfire.com
  2. import SimpleHTTPServer
  3. import SocketServer
  4. print "\n\n\t|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
  5. print "\t|||||                                                       |||||"
  6. print "\t|||||                                                       |||||"
  7. print "\t|||||        Coded By Ajith KP:::Coded By Ajith KP          |||||"
  8. print "\t|||||                                                       |||||"
  9. print "\t||||| snakebite@achayans.com         snakebite@achayans.com |||||"
  10. print "\t|||||              www.suckthetech.blogspot.com             |||||"
  11. print "\t|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
  12.  
  13. port=80
  14. def do_GET(srvr):
  15.     try:
  16.         files=open(curdir+sep+srvr.path)
  17.         srvr.send_response(200)
  18.         srvr.wfile.write(filehandle())
  19.         files.close
  20.         return
  21.     except(IOError):
  22.         srvr.send_error(404, "Not Found",srvr.path)
  23. try:
  24.     srvr=SimpleHTTPServer.SimpleHTTPRequestHandler
  25.     srvr=SocketServer.TCPServer(("",port),srvr)
  26.     print "Server Started at localhost:80"
  27.     srvr.serve_forever()
  28. except(KeyboardInterrupt):
  29.     print "Sever Shutdowning"
  30. except(SystemExit):
  31.     print "Force Exit"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement