Fix invalid end range appended to HTTP request
When the end range of a byte range in a HTTP request is skipped the download manager adds 0 it its place when resuming that download. When there is no end range given the value is skipped. Task-number: QTBUG-77867 Change-Id: I52358c94cf56c88217fcc91abb102ed393ac7242 Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
0844be34ba
commit
02a6209487
@ -752,8 +752,9 @@ void QNetworkReplyHttpImplPrivate::postRequest(const QNetworkRequest &newHttpReq
|
||||
quint64 requestStartOffset = requestRange.left(index).toULongLong();
|
||||
quint64 requestEndOffset = requestRange.mid(index + 1).toULongLong();
|
||||
|
||||
// In case an end offset is not given it is skipped from the request range
|
||||
requestRange = "bytes=" + QByteArray::number(resumeOffset + requestStartOffset) +
|
||||
'-' + QByteArray::number(requestEndOffset);
|
||||
'-' + (requestEndOffset ? QByteArray::number(requestEndOffset) : QByteArray());
|
||||
|
||||
httpRequest.setHeaderField("Range", requestRange);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user