From 565a926bd3431fd1f76e0aca533fbd43d9b1ea86 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 27 Nov 2023 08:06:35 +0100 Subject: [PATCH] Remove port from hostname --- src/Pecee/Http/Request.php | 5 +++++ src/Pecee/Http/Url.php | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Pecee/Http/Request.php b/src/Pecee/Http/Request.php index 100cd38..a09956a 100644 --- a/src/Pecee/Http/Request.php +++ b/src/Pecee/Http/Request.php @@ -405,6 +405,11 @@ class Request */ public function setHost(?string $host): void { + // Strip any potential ports from hostname + if (strpos($host, ':') !== false) { + $host = strstr($host, strrchr($host, ':'), true); + } + $this->host = $host; } diff --git a/src/Pecee/Http/Url.php b/src/Pecee/Http/Url.php index 9ba71ac..4bd2647 100644 --- a/src/Pecee/Http/Url.php +++ b/src/Pecee/Http/Url.php @@ -164,11 +164,6 @@ class Url implements JsonSerializable */ public function setHost(string $host): self { - // Strip any potential ports from hostname - if (strpos($host, ':') !== false) { - $host = strstr($host, strrchr($host, ':'), true); - } - $this->host = $host; return $this;