Skip to content

Commit

Permalink
Merge pull request #9244 from rouault/vsicurl_416
Browse files Browse the repository at this point in the history
/vsicurl/: Read(): emit error message when receiving HTTP 416 Range Not Satisfiable error
  • Loading branch information
rouault authored Feb 26, 2024
2 parents 7abeb94 + 877fc71 commit 6095912
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions port/cpl_vsil_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1987,6 +1987,22 @@ std::string VSICurlHandle::DownloadRegion(const vsi_l_offset startOffset,
CPLError(CE_Failure, CPLE_AppDefined, "%d: %s",
static_cast<int>(response_code), szCurlErrBuf);
}
else if (response_code == 416) /* Range Not Satisfiable */
{
if (sWriteFuncData.pBuffer)
{
CPLError(
CE_Failure, CPLE_AppDefined,
"%d: Range downloading not supported by this server: %s",
static_cast<int>(response_code), sWriteFuncData.pBuffer);
}
else
{
CPLError(CE_Failure, CPLE_AppDefined,
"%d: Range downloading not supported by this server",
static_cast<int>(response_code));
}
}
if (!oFileProp.bHasComputedFileSize && startOffset == 0)
{
oFileProp.bHasComputedFileSize = true;
Expand Down

0 comments on commit 6095912

Please sign in to comment.