[llvm] [HTTP][Windows] Apply the configured timeout to WinHttpReceiveResponse (PR #226172)

Charles Zablit via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 07:01:44 PDT 2026


https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/226172

`WinHttpSetTimeouts` does not cover the wait inside `WinHttpReceiveResponse`, which keeps its own 90s default, so the configured SymStore timeout was never applied to waiting for a response. A server that takes a long time to reply produces a 200 with no body instead of a timeout, and lldb handed back a path to a file that was never created.

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

>From d5e013d105d8927a29e98855df304119a69384d9 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Thu, 24 Sep 2026 15:00:19 +0100
Subject: [PATCH] [HTTP][Windows] Apply the configured timeout to
 WinHttpReceiveResponse

---
 llvm/lib/HTTP/HTTPClient.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

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