Skip to content

Commit 565a926

Browse files
committed
Remove port from hostname
1 parent 6448365 commit 565a926

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/Pecee/Http/Request.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,11 @@ public function setUrl(Url $url): void
405405
*/
406406
public function setHost(?string $host): void
407407
{
408+
// Strip any potential ports from hostname
409+
if (strpos($host, ':') !== false) {
410+
$host = strstr($host, strrchr($host, ':'), true);
411+
}
412+
408413
$this->host = $host;
409414
}
410415

src/Pecee/Http/Url.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ public function getHost(bool $includeTrails = false): ?string
164164
*/
165165
public function setHost(string $host): self
166166
{
167-
// Strip any potential ports from hostname
168-
if (strpos($host, ':') !== false) {
169-
$host = strstr($host, strrchr($host, ':'), true);
170-
}
171-
172167
$this->host = $host;
173168

174169
return $this;

0 commit comments

Comments
 (0)