Skip to content

Commit

Permalink
server http
Browse files Browse the repository at this point in the history
  • Loading branch information
bikash committed Feb 17, 2016
1 parent f80d474 commit 1db916b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions HTTPserver1.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 = 5555
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()

0 comments on commit 1db916b

Please sign in to comment.