@@ -5807,22 +5807,22 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
58075807 return false ;
58085808 }
58095809
5810- if (req.response_handler ) {
5811- if (!req.response_handler (res)) {
5812- error = Error::Canceled;
5813- return false ;
5814- }
5815- }
5816-
58175810 // Body
58185811 if ((res.status != 204 ) && req.method != " HEAD" && req.method != " CONNECT" ) {
5812+ auto redirect = 300 < res.status && res.status < 400 && follow_location_;
5813+
5814+ if (req.response_handler && !redirect) {
5815+ if (!req.response_handler (res)) {
5816+ error = Error::Canceled;
5817+ return false ;
5818+ }
5819+ }
5820+
58195821 auto out =
58205822 req.content_receiver
58215823 ? static_cast <ContentReceiverWithProgress>(
58225824 [&](const char *buf, size_t n, uint64_t off, uint64_t len) {
5823- if (300 < res.status && res.status < 400 && follow_location_) {
5824- return true ;
5825- }
5825+ if (redirect) { return true ; }
58265826 auto ret = req.content_receiver (buf, n, off, len);
58275827 if (!ret) { error = Error::Canceled; }
58285828 return ret;
@@ -5838,7 +5838,7 @@ inline bool ClientImpl::process_request(Stream &strm, Request &req,
58385838 });
58395839
58405840 auto progress = [&](uint64_t current, uint64_t total) {
5841- if (!req.progress ) { return true ; }
5841+ if (!req.progress || redirect ) { return true ; }
58425842 auto ret = req.progress (current, total);
58435843 if (!ret) { error = Error::Canceled; }
58445844 return ret;
0 commit comments