X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=Server.py;h=37dee6da05b7ce10aeafbaeb5fdd2108f512aba1;hb=5d1186b318a037732efa0c59c9921388bafd086f;hp=8314281cda9737b8699d91008bacaefcc7c60935;hpb=24d16d18acab3da7bccc3e09df4927e9cf2d3246;p=plcapi.git diff --git a/Server.py b/Server.py index 8314281..37dee6d 100755 --- a/Server.py +++ b/Server.py @@ -6,6 +6,7 @@ # Copyright (C) 2006 The Trustees of Princeton University # # $Id$ +# $URL$ # import os @@ -14,6 +15,9 @@ import getopt import traceback import BaseHTTPServer +# Append PLC to the system path +sys.path.append(os.path.dirname(os.path.realpath(sys.argv[0]))) + from PLC.API import PLCAPI class PLCAPIRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): @@ -31,9 +35,12 @@ class PLCAPIRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): # Write response self.send_response(200) + self.send_header("Content-type", "text/xml") + self.send_header("Content-length", str(len(response))) + self.end_headers() self.wfile.write(response) - self.wfile.flush() + self.wfile.flush() self.connection.shutdown(1) except Exception, e: @@ -67,7 +74,7 @@ class PLCAPIServer(BaseHTTPServer.HTTPServer): # Defaults addr = "0.0.0.0" port = 8000 -config = "/etc/planetlab/plc_config.xml" +config = "/etc/planetlab/plc_config" def usage(): print "Usage: %s [OPTION]..." % sys.argv[0]