Skip to content

Commit 33d79da

Browse files
authored
fix: updating client to only use http and https (#867)
1 parent b9c2b44 commit 33d79da

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Twilio/Http/CurlClient.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function options(string $method, string $url,
9696
CURLOPT_INFILESIZE => Null,
9797
CURLOPT_HTTPHEADER => [],
9898
CURLOPT_TIMEOUT => $timeout,
99+
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP
99100
];
100101

101102
foreach ($headers as $key => $value) {

tests/Twilio/Unit/Http/CurlClientTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66

77
use Twilio\AuthStrategy\NoAuthStrategy;
8+
use Twilio\Exceptions\EnvironmentException;
89
use Twilio\Http\CurlClient;
910
use Twilio\Http\File;
1011
use Twilio\Values;
@@ -356,4 +357,12 @@ public function userInjectedOptionsProvider(): array {
356357
],
357358
];
358359
}
360+
361+
public function testFileProtocolThrowsException(): void {
362+
$this->expectException(EnvironmentException::class);
363+
$this->expectExceptionMessage('Protocol "file" not supported or disabled in libcurl');
364+
365+
$client = new CurlClient();
366+
$client->request('GET', 'file:///tmp/test-file');
367+
}
359368
}

0 commit comments

Comments
 (0)