Adjust last-byte-pos greater than files
This commit is contained in:
parent
64e7dc3fda
commit
432898af71
1 changed files with 5 additions and 2 deletions
7
quark.c
7
quark.c
|
@ -721,8 +721,7 @@ sendresponse(int fd, struct request *r)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check range */
|
/* check range */
|
||||||
if (lower < 0 || upper < 0 || lower > upper ||
|
if (lower < 0 || upper < 0 || lower > upper) {
|
||||||
upper >= st.st_size) {
|
|
||||||
if (dprintf(fd,
|
if (dprintf(fd,
|
||||||
"HTTP/1.1 %d %s\r\n"
|
"HTTP/1.1 %d %s\r\n"
|
||||||
"Date: %s\r\n"
|
"Date: %s\r\n"
|
||||||
|
@ -737,6 +736,10 @@ sendresponse(int fd, struct request *r)
|
||||||
}
|
}
|
||||||
return S_RANGE_NOT_SATISFIABLE;
|
return S_RANGE_NOT_SATISFIABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* adjust upper limit */
|
||||||
|
if (upper >= st.st_size)
|
||||||
|
upper = st.st_size-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* mime */
|
/* mime */
|
||||||
|
|
Loading…
Reference in a new issue