kio: fake bytes range support for KHTTP

as the RFC says - the server (KHTTP in this case) can ignore range
requests, tested with curl and wget and both will not get a range transfer
but the request will not fail because the server does not support ranges

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-30 00:29:32 +03:00
parent 3bbbe4f382
commit de4204d82c

View file

@ -278,9 +278,9 @@ static KHTTPHeaders HTTPHeaders(const QString &serverid, const bool authenticate
// optional for anything but 405, see: // optional for anything but 405, see:
// https://www.rfc-editor.org/rfc/rfc9110.html#section-10.2.1 // https://www.rfc-editor.org/rfc/rfc9110.html#section-10.2.1
khttpheaders.insert("Allow", "GET, HEAD"); khttpheaders.insert("Allow", "GET, HEAD");
// optional, see: // optional (the range request can be ignored), see:
// https://www.rfc-editor.org/rfc/rfc9110.html#section-14.3 // https://www.rfc-editor.org/rfc/rfc9110.html#section-14.3
khttpheaders.insert("Accept-Ranges", "none"); khttpheaders.insert("Accept-Ranges", "bytes");
// TODO: maybe implement persistent connections // TODO: maybe implement persistent connections
khttpheaders.insert("Connection", "close"); khttpheaders.insert("Connection", "close");
if (authenticate) { if (authenticate) {