@@ -669,7 +669,7 @@ struct Request {
669
669
bool is_chunked_content_provider_ = false ;
670
670
size_t authorization_count_ = 0 ;
671
671
std::chrono::time_point<std::chrono::steady_clock> start_time_ =
672
- std::chrono::steady_clock::now ();
672
+ std::chrono::steady_clock::time_point::min ();
673
673
};
674
674
675
675
struct Response {
@@ -8101,6 +8101,9 @@ inline Result ClientImpl::send_with_content_provider(
8101
8101
req.headers = headers;
8102
8102
req.path = path;
8103
8103
req.progress = progress;
8104
+ if (global_timeout_msec_ > 0 ) {
8105
+ req.start_time_ = std::chrono::steady_clock::now ();
8106
+ }
8104
8107
8105
8108
auto error = Error::Success;
8106
8109
@@ -8283,6 +8286,9 @@ inline Result ClientImpl::Get(const std::string &path, const Headers &headers,
8283
8286
req.path = path;
8284
8287
req.headers = headers;
8285
8288
req.progress = std::move (progress);
8289
+ if (global_timeout_msec_ > 0 ) {
8290
+ req.start_time_ = std::chrono::steady_clock::now ();
8291
+ }
8286
8292
8287
8293
return send_ (std::move (req));
8288
8294
}
@@ -8348,6 +8354,9 @@ inline Result ClientImpl::Get(const std::string &path, const Headers &headers,
8348
8354
return content_receiver (data, data_length);
8349
8355
};
8350
8356
req.progress = std::move (progress);
8357
+ if (global_timeout_msec_ > 0 ) {
8358
+ req.start_time_ = std::chrono::steady_clock::now ();
8359
+ }
8351
8360
8352
8361
return send_ (std::move (req));
8353
8362
}
@@ -8393,6 +8402,9 @@ inline Result ClientImpl::Head(const std::string &path,
8393
8402
req.method = " HEAD" ;
8394
8403
req.headers = headers;
8395
8404
req.path = path;
8405
+ if (global_timeout_msec_ > 0 ) {
8406
+ req.start_time_ = std::chrono::steady_clock::now ();
8407
+ }
8396
8408
8397
8409
return send_ (std::move (req));
8398
8410
}
@@ -8810,6 +8822,9 @@ inline Result ClientImpl::Delete(const std::string &path,
8810
8822
req.headers = headers;
8811
8823
req.path = path;
8812
8824
req.progress = progress;
8825
+ if (global_timeout_msec_ > 0 ) {
8826
+ req.start_time_ = std::chrono::steady_clock::now ();
8827
+ }
8813
8828
8814
8829
if (!content_type.empty ()) { req.set_header (" Content-Type" , content_type); }
8815
8830
req.body .assign (body, content_length);
@@ -8857,6 +8872,9 @@ inline Result ClientImpl::Options(const std::string &path,
8857
8872
req.method = " OPTIONS" ;
8858
8873
req.headers = headers;
8859
8874
req.path = path;
8875
+ if (global_timeout_msec_ > 0 ) {
8876
+ req.start_time_ = std::chrono::steady_clock::now ();
8877
+ }
8860
8878
8861
8879
return send_ (std::move (req));
8862
8880
}
@@ -9540,6 +9558,9 @@ inline bool SSLClient::connect_with_proxy(
9540
9558
Request req2;
9541
9559
req2.method = " CONNECT" ;
9542
9560
req2.path = host_and_port_;
9561
+ if (global_timeout_msec_ > 0 ) {
9562
+ req2.start_time_ = std::chrono::steady_clock::now ();
9563
+ }
9543
9564
return process_request (strm, req2, proxy_res, false , error);
9544
9565
})) {
9545
9566
// Thread-safe to close everything because we are assuming there are no
@@ -9568,6 +9589,9 @@ inline bool SSLClient::connect_with_proxy(
9568
9589
req3, auth, 1 , detail::random_string (10 ),
9569
9590
proxy_digest_auth_username_, proxy_digest_auth_password_,
9570
9591
true ));
9592
+ if (global_timeout_msec_ > 0 ) {
9593
+ req3.start_time_ = std::chrono::steady_clock::now ();
9594
+ }
9571
9595
return process_request (strm, req3, proxy_res, false , error);
9572
9596
})) {
9573
9597
// Thread-safe to close everything because we are assuming there are
0 commit comments