t3rm1n4l/go-mega

Error: Unexpected EOF when reading chunked response body

Opened this issue · 0 comments

sogko commented

Hi,

I've been trying to use the library to download files off a MEGA account and when I was trying with smaller files it worked great. But when I started to download larger files (>100mb) it started to return unexpected EOF errors for at least one of the chunks (random chunks on every run).

This behaviour exhibit itself even when I tried different number of download workers (1, default 3, 5 etc)

I couldn't pinpoint exactly why but probably the server closed its connection abruptly, causing the response body to return an error when reading it (could be malformed? but somehow still returning 200 OK status. weird)

The error comes from line 711, ioutil.ReadAll

I've written a workaround that simply retries when ioutil failed to read the body and it fixes the issue. Will create a PR soon.