Subject: Impossible to download a specific (small) file
From: Guillaume MULLER
Date: Fri, 4 Dec 2020 12:29:36 +0100
Hi,

When I try to download a (very small: 12Kb) file with megatools, I get error :"WARNING: chunk download failed (CURL error: Failure when receiving data from the peer), re-trying after 4 seconds"

I think the problem comes from the small size of the file, because:
- I face the error with "megadl + link" and "megaget + path" with this specific file
- I have no error with other files with megaget or megadl
- I can get the file on the mega.nz website using either the link or surfing my account.


$ megadl --debug http 'https://mega.nz/#!ECwEw....Xr8Ft......lu2Sdilc'
*   Trying 66.203.125.11:443...
* TCP_NODELAY set
* Connected to g.api.mega.co.nz (66.203.125.11) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: /etc/ssl/certs
* SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256
* ALPN, server did not agree to a protocol
* Server certificate:
*  subject: C=NZ; postalCode=1010; ST=Auckland; L=Auckland; street=15, Pwc Tower, 188 Quay Street,; O=Mega Limited; OU=PremiumSSL Wildcard; CN=*.api.mega.co.nz
*  start date: Dec 11 00:00:00 2017 GMT
*  expire date: Dec 10 23:59:59 2020 GMT
*  subjectAltName: host "g.api.mega.co.nz" matched cert's "*.api.mega.co.nz"
*  issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Organization Validation Secure Server CA
*  SSL certificate verify ok.
> POST /cs?id=1607080952 HTTP/1.1
Host: g.api.mega.co.nz
Accept: */*
Accept-Encoding: deflate, gzip, br
User-Agent: Megatools (1.10.2)
Content-Type: application/json
Content-Length: 43

* upload completely sent off: 43 out of 43 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Type: application/json
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Content-Type, MEGA-Chrome-Antileak
< Access-Control-Expose-Headers: Original-Content-Length
< Access-Control-Max-Age: 86400
< Original-Content-Length: 302
< Content-Length: 302
< Connection: keep-alive
< 
* Connection #0 to host g.api.mega.co.nz left intact
*   Trying 89.44.168.91:80...3 KiB
* TCP_NODELAY set
* Connected to gfs270n375.userstorage.mega.co.nz (89.44.168.91) port 80 (#0)
> POST /dl/BzYKpp-0XJbVpwKNSFgKztJMDZ...ohpxeKwCruFQf8IUidCq9-PK5N1RPyt176KPNvBJr3Vs1o-KvAYF1BikGlpZsib0qpjE_EBkA/10992-12298 HTTP/1.1
Host: gfs270n375.userstorage.mega.co.nz
Accept: */*
Accept-Encoding: deflate, gzip, br
User-Agent: Megatools (1.10.2)
Content-Length: 0
Content-Type: application/x-www-form-urlencoded

* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 1307
< Content-Type: application/octet-stream
< Content-Disposition: attachment
< Cache-Control: private
< Content-Transfer-Encoding: binary
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: MEGA-Chrome-Antileak
< Access-Control-Max-Age: 86400
< 
* Recv failure: Connection reset by peer
* Closing connection 0
WARNING: chunk download failed (CURL error: Failure when receiving data from the peer), re-trying after 2 seconds
* Hostname gfs270n375.userstorage.mega.co.nz was found in DNS cache
*   Trying 89.44.168.91:80...
* TCP_NODELAY set
* Connected to gfs270n375.userstorage.mega.co.nz (89.44.168.91) port 80 (#1)
> POST /dl/BzYKpp-0XJbVpwKNSFgKztJM.....CohpxeKwCruFQf8IUidCq9-PK5N1RPyt176KPNvBJr3Vs1o-KvAYF1BikGlpZsib0qpjE_EBkA/10992-12298 HTTP/1.1
Host: gfs270n375.userstorage.mega.co.nz
Accept: */*
Accept-Encoding: deflate, gzip, br
User-Agent: Megatools (1.10.2)
Content-Length: 0
Content-Type: application/x-www-form-urlencoded

* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Content-Length: 1307
< Content-Type: application/octet-stream
< Content-Disposition: attachment
< Cache-Control: private
< Content-Transfer-Encoding: binary
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: MEGA-Chrome-Antileak
< Access-Control-Max-Age: 86400
< 
* Recv failure: Connection reset by peer
* Closing connection 1
WARNING: chunk download failed (CURL error: Failure when receiving data from the peer), re-trying after 4 seconds