Skip to content

Commit

Permalink
ignore ssl certificate integrity check on get remote file size function
Browse files Browse the repository at this point in the history
  • Loading branch information
MuriloChianfa committed Sep 3, 2024
1 parent 36ba0a2 commit a9e7d23
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,12 @@ function getRemoteFileSize(string $url): int
}

if (! isset($contentLength)) {
$context = stream_context_create([
'ssl' => [
'verify_peer' => false,
'verify_peer_name' => false
],
]);

$contentLength = strlen(file_get_contents($url, false, $context));
$options = (array) config('seo.http.options', []);
$context = isset($options['verify']) && !$options['verify']
? $context = ['ssl' => ['verify_peer' => false, 'verify_peer_name' => false]]
: [];

$contentLength = strlen(file_get_contents($url, false, stream_context_create($context)));
}

return $contentLength;
Expand Down

0 comments on commit a9e7d23

Please sign in to comment.