diff options
author | Dr Scofield | 2009-01-26 21:32:59 +0000 |
---|---|---|
committer | Dr Scofield | 2009-01-26 21:32:59 +0000 |
commit | 3b866df07800a412fc174fe43204bffbd1bb2933 (patch) | |
tree | 478b3124c8de16e285c7f1fe92b983da2db6c000 /OpenSim/Region/Environment | |
parent | + adding test server for debugging purposes (diff) | |
download | opensim-SC_OLD-3b866df07800a412fc174fe43204bffbd1bb2933.zip opensim-SC_OLD-3b866df07800a412fc174fe43204bffbd1bb2933.tar.gz opensim-SC_OLD-3b866df07800a412fc174fe43204bffbd1bb2933.tar.bz2 opensim-SC_OLD-3b866df07800a412fc174fe43204bffbd1bb2933.tar.xz |
+ completed python test server
Diffstat (limited to 'OpenSim/Region/Environment')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py | 47 |
1 files changed, 41 insertions, 6 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py b/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py index a1a7750..f7efff8 100644..100755 --- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py +++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/testserver/ConciergeServer.py | |||
@@ -4,19 +4,54 @@ | |||
4 | import logging | 4 | import logging |
5 | import BaseHTTPServer | 5 | import BaseHTTPServer |
6 | 6 | ||
7 | # enable debug level logging | ||
8 | logging.basicConfig(level = logging.DEBUG, | ||
9 | format='%(asctime)s %(levelname)s %(message)s') | ||
10 | |||
11 | # subclassed HTTPRequestHandler | ||
7 | class ConciergeHandler(BaseHTTPServer.BaseHTTPRequestHandler): | 12 | class ConciergeHandler(BaseHTTPServer.BaseHTTPRequestHandler): |
8 | def do_HEAD(req): | 13 | def logRequest(self): |
9 | logging.info('[Concierge] %(command)s request: %(host)s:%(port)d --- %(path)s', | 14 | logging.info('[ConciergeHandler] %(command)s request: %(host)s:%(port)d --- %(path)s', |
10 | dict(command = self.command, | 15 | dict(command = self.command, |
11 | host = self.client_address[0], | 16 | host = self.client_address[0], |
12 | port = self.client_address[1], | 17 | port = self.client_address[1], |
13 | path = self.path)) | 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() | ||
14 | 28 | ||
15 | req.send_response(200) | 29 | self.send_response(200) |
16 | req.send_header('Content-type', 'text/html') | 30 | self.send_header('Content-type', 'text/html') |
17 | req.send_headers() | 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) | ||
18 | 52 | ||
19 | logging.info('[Concierge] %(command)s returned 200', dict(command = self.command)) | 53 | def log_request(code, size): |
54 | pass | ||
20 | 55 | ||
21 | if __name__ == '__main__': | 56 | if __name__ == '__main__': |
22 | 57 | ||