]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Restore Security::ErrorDetail::detailEntry initialization (#2364)
authorRicardo Ferreira Ribeiro <garb12@pm.me>
Fri, 30 Jan 2026 09:25:59 +0000 (09:25 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 9 Feb 2026 09:19:07 +0000 (09:19 +0000)
2023 commit 4e143970 accidentally removed code that was setting
`detailEntry` data member, breaking `%ssl_error_descr` expansion:
`Security::ErrorDetail::printErrorDescription()` would always print
`[Not available]`.

Squid still printed non-configurable request-independent error code
_name_ correctly because the corresponding `printErrorCode()` method
only uses `detailEntry` as a performance optimization.

The effects of this fix are visible, for example, in generated
ERR_SECURE_CONNECT_FAIL error responses:

```diff
- <p>[Not available]: /CN=...</p>
+ <p>Certificate does not match domainname: /CN=...</p>
```

This is a Measurement Factory project.

src/security/ErrorDetail.cc

index f05f74de5b10f6627d5819623f70adb02d87c335..9b3de592a3db883f7821ac91fb2782c4a9524c6f 100644 (file)
@@ -535,8 +535,12 @@ Security::ErrorDetail::verbose(const HttpRequestPointer &request) const
 {
     std::optional<SBuf> customFormat;
 #if USE_OPENSSL
-    if (const auto errorDetail = Ssl::ErrorDetailsManager::GetInstance().findDetail(error_no, request))
-        customFormat = errorDetail->detail;
+    if (const auto errorDetail = Ssl::ErrorDetailsManager::GetInstance().findDetail(error_no, request)) {
+        detailEntry = *errorDetail;
+        customFormat = detailEntry->detail;
+    } else {
+        detailEntry.reset();
+    }
 #else
     (void)request;
 #endif