kio: set variables to valid range when the requested range is not valid in KHTTP

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-30 04:24:36 +03:00
parent 8364192b45
commit 70e1615510

View file

@ -608,7 +608,7 @@ void KHTTPPrivate::slotNewConnection()
const qint64 httpfilesize = httpfile->size();
qint64 httprangesize = httpfilesize;
const quint64 httprangestart = khttpheadersparser.rangeStart();
quint64 httprangestart = khttpheadersparser.rangeStart();
quint64 httprangeend = khttpheadersparser.rangeEnd();
if (httprangestart != 0 || httprangeend != 0) {
bool httprangevalid = true;
@ -619,6 +619,8 @@ void KHTTPPrivate::slotNewConnection()
kDebug(s_khttpdebugarea) << "ranged request" << responsefilepath << httprangestart << httprangeend;
if (httprangestart > httpfilesize || httprangeend > httpfilesize) {
httprangevalid = false;
httprangestart = 0;
httprangesize = httpfilesize;
}
// if valid change status and insert required headers for a ranged request, otherwise
// just ignore the range request