Skip to content

Commit

Permalink
Handle empty Sec-Fetch-Mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Simbiat committed Jan 8, 2022
1 parent 4044858 commit 82120f8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/HTTP20/Headers.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,10 @@ public function secFetch(array $site = [], array $mode = [], array $user = [], a
#Check if support values are sent in headers
if (
in_array($_SERVER['HTTP_SEC_FETCH_SITE'], self::fetchSite) &&
in_array($_SERVER['HTTP_SEC_FETCH_MODE'], self::fetchMode) &&
(
empty($_SERVER['HTTP_SEC_FETCH_MODE']) ||
in_array($_SERVER['HTTP_SEC_FETCH_MODE'], self::fetchMode)
) &&
(
empty($_SERVER['HTTP_SEC_FETCH_USER']) ||
in_array($_SERVER['HTTP_SEC_FETCH_USER'], self::fetchUser)
Expand Down Expand Up @@ -370,7 +373,10 @@ public function secFetch(array $site = [], array $mode = [], array $user = [], a
#Actual validation
if (
!in_array($_SERVER['HTTP_SEC_FETCH_SITE'], $site) ||
!in_array($_SERVER['HTTP_SEC_FETCH_MODE'], $mode) ||
(
!empty($_SERVER['HTTP_SEC_FETCH_MODE']) &&
!in_array($_SERVER['HTTP_SEC_FETCH_MODE'], $mode)
) ||
(
!empty($_SERVER['HTTP_SEC_FETCH_USER']) &&
!in_array($_SERVER['HTTP_SEC_FETCH_USER'], $user)
Expand Down

0 comments on commit 82120f8

Please sign in to comment.