gdal
gdal copied to clipboard
SFTP support in VSI Curl
Hello,
I tried to use sftp://
protocol with /vsicurl/
since it is supported by libcurl
.
It didn't work!
After further investigation, I found that only https://
, http://
and ftp://
were allowed in GDAL.
Is there a reason or is it possible to change this behavior?
I did some changes in cpl_vsil_curl.cpp
but a simple gdalinfo
still fail.
Any idea on this? Why most of curl-supported protocols are filtered by GDAL?
Thank you in advance. I'm ready to work on a PR.
Apparently, according to https://curl.se/libcurl/c/CURLOPT_RANGE.html, sftp:// should support range requests, so that's a good precondition. Why it doesn't work? I don't know. Would require debugging... Well possible that there are some HTTP assumptions somewhere. FTP support is no longer tested, so not impossible it is broken.
A good candidate is where CURLINFO_HTTP_CODE is tested in cpl_vsil_curl.cpp (CURLINFO_HTTP_CODE is actually an alias to https://curl.se/libcurl/c/CURLINFO_RESPONSE_CODE.html), since apparently this only works for HTTP and FTP
Why most of curl-supported protocols are filtered by GDAL?
the famous motto: "what is not tested is (most certainly) broken"
is there still interest in keeping this opened?
I'm not sure if there will new FTP-sites coming. But at least some are still available: https://www.skogsstyrelsen.se/sjalvservice/karttjanster/geodatatjanster/ftp/
Yes, page is in Swedish, but I guess you can find address, username and password from the site.
Hi,
We ended up in creating a HTTP proxy to these protocols, with a simple token-based authentication and supporting range requests. Then we build /vsicurl/https path to read information from the datasets.
This work-around allows us to extract metadata from thousands of JPEG2000/GeoTIFF stored in FTP/SFTP in couple of minutes.