Skip to content

Commit

Permalink
do not capture itself
Browse files Browse the repository at this point in the history
  • Loading branch information
QuentinGab committed Nov 10, 2024
1 parent 774afb3 commit db94032
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/Sources/RequestHeaderSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,22 @@ public function isEmpty(): bool

public static function fromRequest(Request $request): static
{
$referer = $request->header('referer'); // spelling is a known mistake

if (blank($referer)) {
return new static;
}

if (! is_string($referer)) {
return new static;
}

if (parse_url($referer, PHP_URL_HOST) === parse_url(url('/'), PHP_URL_HOST)) {
return new static;
}

return new static(
referer: $request->header('referer'), // spelling is a known mistake
referer: $referer,
timestamp: (float) $request->server('REQUEST_TIME')
);
}
Expand Down

0 comments on commit db94032

Please sign in to comment.