def _send_resource(self, environ, start_response, is_head_method):
path = environ["<STR_LIT>"]<EOL>res = self._davProvider.get_resource_inst(path, environ)<EOL>if util.get_content_length(environ) != <NUM_LIT:0>:<EOL><INDENT>self._fail(<EOL>HTTP_MEDIATYPE_NOT_SUPPORTED,<EOL>"<STR_LIT>",<EOL>)<EOL><DEDENT>elif environ.setdefault("<STR_LIT>", "<STR_LIT:0>") != "<STR_LIT:0>":<EOL><INDENT>self._fail(HTTP_BAD_REQUEST, "<STR_LIT>")<EOL><DEDENT>elif res is None:<EOL><INDENT>self._fail(HTTP_NOT_FOUND)<EOL><DEDENT>elif res.is_collection:<EOL><INDENT>self._fail(<EOL>HTTP_FORBIDDEN,<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>)<EOL><DEDENT>self._evaluate_if_headers(res, environ)<EOL>filesize = res.get_content_length()<EOL>if filesize is None:<EOL><INDENT>filesize = -<NUM_LIT:1>  <EOL><DEDENT>last_modified = res.get_last_modified()<EOL>if last_modified is None:<EOL><INDENT>last_modified = -<NUM_LIT:1><EOL><DEDENT>entitytag = res.get_etag()<EOL>if entitytag is None:<EOL><INDENT>entitytag = "<STR_LIT>"<EOL><DEDENT>doignoreranges = (<EOL>not res.support_content_length()<EOL>or not res.support_ranges()<EOL>or filesize == <NUM_LIT:0><EOL>)<EOL>if (<EOL>"<STR_LIT>" in environ<EOL>and "<STR_LIT>" in environ<EOL>and not doignoreranges<EOL>):<EOL><INDENT>ifrange = environ["<STR_LIT>"]<EOL>secstime = util.parse_time_string(ifrange)<EOL>if secstime:<EOL><INDENT>if last_modified != secstime:<EOL><INDENT>doignoreranges = True<EOL><DEDENT><DEDENT>else:<EOL><INDENT>ifrange = ifrange.strip('<STR_LIT>')<EOL>if entitytag is None or ifrange != entitytag:<EOL><INDENT>doignoreranges = True<EOL><DEDENT><DEDENT><DEDENT>ispartialranges = False<EOL>if "<STR_LIT>" in environ and not doignoreranges:<EOL><INDENT>ispartialranges = True<EOL>list_ranges, _totallength = util.obtain_content_ranges(<EOL>environ["<STR_LIT>"], filesize<EOL>)<EOL>if len(list_ranges) == <NUM_LIT:0>:<EOL><INDENT>self._fail(HTTP_RANGE_NOT_SATISFIABLE)<EOL><DEDENT>(range_start, range_end, range_length) = list_ranges[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>(range_start, range_end, range_length) = (<NUM_LIT:0>, filesize - <NUM_LIT:1>, filesize)<EOL><DEDENT>mimetype = res.get_content_type()  <EOL>response_headers = []<EOL>if res.support_content_length():<EOL><INDENT>response_headers.append(("<STR_LIT>", str(range_length)))<EOL><DEDENT>if res.support_modified():<EOL><INDENT>response_headers.append(<EOL>("<STR_LIT>", util.get_rfc1123_time(last_modified))<EOL>)<EOL><DEDENT>response_headers.append(("<STR_LIT:Content-Type>", mimetype))<EOL>response_headers.append(("<STR_LIT>", util.get_rfc1123_time()))<EOL>if res.support_etag():<EOL><INDENT>response_headers.append(("<STR_LIT>", '<STR_LIT>'.format(entitytag)))<EOL><DEDENT>if "<STR_LIT>" in environ["<STR_LIT>"]:<EOL><INDENT>customHeaders = environ["<STR_LIT>"]["<STR_LIT>"]<EOL>for header, value in customHeaders:<EOL><INDENT>response_headers.append((header, value))<EOL><DEDENT><DEDENT>res.finalize_headers(environ, response_headers)<EOL>if ispartialranges:<EOL><INDENT>response_headers.append(<EOL>(<EOL>"<STR_LIT>",<EOL>"<STR_LIT>".format(range_start, range_end, filesize),<EOL>)<EOL>)<EOL>start_response("<STR_LIT>", response_headers)<EOL><DEDENT>else:<EOL><INDENT>start_response("<STR_LIT>", response_headers)<EOL><DEDENT>if is_head_method:<EOL><INDENT>yield b"<STR_LIT>"<EOL>return<EOL><DEDENT>fileobj = res.get_content()<EOL>if not doignoreranges:<EOL><INDENT>fileobj.seek(range_start)<EOL><DEDENT>contentlengthremaining = range_length<EOL>while <NUM_LIT:1>:<EOL><INDENT>if contentlengthremaining < <NUM_LIT:0> or contentlengthremaining > self.block_size:<EOL><INDENT>readbuffer = fileobj.read(self.block_size)<EOL><DEDENT>else:<EOL><INDENT>readbuffer = fileobj.read(contentlengthremaining)<EOL><DEDENT>assert compat.is_bytes(readbuffer)<EOL>yield readbuffer<EOL>contentlengthremaining -= len(readbuffer)<EOL>if len(readbuffer) == <NUM_LIT:0> or contentlengthremaining == <NUM_LIT:0>:<EOL><INDENT>break<EOL><DEDENT><DEDENT>fileobj.close()<EOL>return<EOL>
If-Range
    If the entity is unchanged, send me the part(s) that I am missing;
    otherwise, send me the entire new entity
    If-Range: "737060cd8c284d8af7ad3082f209582d"

@see: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.27