jazzband / django-downloadview

Serve files with Django.
https://django-downloadview.readthedocs.io
Other
380 stars 58 forks source link

HTTPFile proxies undecoded request.raw, should be decoded #97

Closed benoitbryon closed 9 years ago

benoitbryon commented 9 years ago

As mentionned in requests documentation:

You can further control the workflow by use of the Response.iter_content and Response.iter_lines methods. Alternatively, you can read the undecoded body from the underlying urllib3 urllib3.HTTPResponse at Response.raw.

Then see https://github.com/benoitbryon/django-downloadview/blob/1.6/django_downloadview/files.py#L242 => HTTPFile proxies request.raw i.e. undecoded urllib3 file. Should a "decoded" one.

Natim commented 9 years ago

I am not sure why you want it to be decoded? If you decode it it will not be a stream anymore and everything will be store in memory? Isn't it?

benoitbryon commented 9 years ago

I do think we want it to be decoded. And yes we need it to be a stream/iterator/generator. I think I found a way to make it right, using StringIteratorIO. And it looks like to unlock #88... PR coming soon...