Skip to content

Instantly share code, notes, and snippets.

@serv
Forked from lolpack/no-resp-server.py
Created December 3, 2015 20:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serv/50b841a02d305f1a6e14 to your computer and use it in GitHub Desktop.
Save serv/50b841a02d305f1a6e14 to your computer and use it in GitHub Desktop.
Null Response Server
#!/usr/bin/python
from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer
PORT_NUMBER = 8080
#This class will handles any incoming request from
#the browser
class myHandler(BaseHTTPRequestHandler):
#Handler for the GET requests
def do_GET(self):
# optionally set headers
# self.send_response(400)
# self.send_header('Content-type','text/html')
# self.end_headers()
# Send the null response
self.wfile.write(b'')
return
try:
#Create a web server and define the handler to manage the
#incoming request
server = HTTPServer(('', PORT_NUMBER), myHandler)
print 'Started httpserver on port ' , PORT_NUMBER
#Wait forever for incoming htto requests
server.serve_forever()
except KeyboardInterrupt:
print '^C received, shutting down the web server'
server.socket.close()
@serv
Copy link
Author

serv commented Dec 3, 2015

$ python no-resp-server.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment