def do_POST(self): try: remote_token = self.headers["Bitbake-token"] except: remote_token = None if 0 and remote_token != self.server.connection_token and remote_token != "observer": self.report_503() else: if remote_token == "observer": self.server.readonly = True else: self.server.readonly = False SimpleXMLRPCRequestHandler.do_POST(self)
def do_POST(self): """Add authentication to the XMLRPC handlers.""" log.debug('do_POST: path %s', self.path) log.debug(' content-length: %s', int(self.headers.getheader('content-length', 0))) #print ' headers: %s' % self.headers if self.headers.getheader('Authorization') is None: log.debug('do_POST: No auth received') self.do_AUTHHEAD() self.wfile.write('No auth received') elif authorizor.valid_auth(self.headers.getheader('Authorization')): SimpleXMLRPCRequestHandler.do_POST(self) else: log.info('do_POST: invalid auth') self.do_AUTHHEAD() self.wfile.write('Not authenticated: ') self.wfile.write(self.headers.getheader('Authorization'))
def do_POST(self): self._userrole = self.checklogindata() if self._userrole > 0: urlPath = getUrlPath(self.path) if urlPath in HttpsHandler.rpc_paths: return SimpleXMLRPCRequestHandler.do_POST(self) elif urlPath[:8] == '/getsong': SongSender.handlegetsong(self, 'POST') elif urlPath[:6] == '/songs': self.__handleweb('POST', self._userrole) elif urlPath[:4] == "/m3u": SongSender.handle_get_playlist(self, 'POST') elif urlPath[:8] == "/public/": SongSender.handlePublicFolderView(self, urlPath[8:]) else: SongSender.handleerror(self)
def do_POST(self): try: SimpleXMLRPCRequestHandler.do_POST(self) except Exception as e: print("do_post exception:", e)
def do_POST(self): ip_address, ip_port = self.client_address if ip_address!='127.0.0.1': self.report_404() return SimpleXMLRPCRequestHandler.do_POST(self)
def do_POST(self, command='POST'): (scheme, netloc, path, params, query, frag) = urlparse(self.path) qs = parse_qs(query) self.getHostInfo() self.command = command if not self.performAuthChecks(scheme, netloc, path, qs): return posted = None self.post_data = tempfile.TemporaryFile() self.old_rfile = self.rfile try: # First, buffer the POST data to a file... clength = cleft = int(self.headers.get('content-length')) while cleft > 0: rbytes = min(64*1024, cleft) self.post_data.write(self.rfile.read(rbytes)) cleft -= rbytes # Juggle things so the buffering is invisble. self.post_data.seek(0) self.rfile = self.post_data ctype, pdict = cgi.parse_header(self.headers.get('content-type')) if ctype.lower() == 'multipart/form-data': self.post_data.seek(0) posted = cgi.FieldStorage( fp=self.post_data, headers=self.headers, environ={'REQUEST_METHOD': command, 'CONTENT_TYPE': ctype}) elif ctype.lower() == 'application/x-www-form-urlencoded': if clength >= 50*1024*1024: raise Exception(("Refusing to parse giant posted query " "string (%s bytes).") % clength) posted = cgi.parse_qs(self.rfile.read(clength), 1) elif self.host_config.get('xmlrpc', False): # We wrap the XMLRPC request handler in _BEGIN/_END in order to # expose the request environment to the RPC functions. RCI = self.server.RCI return RCI._END(SimpleXMLRPCRequestHandler.do_POST(RCI._BEGIN(self))) self.post_data.seek(0) except socket.error: pass except Exception as e: logging.Log([('err', 'POST error at %s: %s' % (path, e))]) self.sendResponse('<h1>Internal Error</h1>\n', code=500, msg='Error') self.rfile = self.old_rfile self.post_data = None return if not self.performPostAuthChecks(scheme, netloc, path, qs, posted): return try: return self.handleHttpRequest(scheme, netloc, path, params, query, frag, qs, posted) except socket.error: pass except Exception as e: logging.Log([('err', 'Error handling POST at %s: %s' % (path, e))]) self.sendResponse('<h1>Internal Error</h1>\n', code=500, msg='Error') self.rfile = self.old_rfile self.post_data = None