Code Repositories xandikos / eb6d532
When there is no body specified, default to allprop. Jelmer Vernooń≥ 2 years ago
1 changed file(s) with 16 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
901901
902902 def _readBody(self, environ):
903903 try:
904 request_body_size = int(environ['CONTENT_LENGTH'])
904 request_body_size = int(environ['HTTP_CONTENT_LENGTH'])
905905 except KeyError:
906906 return environ['wsgi.input'].read()
907907 else:
950950 return Status(request_uri(environ), '404 Not Found')
951951 # Default depth is infinity, per RFC2518
952952 depth = environ.get("HTTP_DEPTH", "infinity")
953 et = self._readXmlBody(environ)
954 if et.tag != '{DAV:}propfind':
955 # TODO-ERROR(jelmer): What to return here?
956 return Status(
957 request_uri(environ), '500 Internal Error',
958 'Expected propfind tag, got ' + et.tag)
959 try:
960 [requested] = et
961 except IndexError:
962 return Status(request_uri(environ), '400 Bad Request',
963 'Received more than one element in propfind.')
953 if 'HTTP_CONTENT_TYPE' not in environ and environ.get('HTTP_CONTENT_LENGTH') == '0':
954 et = ET.Element('{DAV:}propfind')
955 ET.SubElement(et, '{DAV:}allprop')
956 else:
957 et = self._readXmlBody(environ)
958 if et.tag != '{DAV:}propfind':
959 # TODO-ERROR(jelmer): What to return here?
960 return Status(
961 request_uri(environ), '500 Internal Error',
962 'Expected propfind tag, got ' + et.tag)
963 try:
964 [requested] = et
965 except IndexError:
966 return Status(request_uri(environ), '400 Bad Request',
967 'Received more than one element in propfind.')
964968 if requested.tag == '{DAV:}prop':
965969 ret = []
966970 for href, resource in traverse_resource(