Skip to content

Commit 188cea5

Browse files
committed
HTTP driver: Avoid warning with 'ogr2ogr out http://example.com/in.gpkg'
1 parent b601d22 commit 188cea5

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

frmts/http/httpdriver.cpp

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,21 @@ static GDALDataset *HTTPOpen(GDALOpenInfo *poOpenInfo)
130130

131131
CPLHTTPDestroyResult(psResult);
132132

133+
CPLStringList aosOpenOptions;
134+
for (const char *pszStr :
135+
cpl::Iterate(const_cast<CSLConstList>(poOpenInfo->papszOpenOptions)))
136+
{
137+
if (STARTS_WITH_CI(pszStr, "NATIVE_DATA="))
138+
{
139+
// Avoid warning with "ogr2ogr out http://example.com/in.gpkg"
140+
aosOpenOptions.push_back(std::string("@").append(pszStr).c_str());
141+
}
142+
else
143+
{
144+
aosOpenOptions.push_back(pszStr);
145+
}
146+
}
147+
133148
/* -------------------------------------------------------------------- */
134149
/* Try opening this result as a gdaldataset. */
135150
/* -------------------------------------------------------------------- */
@@ -141,10 +156,9 @@ static GDALDataset *HTTPOpen(GDALOpenInfo *poOpenInfo)
141156
CPLErrorStateBackuper oBackuper(CPLQuietErrorHandler);
142157
auto oAccumulator = oErrorAccumulator.InstallForCurrentScope();
143158
CPL_IGNORE_RET_VAL(oAccumulator);
144-
poDS = GDALDataset::Open(osResultFilename,
145-
poOpenInfo->nOpenFlags & ~GDAL_OF_SHARED,
146-
poOpenInfo->papszAllowedDrivers,
147-
poOpenInfo->papszOpenOptions, nullptr);
159+
poDS = GDALDataset::Open(
160+
osResultFilename, poOpenInfo->nOpenFlags & ~GDAL_OF_SHARED,
161+
poOpenInfo->papszAllowedDrivers, aosOpenOptions.List(), nullptr);
148162
}
149163

150164
// Re-emit silenced errors if open was successful
@@ -189,7 +203,7 @@ static GDALDataset *HTTPOpen(GDALOpenInfo *poOpenInfo)
189203
poDS = GDALDataset::Open(osTempFilename,
190204
poOpenInfo->nOpenFlags & ~GDAL_OF_SHARED,
191205
poOpenInfo->papszAllowedDrivers,
192-
poOpenInfo->papszOpenOptions, nullptr);
206+
aosOpenOptions.List(), nullptr);
193207
if (VSIUnlink(osTempFilename) != 0 && poDS != nullptr)
194208
poDS->MarkSuppressOnClose(); /* VSIUnlink() may not work on
195209
windows */

0 commit comments

Comments
 (0)