def decode_request_content(self, data): data = SimpleXMLRPCRequestHandler.decode_request_content(self, data) from xml.dom.minidom import parseString doc = parseString(data) ps = doc.getElementsByTagName('params')[0] pdoc = parseString(''' <param><value> <string>%s</string> </value></param>''' % (self.client_address[0], )) p = pdoc.firstChild.cloneNode(True) ps.insertBefore(p, ps.firstChild) return doc.toxml()
def decode_request_content(self, data): data = SimpleXMLRPCRequestHandler.decode_request_content(self, data) doc = parseString(data) ps = doc.getElementsByTagName("params")[0] pdoc = parseString( """ <param><value> <string>%s</string> </value></param>""" % (self.client_ip,) ) p = pdoc.firstChild.cloneNode(True) ps.insertBefore(p, ps.firstChild) return doc.toxml()
def decode_request_content(self, data): ''' Overrides in order to capture Authorization header. ''' token = None if 'Authorization' in self.headers: value = self.headers.get("Authorization", "") token = value[8:] if value.startswith("Bearer: ") else "" if self.server.auth_handler.validate_token(token): return SimpleXMLRPCRequestHandler.decode_request_content(self, data) else: self.send_response(401, "Could not authenticate with OAuth") self.send_header("WWW-Authenticate", "realm=\"https://www.codalab.org\"") self.send_header("Content-length", "0") self.end_headers()
def decode_request_content(self, data): ''' Overrides in order to capture Authorization header. ''' token = None if 'Authorization' in self.headers: value = self.headers.get("Authorization", "") token = value[8:] if value.startswith("Bearer: ") else "" if self.server.auth_handler.validate_token(token): return SimpleXMLRPCRequestHandler.decode_request_content( self, data) else: self.send_response(401, "Could not authenticate with OAuth") self.send_header("WWW-Authenticate", "realm=\"https://www.codalab.org\"") self.send_header("Content-length", "0") self.end_headers()
def decode_request_content(self, data): encoding = self.headers.get("content-encoding", "identity").lower() if encoding != "gzip": self.send_response(501, "encoding %r not supported" % encoding) return SimpleXMLRPCRequestHandler.decode_request_content(self, data)