aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Modules
diff options
context:
space:
mode:
authorDr Scofield2009-01-26 21:34:59 +0000
committerDr Scofield2009-01-26 21:34:59 +0000
commit0aafeb5da32fc18f510e537202d4bc4ac6bc8f79 (patch)
treee9ab657cf220776f90abf53640b802aa5c0cd2d8 /OpenSim/Region/Environment/Modules
parent+ adding URI substitution for concierges broker URI (diff)
downloadopensim-SC_OLD-0aafeb5da32fc18f510e537202d4bc4ac6bc8f79.zip
opensim-SC_OLD-0aafeb5da32fc18f510e537202d4bc4ac6bc8f79.tar.gz
opensim-SC_OLD-0aafeb5da32fc18f510e537202d4bc4ac6bc8f79.tar.bz2
opensim-SC_OLD-0aafeb5da32fc18f510e537202d4bc4ac6bc8f79.tar.xz
adding XML parsing to make sure POST content is welformed
Diffstat (limited to 'OpenSim/Region/Environment/Modules')
-rwxr-xr-xOpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeServer.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeServer.py b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeServer.py
index f25ae9b..e5b1fd2 100755
--- a/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeServer.py
+++ b/OpenSim/Region/Environment/Modules/Avatar/Concierge/ConciergeServer.py
@@ -29,6 +29,9 @@
29 29
30import logging 30import logging
31import BaseHTTPServer 31import BaseHTTPServer
32import xml.etree.ElementTree as ET
33import xml.parsers.expat
34
32 35
33# enable debug level logging 36# enable debug level logging
34logging.basicConfig(level = logging.DEBUG, 37logging.basicConfig(level = logging.DEBUG,
@@ -58,6 +61,13 @@ class ConciergeHandler(BaseHTTPServer.BaseHTTPRequestHandler):
58 61
59 self.logResponse(200) 62 self.logResponse(200)
60 63
64 def dumpXml(xml):
65 logging.debug('[ConciergeHandler] %s', xml.tag)
66 for attr in xml.attrib:
67 logging.debug('[ConciergeHandler] %s [%s] %s', xml.tag, attr, xml.attrib[attr])
68 for kid in xml.getchildren:
69 dumpXml(kid)
70
61 def do_POST(self): 71 def do_POST(self):
62 self.logRequest() 72 self.logRequest()
63 hdrs = {} 73 hdrs = {}
@@ -69,6 +79,13 @@ class ConciergeHandler(BaseHTTPServer.BaseHTTPRequestHandler):
69 self.rfile.close() 79 self.rfile.close()
70 80
71 logging.debug('[ConciergeHandler] POST: content: %s', content) 81 logging.debug('[ConciergeHandler] POST: content: %s', content)
82 try:
83 postXml = ET.parse(content)
84 dumpXml(postXml)
85 except xml.parsers.expat.ExpatError, xmlError:
86 logging.error('[ConciergeHandler] POST illformed:%s', xmlError)
87 self.send_response(500)
88 return
72 89
73 self.send_response(200) 90 self.send_response(200)
74 self.send_header('Content-type', 'text/html') 91 self.send_header('Content-type', 'text/html')