Skip to content

Commit a0acec5

Browse files
authored
Convert hostname to lowercase (#215)
1 parent 951043b commit a0acec5

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/Http/Adapter/FPM/Request.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ public function getPort(): string
108108
*/
109109
public function getHostname(): string
110110
{
111-
return (string) \parse_url($this->getProtocol().'://'.$this->getServer('HTTP_HOST', ''), PHP_URL_HOST);
111+
$hostname = \parse_url($this->getProtocol().'://'.$this->getServer('HTTP_HOST', ''), PHP_URL_HOST);
112+
return strtolower((string) $hostname);
112113
}
113114

114115
/**

src/Http/Adapter/Swoole/Request.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public function getPort(): string
122122
*/
123123
public function getHostname(): string
124124
{
125-
return strval(\parse_url($this->getProtocol().'://'.$this->getHeader('x-forwarded-host', $this->getHeader('host')), PHP_URL_HOST));
125+
$hostname = \parse_url($this->getProtocol().'://'.$this->getHeader('x-forwarded-host', $this->getHeader('host')), PHP_URL_HOST);
126+
return strtolower(strval($hostname));
126127
}
127128

128129
/**

0 commit comments

Comments
 (0)