Skip to content

Commit 11a4058

Browse files
committed
Fix #1998
1 parent 3e86bdb commit 11a4058

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

httplib.h

+11-7
Original file line numberDiff line numberDiff line change
@@ -7964,7 +7964,9 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
79647964
// Body
79657965
if ((res.status != StatusCode::NoContent_204) && req.method != "HEAD" &&
79667966
req.method != "CONNECT") {
7967-
auto redirect = 300 < res.status && res.status < 400 && follow_location_;
7967+
auto redirect = 300 < res.status && res.status < 400 &&
7968+
res.status != StatusCode::NotModified_304 &&
7969+
follow_location_;
79687970

79697971
if (req.response_handler && !redirect) {
79707972
if (!req.response_handler(res)) {
@@ -8008,12 +8010,14 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
80088010
}
80098011
}
80108012

8011-
int dummy_status;
8012-
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
8013-
dummy_status, std::move(progress), std::move(out),
8014-
decompress_)) {
8015-
if (error != Error::Canceled) { error = Error::Read; }
8016-
return false;
8013+
if (res.status != StatusCode::NotModified_304) {
8014+
int dummy_status;
8015+
if (!detail::read_content(strm, res, (std::numeric_limits<size_t>::max)(),
8016+
dummy_status, std::move(progress),
8017+
std::move(out), decompress_)) {
8018+
if (error != Error::Canceled) { error = Error::Read; }
8019+
return false;
8020+
}
80178021
}
80188022
}
80198023

0 commit comments

Comments
 (0)