saguiitay / DropboxRestAPI

Dropbox REST API client in C#
MIT License
46 stars 38 forks source link

HttpClient.SendAsync not utilising HttpCompletionOption.ResponseHeadersRead #22

Open dv00d00 opened 9 years ago

dv00d00 commented 9 years ago

When downloading large files this line of code in RequestJsonString method of DropboxClient class

var response = await this.httpClient.SendAsync(request);

create buffer equal to the content length of the file being uploaded. And consumer of this method will be forced to wait before all content is downloaded. Which in my case is really bad, because of stream decryption on the client.

So the proposed solution will be to add additional parameter to the SendAsync call like this:

var response = await this.httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead);

This will allow to start content processing immediately after headers parsing and will preserve RAM on the consumer side.