File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,6 +35,17 @@ public static function enrichServerVars(Request $request): array
3535 $ server ['REQUEST_METHOD ' ] = $ request ->method ;
3636 $ server ['HTTP_USER_AGENT ' ] = '' ;
3737
38+ $ host = parse_url ($ request ->uri , PHP_URL_HOST );
39+ $ port = parse_url ($ request ->uri , PHP_URL_PORT );
40+
41+ if ($ host != null ) {
42+ $ server ['HTTP_HOST ' ] = $ host ;
43+ }
44+
45+ if ($ host != null && $ port != null ) {
46+ $ server ['HTTP_HOST ' ] = $ host . ': ' . $ port ;
47+ }
48+
3849 foreach ($ request ->headers as $ key => $ value ) {
3950 $ key = \strtoupper (\str_replace ('- ' , '_ ' , $ key ));
4051
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public function testStateServerLeak(): void
4444 'HTTP_USER_AGENT ' => '' ,
4545 'CONTENT_TYPE ' => 'application/html ' ,
4646 'HTTP_CONNECTION ' => 'keep-alive ' ,
47+ 'HTTP_HOST ' => 'localhost ' ,
4748 ],
4849 ],
4950 [
@@ -56,6 +57,7 @@ public function testStateServerLeak(): void
5657 'REQUEST_METHOD ' => 'GET ' ,
5758 'HTTP_USER_AGENT ' => '' ,
5859 'CONTENT_TYPE ' => 'application/json ' ,
60+ 'HTTP_HOST ' => 'localhost ' ,
5961 ],
6062 ],
6163 ];
You can’t perform that action at this time.
0 commit comments