[gdal-dev] using vsicurl to read metadata of a resource over https with credentials

Paolo Corti pcorti at gmail.com
Thu Jan 5 14:19:28 PST 2023


Hi all

I am trying to read metadata from a file over https on a public web
site which requires authentication using gdalinfo and vsicurl - I
don't want to download the file as it is really large.
Without authentication gdalinfo works correctly. However I need to use
authentication, but so far I didn't manage to do that.

This is what I have tried to do so far:

When I am using the browser as an authenticated user, I can download
the file. Looking at the curl call generated by my browser dev
toolbar, I see that the key is the header named "Cookie" containing my
token.

Looking at the doc [1], it looks like GDAL_HTTP_HEADER_FILE
configuration option (or GDAL_HTTP_HEADERS for 3.6) is the way to go.
For that purpose I created a text file containing my header "Cookie"
and its value in the format Cookie:value. Then I have exported
GDAL_HTTP_HEADER_FILE to the file path.

However gdalinfo is still not working and I am wondering If I am doing
something wrong or if there is any other option to include in the
command.

The error I am getting is:

gdalinfo /vsicurl/https://[a-public-site-requiring-credentials]/[my-file-h5]

ERROR 1: Range downloading not supported by this server!
gdalinfo failed - unable to open '/vsicurl/https://l....h5'


Many thanks
Paolo


[1] https://gdal.org/user/virtual_file_systems.html

-- 
Paolo Corti
Geospatial software developer
web: http://www.paolocorti.net
twitter: @capooti
skype: capooti
#drt3jc1


More information about the gdal-dev mailing list