aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py
blob: a1a7750f4daa4033afe13d634740babd1e9b3651 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# -*- encoding: utf-8 -*-

import logging
import BaseHTTPServer

class ConciergeHandler(BaseHTTPServer.BaseHTTPRequestHandler):
    def do_HEAD(req):
        logging.info('[Concierge] %(command)s request: %(host)s:%(port)d --- %(path)s',
                     dict(command = self.command,
                          host = self.client_address[0],
                          port = self.client_address[1],
                          path = self.path))
        
        req.send_response(200)
        req.send_header('Content-type', 'text/html')
        req.send_headers()

        logging.info('[Concierge] %(command)s returned 200', dict(command = self.command))

if __name__ == '__main__':

    httpServer = BaseHTTPServer.HTTPServer(('', 8080), ConciergeHandler)
    logging.info('[ConciergeServer] starting')

    try:
        httpServer.serve_forever()
    except KeyboardInterrupt:
        logging.info('[ConciergeServer] terminating')

    httpServer.server_close()