Fixed a bug in HttpServer where the byte range response header's "to"

field may be larger than the size.
This commit is contained in:
casey langen 2017-11-28 01:35:51 -08:00
parent fb869e27b3
commit d8b0aef307

View File

@ -175,7 +175,15 @@ static Range* parseRange(IDataStream* file, const char* range) {
if (to > from) {
result->from = from;
result->to = (to == 0) ? 0 : to - 1;
if (to == 0) {
result->to = 0;
}
else if (to >= size) {
result->to = size - 1;
}
else {
result->to = to - 1;
}
}
}
catch (...) {