mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2025-05-15 09:18:27 +00:00
Fix suffix-byte-range issue (#711)
This commit is contained in:
parent
4bb001351c
commit
bc4a613b6d
2 changed files with 26 additions and 1 deletions
|
@ -173,6 +173,7 @@ using socket_t = int;
|
|||
#define INVALID_SOCKET (-1)
|
||||
#endif //_WIN32
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <atomic>
|
||||
#include <cassert>
|
||||
|
@ -3153,7 +3154,7 @@ get_range_offset_and_length(const Request &req, size_t content_length,
|
|||
auto slen = static_cast<ssize_t>(content_length);
|
||||
|
||||
if (r.first == -1) {
|
||||
r.first = slen - r.second;
|
||||
r.first = std::max(static_cast<ssize_t>(0), slen - r.second);
|
||||
r.second = slen - 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue