Skip to content
Snippets Groups Projects
Commit 6c6d1c83 authored by Monty Brandenberg's avatar Monty Brandenberg
Browse files

Format/data type mismatch lead to a 'Range: bytes=0-0' header which gave me 1 byte of data.

Shouldn't be making that kind of mistake.
parent 9a11a294
No related branches found
No related tags found
No related merge requests found
......@@ -376,19 +376,19 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
if ((mReqOffset || mReqLength) && HOR_GET == mReqMethod)
{
static const char * fmt1("Range: bytes=%d-%d");
static const char * fmt2("Range: bytes=%d-");
static const char * const fmt1("Range: bytes=%lu-%lu");
static const char * const fmt2("Range: bytes=%lu-");
char range_line[64];
#if defined(WIN32)
_snprintf_s(range_line, sizeof(range_line), sizeof(range_line) - 1,
(mReqLength ? fmt1 : fmt2),
mReqOffset, mReqOffset + mReqLength - 1);
(unsigned long) mReqOffset, (unsigned long) (mReqOffset + mReqLength - 1));
#else
snprintf(range_line, sizeof(range_line),
(mReqLength ? fmt1 : fmt2),
mReqOffset, mReqOffset + mReqLength - 1);
(unsigned long) mReqOffset, (unsigned long) (mReqOffset + mReqLength - 1));
#endif // defined(WIN32)
range_line[sizeof(range_line) - 1] = '\0';
mCurlHeaders = curl_slist_append(mCurlHeaders, range_line);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment