Skip to content

Commit

Permalink
adding HTTP server
Browse files Browse the repository at this point in the history
  • Loading branch information
bikash committed Feb 17, 2016
1 parent 34784e0 commit 7ad370e
Show file tree
Hide file tree
Showing 5 changed files with 1,121 additions and 2 deletions.
21 changes: 21 additions & 0 deletions HTTPserver.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler


HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"

if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 5001
server_address = ('127.0.0.1', port)

HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)

sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
httpd.serve_forever()
21 changes: 21 additions & 0 deletions template/import sys
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import sys
import BaseHTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler


HandlerClass = SimpleHTTPRequestHandler
ServerClass = BaseHTTPServer.HTTPServer
Protocol = "HTTP/1.0"

if sys.argv[1:]:
port = int(sys.argv[1])
else:
port = 5001
server_address = ('127.0.0.1', port)

HandlerClass.protocol_version = Protocol
httpd = ServerClass(server_address, HandlerClass)

sa = httpd.socket.getsockname()
print "Serving HTTP on", sa[0], "port", sa[1], "..."
httpd.serve_forever()
Loading

0 comments on commit 7ad370e

Please sign in to comment.