You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!array_key_exists($key, self::$trustedHeaders)) {
610
-
thrownew\InvalidArgumentException(sprintf('Unab
F987
le to set the trusted header name for key "%s".', $key));
613
+
thrownewInvalidTrustedHeaderException($key, $value, sprintf('Unable to set the trusted header name for key "%s".', $key));
611
614
}
612
615
613
616
self::$trustedHeaders[$key] = $value;
@@ -620,12 +623,12 @@ public static function setTrustedHeaderName($key, $value)
620
623
*
621
624
* @return string The header name
622
625
*
623
-
* @throws \InvalidArgumentException
626
+
* @throws InvalidTrustedHeaderException
624
627
*/
625
628
publicstaticfunctiongetTrustedHeaderName($key)
626
629
{
627
630
if (!array_key_exists($key, self::$trustedHeaders)) {
628
-
thrownew\InvalidArgumentException(sprintf('Unable to get the trusted header name for key "%s".', $key));
631
+
thrownewInvalidTrustedHeaderException($key, null, sprintf('Unable to get the trusted header name for key "%s".', $key));
629
632
}
630
633
631
634
returnself::$trustedHeaders[$key];
@@ -788,6 +791,8 @@ public function setSession(SessionInterface $session)
788
791
*
789
792
* @return array The client IP addresses
790
793
*
794
+
* @throws ConflictingHeadersException
795
+
*
791
796
* @see getClientIp()
792
797
*/
793
798
publicfunctiongetClientIps()
@@ -819,7 +824,7 @@ public function getClientIps()
819
824
}
820
825
821
826
if ($hasTrustedForwardedHeader && $hasTrustedClientIpHeader && $forwardedClientIps !== $xForwardedForClientIps) {
822
-
thrownewConflictingHeadersException('The request has both a trusted Forwarded header and a trusted Client IP header, conflicting with each other with regards to the originating IP addresses of the request. This is the result of a misconfiguration. You should either configure your proxy only to send one of these headers, or configure Symfony to distrust one of them.');
827
+
thrownewConflictingHeadersException('The request has both a trusted Forwarded header and a trusted Client IP header, conflicting with each other with regards to the originating IP addresses of the request. This is the result of a misconfiguration. You should either configure your proxy only to send one of these headers, or configure your project to distrust one of them.');
823
828
}
824
829
825
830
if (!$hasTrustedForwardedHeader && !$hasTrustedClientIpHeader) {
@@ -1198,7 +1203,8 @@ public function isSecure()
1198
1203
*
1199
1204
* @return string
1200
1205
*
1201
-
* @throws \UnexpectedValueException when the host name is invalid
1206
+
* @throws InvalidHostException when the host name is invalid
1207
+
* @throws UntrustedHostException when the host is not trusted
1202
1208
*/
1203
1209
publicfunctiongetHost()
1204
1210
{
@@ -1220,7 +1226,7 @@ public function getHost()
1220
1226
// check that it does not contain forbidden characters (see RFC 952 and RFC 2181)
1221
1227
// use preg_replace() instead of preg_match() to prevent DoS attacks with long host names
1222
1228
if ($host && '' !== preg_replace('/(?:^\[)?[a-zA-Z0-9-:\]_]+\.?/', '', $host)) {
0 commit comments