[gdal-dev] Help user when /vsicurl/ reads GetFileSize=0

Even Rouault even.rouault at spatialys.com
Tue Jun 25 02:56:30 PDT 2019


On mardi 25 juin 2019 07:02:06 CEST Rahkonen Jukka (MML) wrote:
> Hi,
> 
> Have a look at
> https://gis.stackexchange.com/questions/326773/importing-shapefile-from-web
> site-if-download-link-is-compressed-file/326778
> 
> I tried what happens with command
> 
> ogrinfo
> /vsizip/vsicurl/https://www2.census.gov/geo/tiger/GENZ2010/gz_2010_36_620_l
> 2_500k.zip --debug on
> 
> HTTP: libcurl/7.37.1 OpenSSL/1.0.1h zlib/1.2.3
> VSICURL:
> GetFileSize(https://www2.census.gov/geo/tiger/GENZ2010/gz_2010_36_620_l2_50
> 0k.zip)=0  response_code=200 VSICURL: Request at offset 0, after end of file
> VSICURL: Request at offset 0, after end of file
> VSICURL: Request at offset 0, after end of file
> ... repeats about 130 times
> FAILURE:
> Unable to open datasource
> `/vsizip/vsicurl/https://www2.census.gov/geo/tiger/GENZ2010/gz_2010_36_620_
> l2_500k.zip' with the following drivers.
> 
> Does this mean that www2.census.gov supports HEAD request but it does not
> send the file size header,

That was the case here. If you add "--config CPL_CURL_VERBOSE YES", you get 
the headers returned.
I've just pushed a fix for that by retrying with a (interrupted) GET request 
when the HEAD does not return the Content-Length header.

Even


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list