From 64483652fffac34d172b1c2d232fc70f2a9261f7 Mon Sep 17 00:00:00 2001 From: Simon Date: Mon, 27 Nov 2023 07:58:49 +0100 Subject: [PATCH] Strip any potential port number from hostname --- src/Pecee/Http/Url.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Pecee/Http/Url.php b/src/Pecee/Http/Url.php index 4bd2647..9ba71ac 100644 --- a/src/Pecee/Http/Url.php +++ b/src/Pecee/Http/Url.php @@ -164,6 +164,11 @@ 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;