Document ability to send arbitrary HTTP headers to WMTS etc. sites
https://gdal.org/drivers/raster/wmts.html features many HTTP headers one can send in a request. However one never knows when a site might need some other arbitrary header to get it to respond. E.g., "Cookie: ...."
Therefore please add the ability to add arbitrary HTTP headers to WMTS etc. sites.
I can read from https://gdal.org/user/virtual_file_systems.html
Starting with GDAL 2.3, additional HTTP headers can be sent by setting the GDAL_HTTP_HEADER_FILE configuration option to point to a filename of a text file with “key: value” HTTP headers.
This config option is not listed in https://trac.osgeo.org/gdal/wiki/ConfigOptions. I wonder if it affects only vsi* systems or would it work also with the drivers which are using curl. If it does not work then perhaps re-using GDAL_HTTP_HEADER_FILE could be the way to implement the support.
I wonder if it affects only vsi* systems or would it work also with the drivers which are using curl
Ah, good catch that can indeed work:
$ echo "foo: bar" > /tmp/header.txt
$ rm -rf gdalwmscache
$ CPL_CURL_VERBOSE=YES GDAL_HTTP_HEADER_FILE=/tmp/header.txt gdal_translate frmts/wms/frmt_wms_openstreetmap_tms.xml out.tif -outsize 256 256 --debug on
[...]
> GET /0/0/0.png HTTP/1.1
Host: tile.openstreetmap.org
User-Agent: GDAL WMS driver (http://www.gdal.org/frmt_wms.html)
Accept: */*
foo: bar
[...]
@jidanni is this now documented well enough?
Add an example of how to add a cookie to a request. Thanks.