mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-09-03 02:41:12 +02:00
nhttpd: fix range handling
Origin commit data
------------------
Commit: 4bf0d833cd
Author: martii <m4rtii@gmx.de>
Date: 2014-07-24 (Thu, 24 Jul 2014)
This commit is contained in:
@@ -140,7 +140,8 @@ bool CWebserverResponse::SendResponse() {
|
|||||||
// cache = false;
|
// cache = false;
|
||||||
Write(Connection->HookHandler.BuildHeader(cache));
|
Write(Connection->HookHandler.BuildHeader(cache));
|
||||||
if (Connection->Method != M_HEAD)
|
if (Connection->Method != M_HEAD)
|
||||||
Sendfile(Connection->Request.UrlData["url"], Connection->HookHandler.RangeStart, Connection->HookHandler.RangeEnd - Connection->HookHandler.RangeStart + 1);
|
Sendfile(Connection->Request.UrlData["url"], Connection->HookHandler.RangeStart,
|
||||||
|
(Connection->HookHandler.RangeStart == 0 && Connection->HookHandler.RangeEnd == -1) ? -1 : Connection->HookHandler.RangeEnd - Connection->HookHandler.RangeStart + 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (Connection->HookHandler.status == HANDLED_SENDFILE && Connection->HookHandler.httpStatus == HTTP_REQUEST_RANGE_NOT_SATISFIABLE) {
|
if (Connection->HookHandler.status == HANDLED_SENDFILE && Connection->HookHandler.httpStatus == HTTP_REQUEST_RANGE_NOT_SATISFIABLE) {
|
||||||
|
@@ -329,7 +329,7 @@ bool CySocket::SendFile(int filed, off_t start, off_t size) {
|
|||||||
if (errno != EPIPE)
|
if (errno != EPIPE)
|
||||||
perror("sendfile failed");
|
perror("sendfile failed");
|
||||||
if (errno != EINVAL)
|
if (errno != EINVAL)
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
BytesSend += written;
|
BytesSend += written;
|
||||||
|
Reference in New Issue
Block a user