diff options
author | Dr Scofield | 2009-01-26 21:33:53 +0000 |
---|---|---|
committer | Dr Scofield | 2009-01-26 21:33:53 +0000 |
commit | db46c75d7277bc2b41336bb2cd36f49e21179f64 (patch) | |
tree | 35d05e3b523bb773ba3f8196ee02c118477a679f /OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py | |
parent | ~ turning synchronous broker update into asynchronous one (diff) | |
download | opensim-SC_OLD-db46c75d7277bc2b41336bb2cd36f49e21179f64.zip opensim-SC_OLD-db46c75d7277bc2b41336bb2cd36f49e21179f64.tar.gz opensim-SC_OLD-db46c75d7277bc2b41336bb2cd36f49e21179f64.tar.bz2 opensim-SC_OLD-db46c75d7277bc2b41336bb2cd36f49e21179f64.tar.xz |
~ moving test server script on level up
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py b/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py deleted file mode 100755 index f7efff8..0000000 --- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | #!/usr/bin/env python | ||
2 | # -*- encoding: utf-8 -*- | ||
3 | |||
4 | import logging | ||
5 | import BaseHTTPServer | ||
6 | |||
7 | # enable debug level logging | ||
8 | logging.basicConfig(level = logging.DEBUG, | ||
9 | format='%(asctime)s %(levelname)s %(message)s') | ||
10 | |||
11 | # subclassed HTTPRequestHandler | ||
12 | class ConciergeHandler(BaseHTTPServer.BaseHTTPRequestHandler): | ||
13 | def logRequest(self): | ||
14 | logging.info('[ConciergeHandler] %(command)s request: %(host)s:%(port)d --- %(path)s', | ||
15 | dict(command = self.command, | ||
16 | host = self.client_address[0], | ||
17 | port = self.client_address[1], | ||
18 | path = self.path)) | ||
19 | |||
20 | def logResponse(self, status): | ||
21 | logging.info('[ConciergeHandler] %(command)s returned %(status)d', | ||
22 | dict(command = self.command, | ||
23 | status = status)) | ||
24 | |||
25 | |||
26 | def do_HEAD(self): | ||
27 | self.logRequest() | ||
28 | |||
29 | self.send_response(200) | ||
30 | self.send_header('Content-type', 'text/html') | ||
31 | self.end_headers() | ||
32 | |||
33 | self.logResponse(200) | ||
34 | |||
35 | def do_POST(self): | ||
36 | self.logRequest() | ||
37 | hdrs = {} | ||
38 | for hdr in self.headers.headers: | ||
39 | logging.debug('[ConciergeHandler] POST: header: %s', hdr.rstrip()) | ||
40 | |||
41 | length = int(self.headers.getheader('Content-Length')) | ||
42 | content = self.rfile.read(length) | ||
43 | self.rfile.close() | ||
44 | |||
45 | logging.debug('[ConciergeHandler] POST: content: %s', content) | ||
46 | |||
47 | self.send_response(200) | ||
48 | self.send_header('Content-type', 'text/html') | ||
49 | self.end_headers() | ||
50 | |||
51 | self.logResponse(200) | ||
52 | |||
53 | def log_request(code, size): | ||
54 | pass | ||
55 | |||
56 | if __name__ == '__main__': | ||
57 | |||
58 | httpServer = BaseHTTPServer.HTTPServer(('', 8080), ConciergeHandler) | ||
59 | logging.info('[ConciergeServer] starting') | ||
60 | |||
61 | try: | ||
62 | httpServer.serve_forever() | ||
63 | except KeyboardInterrupt: | ||
64 | logging.info('[ConciergeServer] terminating') | ||
65 | |||
66 | httpServer.server_close() | ||