@@ -590,7 +590,6 @@ struct Response {
590
590
Headers headers;
591
591
std::string body;
592
592
std::string location; // Redirect location
593
- bool ignore_range = false ;
594
593
595
594
bool has_header (const std::string &key) const ;
596
595
std::string get_header_value (const std::string &key, size_t id = 0 ) const ;
@@ -6503,7 +6502,7 @@ inline bool Server::dispatch_request(Request &req, Response &res,
6503
6502
inline void Server::apply_ranges (const Request &req, Response &res,
6504
6503
std::string &content_type,
6505
6504
std::string &boundary) const {
6506
- if (req.ranges .size () > 1 && ! res.ignore_range ) {
6505
+ if (req.ranges .size () > 1 && res.status == StatusCode::PartialContent_206 ) {
6507
6506
auto it = res.headers .find (" Content-Type" );
6508
6507
if (it != res.headers .end ()) {
6509
6508
content_type = it->second ;
@@ -6521,7 +6520,7 @@ inline void Server::apply_ranges(const Request &req, Response &res,
6521
6520
if (res.body .empty ()) {
6522
6521
if (res.content_length_ > 0 ) {
6523
6522
size_t length = 0 ;
6524
- if (req.ranges .empty () || res.ignore_range ) {
6523
+ if (req.ranges .empty () || res.status != StatusCode::PartialContent_206 ) {
6525
6524
length = res.content_length_ ;
6526
6525
} else if (req.ranges .size () == 1 ) {
6527
6526
auto offset_and_length = detail::get_range_offset_and_length (
@@ -6550,7 +6549,7 @@ inline void Server::apply_ranges(const Request &req, Response &res,
6550
6549
}
6551
6550
}
6552
6551
} else {
6553
- if (req.ranges .empty () || res.ignore_range ) {
6552
+ if (req.ranges .empty () || res.status != StatusCode::PartialContent_206 ) {
6554
6553
;
6555
6554
} else if (req.ranges .size () == 1 ) {
6556
6555
auto offset_and_length =
0 commit comments