[Pkg-haskell-maintainers] Bug#757272: getContentM and putContentM do not support large files

Joey Hess joeyh at debian.org
Wed Aug 6 19:37:32 UTC 2014


Package: hdav
Version: 0.6.2-1+b5
Tags: patch
Severity: normal

The current getContentM and putContentM interfaces buffer the whole file
content in memory.

However, http-client provides interfaces that can be used to avoid this
problem.

For putContentM, the problem is that, while a lazy bytestring is
provided to RequestBodyLBS, http-client needs to know the length of its
request body. So it buffers the whole thing to calculate its length.
(http-client's documentation could be more clear about this..)

Fixing putContentM is as simple as exposing an interface that lets the
caller provide a RequestBody. Then they can provide eg, a RequestBodyStream
streaming in the content of a file in constant memory.

For getContentM, things are tricker, because davRequest calls httpLbs,
which buffers the whole response body. So, the Request generation needs
to be factored out, and then davRequest can be left as-is, while
providing a withContentM that uses Network.HTTP.Client.withResponse.
The caller can then stream the response (eg out to a file) in constant memory.

git patch attached.

-- 
see shy jo
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-add-support-for-large-files.patch
Type: text/x-diff
Size: 5191 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20140806/7a70ac8e/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-haskell-maintainers/attachments/20140806/7a70ac8e/attachment-0001.sig>


More information about the Pkg-haskell-maintainers mailing list