[llvm] 44be0ef - [HTTP][Windows] Apply the configured timeout to WinHttpReceiveResponse (#226172)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 08:04:06 PDT 2026


Author: Charles Zablit
Date: 2026-09-24T16:04:00+01:00
New Revision: 44be0efbe3ae7593da00770f8505486011ca7057

URL: https://github.com/llvm/llvm-project/commit/44be0efbe3ae7593da00770f8505486011ca7057
DIFF: https://github.com/llvm/llvm-project/commit/44be0efbe3ae7593da00770f8505486011ca7057.diff

LOG: [HTTP][Windows] Apply the configured timeout to WinHttpReceiveResponse (#226172)

`WinHttpSetTimeouts` does not bound the wait inside
`WinHttpReceiveResponse`, which has its own separate
`WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT`.

For example: with the SymStore timeout set to 1s, a server stalling 5s
before responding is not cancelled: `perform()` returns success with a
200 and no body, so lldb handed back a path to a file the response
handler never created.

This fixes `symstore/TestSymStore.py` (test_http_timeout) in swiftlang.

Added: 
    

Modified: 
    llvm/lib/HTTP/HTTPClient.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/HTTP/HTTPClient.cpp b/llvm/lib/HTTP/HTTPClient.cpp
index 89b7bc1266e8e..fb3506a238648 100644
--- a/llvm/lib/HTTP/HTTPClient.cpp
+++ b/llvm/lib/HTTP/HTTPClient.cpp
@@ -307,6 +307,15 @@ Error HTTPClient::perform(const HTTPRequest &Request,
                           Session->TimeoutMs, Session->TimeoutMs))
     return createStringError(errc::io_error, "Failed to set WinHTTP timeout");
 
+  // WinHttpSetTimeouts does not cover the wait inside WinHttpReceiveResponse,
+  // which keeps its own 90 second default.
+  DWORD ResponseTimeoutMs = Session->TimeoutMs;
+  if (!WinHttpSetOption(Session->SessionHandle,
+                        WINHTTP_OPTION_RECEIVE_RESPONSE_TIMEOUT,
+                        &ResponseTimeoutMs, sizeof(ResponseTimeoutMs)))
+    return createStringError(errc::io_error,
+                             "Failed to set WinHTTP response timeout");
+
   // Prevent fallback to TLS 1.0/1.1
   DWORD SecureProtocols =
       WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_2 | WINHTTP_FLAG_SECURE_PROTOCOL_TLS1_3;


        


More information about the llvm-commits mailing list