cURL cURL > Mailing List > Monthly Index > Single Mail

curl-tracker Archives

[curl:bugs] #1444 Absence of facultative Content-Range crash my script

From: Daniel Stenberg <bagder_at_users.sf.net>
Date: Wed, 29 Oct 2014 22:27:59 +0000

- **status**: open --> closed-duplicate
- **assigned_to**: Daniel Stenberg
- **Comment**:

The same as #1443

---
** [bugs:#1444] Absence of facultative Content-Range crash my script**
**Status:** closed-duplicate
**Labels:** Content-range 
**Created:** Wed Oct 29, 2014 08:47 PM UTC by hugo
**Last Updated:** Wed Oct 29, 2014 08:47 PM UTC
**Owner:** Daniel Stenberg
The addition of Content-Range in HTTP 416 responses is optional per RFC 2616. But curl crash if it is not present.

----

    :::bash
    #306MB file
    curl -L -C - 'http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registe%e2%80%8c%e2%80%8bred/netcdf/readme_etopo1_netcdf.txt' -o ./data/countries.zip  
    #1.1kB file
    curl -L -C - 'http://www.ngdc.noaa.gov/mgg/global/relief/ETOPO1/data/ice_surface/grid_registe%e2%80%8c%e2%80%8bred/netcdf/readme_etopo1_netcdf.txt' -o ./data/texte.txt

The target server definitively accepts to resume unfinished download. However, when 
the download is already finished and the curl request is sent again, curl crash my script and drop back the error message :

“Curl : (33) HTTP server doesn't seem to support byte ranges. Cannot resume.”

It actually should rather notice the completeness and send a success message.

The bug occurs with the ngdc.noaa.gov website. 

With Wireshark I checked what is going on in the HTTP protocol. Basically, when curl makes the request to resume the completed file, the server sends back an HTTP 416 error ("Requested Range Not Satisfiable"). In the case of naturalearthdata.com, the CDN they use adds a Content-Range header specifying the exact length of the file. ngdc.noaa.gov does not add this header. Note that the addition of Content-Range in HTTP 416 responses is optional per RFC 2616.

curl uses Content-Range to determine if the download is complete. If the header is missing, curl assumes that the server doesn't support range downloads and spits out that error message.
---
Sent from sourceforge.net because curl-tracker@cool.haxx.se is subscribed to https://sourceforge.net/p/curl/bugs/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/curl/admin/bugs/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
Received on 2014-10-29

These mail archives are generated by hypermail.