From f973285e04556e08607ba5cd56bb751c29082cf9 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sun, 4 Apr 2021 10:45:33 -0700 Subject: [PATCH] Guard against unexpected panic conditions from wings --- .../Http/Connection/DaemonConnectionException.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/app/Exceptions/Http/Connection/DaemonConnectionException.php b/app/Exceptions/Http/Connection/DaemonConnectionException.php index eba5f8a7f..c308b9b72 100644 --- a/app/Exceptions/Http/Connection/DaemonConnectionException.php +++ b/app/Exceptions/Http/Connection/DaemonConnectionException.php @@ -38,6 +38,15 @@ class DaemonConnectionException extends DisplayException if ($useStatusCode) { $this->statusCode = is_null($response) ? $this->statusCode : $response->getStatusCode(); + // There are rare conditions where wings encounters a panic condition and crashes the + // request being made after content has already been sent over the wire. In these cases + // you can end up with a "successful" response code that is actual an error. + // + // Handle those better here since we shouldn't ever end up in this exception state and + // be returning a 2XX level response. + if ($this->statusCode < 400) { + $this->statusCode = Response::HTTP_BAD_GATEWAY; + } } if (is_null($response)) {