From bf8184f2d566c43cec298bd76f10cf85c5992b7c Mon Sep 17 00:00:00 2001
From: Oliver Hader <oliver@typo3.org>
Date: Fri, 1 Mar 2024 14:04:45 +0100
Subject: [PATCH] [BUGFIX] Allow ws and wss schemes in TYPO3\CMS\Core\Http\Uri
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Resolves: #103190
Releases: main, 12.4
Change-Id: Icb71b994b3ca14463dbb86b91551af6d60918096
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/83173
Reviewed-by: Jörg Bösche <typo3@joergboesche.de>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Guido Schmechel <guido.schmechel@brandung.de>
Tested-by: Andreas Kienast <a.fernandez@scripting-base.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Andreas Kienast <a.fernandez@scripting-base.de>
---
 typo3/sysext/core/Classes/Http/Uri.php        | 2 ++
 typo3/sysext/core/Tests/Unit/Http/UriTest.php | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/typo3/sysext/core/Classes/Http/Uri.php b/typo3/sysext/core/Classes/Http/Uri.php
index ffda18cf3f95..09ca4e125934 100644
--- a/typo3/sysext/core/Classes/Http/Uri.php
+++ b/typo3/sysext/core/Classes/Http/Uri.php
@@ -53,6 +53,8 @@ class Uri implements UriInterface
     protected array $supportedSchemes = [
         'http'  => 80,
         'https' => 443,
+        'ws' => 80,
+        'wss' => 443,
     ];
 
     /**
diff --git a/typo3/sysext/core/Tests/Unit/Http/UriTest.php b/typo3/sysext/core/Tests/Unit/Http/UriTest.php
index 3087eac58b50..ce89a9b4dc13 100644
--- a/typo3/sysext/core/Tests/Unit/Http/UriTest.php
+++ b/typo3/sysext/core/Tests/Unit/Http/UriTest.php
@@ -43,6 +43,8 @@ final class UriTest extends UnitTestCase
         return [
             'full uri' => [ 'https://user:pass@local.example.com:3001/foo?bar=baz#quz' ],
             'double slash' => [ 'https://user:pass@local.example.com:3001//' ],
+            'websocket uri' => [ 'ws://user:pass@local.example.com:3001/foo?bar=baz#quz' ],
+            'secure websocket uri' => [ 'wss://user:pass@local.example.com:3001/foo?bar=baz#quz' ],
         ];
     }
 
-- 
GitLab