[PATCH 5 of 6] lfs: add support for serving blob files
Yuya Nishihara
yuya at tcha.org
Fri Mar 30 08:12:26 EDT 2018
On Thu, 29 Mar 2018 23:26:03 -0400, Matt Harbison wrote:
> >> elif method == b'GET':
> >> checkperm('pull')
> >>
> >> - return False
> >> + res.status = hgwebcommon.statusmessage(HTTP_OK)
> >> + res.headers[b'Content-Type'] = b'application/octet-stream'
> >> +
> >> + # TODO: figure out how to send back the file in chunks,
> >> instead of
> >> + # reading the whole thing.
> >> + res.setbodybytes(localstore.read(oid))
> >
> > setbodygen()?
>
> I saw that, but then it isn't clear to me how to close the file
> descriptor, both in the normal and exceptional cases.
WSGI spec says the returned "iterator" may have close().
https://www.python.org/dev/peps/pep-0333/
Perhaps we'll have to fix the request object and hgweb to handle that, and
add a file-like wrapper which can be used in place of filechunkiter().
More information about the Mercurial-devel
mailing list