def send_body(self, DATA, code=None, msg=None, desc=None, ctype='application/octet-stream', headers=None): if headers and 'Connection' in headers: pass elif self.request_version in ('HTTP/1.0', 'HTTP/0.9'): pass elif self.close_connection == 1: # close header already sent pass else: if headers is None: headers = {} if self.headers.get('Connection', False) == 'Keep-Alive': headers['Connection'] = 'keep-alive' DAVRequestHandler.send_body(self, DATA, code=code, msg=msg, desc=desc, ctype=ctype, headers=headers)
def copymove(self, CLASS): """ Our uri scheme removes the /webdav/ component from there, so we need to mangle the header, too. """ up = urlparse.urlparse(urllib.unquote(self.headers["Destination"])) if up.path.startswith(self.davpath): self.headers["Destination"] = up.path[len(self.davpath) :] else: raise DAV_Forbidden("Not allowed to copy/move outside webdav path") # TODO: locks DAVRequestHandler.copymove(self, CLASS)
def copymove(self, CLASS): """ Our uri scheme removes the /webdav/ component from there, so we need to mangle the header, too. """ up = urlparse.urlparse(urllib.unquote(self.headers['Destination'])) if up.path.startswith(self.davpath): self.headers['Destination'] = up.path[len(self.davpath):] else: raise DAV_Forbidden("Not allowed to copy/move outside webdav path") # TODO: locks DAVRequestHandler.copymove(self, CLASS)
def send_body(self, DATA, code=None, msg=None, desc=None, ctype="application/octet-stream", headers=None): if headers and "Connection" in headers: pass elif self.request_version in ("HTTP/1.0", "HTTP/0.9"): pass elif self.close_connection == 1: # close header already sent pass elif headers and self.headers.get("Connection", False) == "Keep-Alive": headers["Connection"] = "keep-alive" if headers is None: headers = {} DAVRequestHandler.send_body(self, DATA, code=code, msg=msg, desc=desc, ctype=ctype, headers=headers)
def send_body(self, DATA, code=None, msg=None, desc=None, ctype='application/octet-stream', headers=None): if headers and 'Connection' in headers: pass elif self.request_version in ('HTTP/1.0', 'HTTP/0.9'): pass elif self.close_connection == 1: # close header already sent pass elif headers and self.headers.get('Connection',False) == 'Keep-Alive': headers['Connection'] = 'keep-alive' if headers is None: headers = {} DAVRequestHandler.send_body(self, DATA, code=code, msg=msg, desc=desc, ctype=ctype, headers=headers)
def do_DELETE(self): try: DAVRequestHandler.do_DELETE(self) except DAV_Error, (ec, dd): return self.send_status(ec)
def send_header(self, key, value): if key == "Connection" and value == "close": self.close_connection = 1 DAVRequestHandler.send_header(self, key, value)
def send_header(self, key, value): if key == 'Connection' and value == 'close': self.close_connection = 1 DAVRequestHandler.send_header(self, key, value)