From c84a5f2e5595ea971ba349f8e3dfd53d19a8e919 Mon Sep 17 00:00:00 2001 From: Joe Kington Date: Tue, 28 Jan 2025 17:28:40 -0700 Subject: [PATCH] PLMOSAIC: Use a unique user-agent string to isolate usage of driver --- frmts/plmosaic/plmosaicdataset.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frmts/plmosaic/plmosaicdataset.cpp b/frmts/plmosaic/plmosaicdataset.cpp index 3026e35d986b..364ecaa554df 100644 --- a/frmts/plmosaic/plmosaicdataset.cpp +++ b/frmts/plmosaic/plmosaicdataset.cpp @@ -409,6 +409,16 @@ char **PLMosaicDataset::GetBaseHTTPOptions() char **papszOptions = CSLAddString(nullptr, CPLSPrintf("PERSISTENT=PLMOSAIC:%p", this)); + + /* Ensure the PLMosaic driver uses a unique default user agent to help + * identify usage. */ + CPLString osUserAgent = CPLGetConfigOption("GDAL_HTTP_USERAGENT", ""); + if (osUserAgent.empty()) + papszOptions = CSLAddString( + papszOptions, CPLSPrintf("USERAGENT=PLMosaic Driver GDAL/%d.%d.%d", + GDAL_VERSION_MAJOR, GDAL_VERSION_MINOR, + GDAL_VERSION_REV)); + /* Use basic auth, rather than Authorization headers since curl would * forward it to S3 */ papszOptions =