mirror of
https://github.com/yhirose/cpp-httplib.git
synced 2026-10-19 11:19:36 +00:00
Merge branch 'range-206-only' of github.com:metsw24-max/cpp-httplib into metsw24-max-range-206-only
This commit is contained in:
commit
6b723fbf9d
2 files changed
+49
-1
No files matched your search
@@ -11845,7 +11845,16 @@ Server::write_content_with_provider(Stream &strm, const Request &req,
|
||||
};
|
||||
|
||||
if (res.content_length_ > 0) {
|
||||
if (req.ranges.empty()) {
|
||||
// Only a 206 response is served as a partial representation. That is the
|
||||
// condition `apply_ranges()` used when it decided the Content-Length and
|
||||
// the multipart boundary, and `detail::range_error()` only validates
|
||||
// `req.ranges` against the content length for a 2xx status. Honouring the
|
||||
// ranges here under any other status would write a body that disagrees
|
||||
// with the header we already sent, from an offset nothing has checked.
|
||||
auto partial =
|
||||
!req.ranges.empty() && res.status == StatusCode::PartialContent_206;
|
||||
|
||||
if (!partial) {
|
||||
return detail::write_content(strm, res.content_provider_, 0,
|
||||
res.content_length_, is_shutting_down);
|
||||
} else if (req.ranges.size() == 1) {
|
||||
|
||||
Reference in new issue
Block a user