Skip to content

Commit 0ba25e1

Browse files
authored
Convert hostname to lowercase (#213)
1 parent 409a258 commit 0ba25e1

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/Http/Adapter/FPM/Request.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public function getPort(): string
125125
*/
126126
public function getHostname(): string
127127
{
128-
return (string) \parse_url($this->getProtocol().'://'.$this->getServer('HTTP_HOST', ''), PHP_URL_HOST);
128+
$hostname = \parse_url($this->getProtocol().'://'.$this->getServer('HTTP_HOST', ''), PHP_URL_HOST);
129+
return strtolower((string) ($hostname));
129130
}
130131

131132
/**

src/Http/Adapter/Swoole/Request.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ public function getPort(): string
141141
*/
142142
public function getHostname(): string
143143
{
144-
return strval(\parse_url($this->getProtocol().'://'.$this->getHeader('x-forwarded-host', $this->getHeader('host')), PHP_URL_HOST));
144+
$hostname = \parse_url($this->getProtocol().'://'.$this->getHeader('x-forwarded-host', $this->getHeader('host')), PHP_URL_HOST);
145+
return strtolower(strval($hostname));
145146
}
146147

147148
/**

0 commit comments

Comments
 (0)