I've got a simple server. It works if I do a normal socket, but if I try to use a unix socket, I don't think it's working.
Here is the server:
from tornado.httpserver import HTTPServer
import tornado.ioloop
from tornado.netutil import bind_unix_socket
import tornado.web
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
server = HTTPServer(application)
unix_socket = bind_unix_socket('/tmp/foo.sock')
server.add_socket(unix_socket)
tornado.ioloop.IOLoop.instance().start()
Here is how I'm testing:
~ socat - UNIX-CONNECT:/tmp/foo.sock
GET / HTTP/1.1
HOST: foobar.com
*hit enter a few times to complete http call*
The server doesn't give any response.
Any idea what I'm doing wrong?