Skip to content

Commit eb40239

Browse files
Add URL validation and Windows SSL verify problem solved
1 parent e4c61a0 commit eb40239

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Supabase.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ class Supabase
1111

1212
public function __construct(?string $url=null, ?string $apikey=null)
1313
{
14+
if(!filter_var($url, FILTER_VALIDATE_URL))
15+
{
16+
echo "Invalid URL format";
17+
exit();
18+
}
19+
1420
if (!isset($url)){
1521
throw new Exception("Supabase URL must be specified");
1622
} elseif(!isset($apikey)){
@@ -35,11 +41,15 @@ protected function grab(string $url, string $method, ?string $data=null)
3541

3642
$options = array(
3743
CURLOPT_URL => $url,
44+
CURLOPT_NOBODY => false,
3845
CURLOPT_RETURNTRANSFER => true,
3946
CURLOPT_SSL_VERIFYPEER => true,
4047
CURLOPT_SSL_VERIFYHOST => 2,
48+
CURLOPT_SSL_OPTIONS => CURLSSLOPT_NATIVE_CA,
49+
CURLOPT_FOLLOWLOCATION => true,
4150
CURLOPT_HTTPHEADER => $headers,
4251
CURLOPT_CUSTOMREQUEST => $method,
52+
CURLOPT_MAXREDIRS => 10,
4353
CURLOPT_TIMEOUT => 30,
4454
CURLOPT_ENCODING => "",
4555
CURLOPT_CONNECTTIMEOUT => 10,

0 commit comments

Comments
 (0)