httpd: fix handling of range requests

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2017-09-18 13:09:11 +02:00
parent 3f5ba0c872
commit a6390ed77e

View File

@ -2338,7 +2338,7 @@ static void handle_incoming_and_exit(const len_and_sockaddr *fromAddr)
if (STRNCASECMP(iobuf, "Range:") == 0) { if (STRNCASECMP(iobuf, "Range:") == 0) {
/* We know only bytes=NNN-[MMM] */ /* We know only bytes=NNN-[MMM] */
char *s = skip_whitespace(iobuf + sizeof("Range:")-1); char *s = skip_whitespace(iobuf + sizeof("Range:")-1);
if (is_prefixed_with(s, "bytes=") == 0) { if (is_prefixed_with(s, "bytes=")) {
s += sizeof("bytes=")-1; s += sizeof("bytes=")-1;
range_start = BB_STRTOOFF(s, &s, 10); range_start = BB_STRTOOFF(s, &s, 10);
if (s[0] != '-' || range_start < 0) { if (s[0] != '-' || range_start < 0) {