Skip to content

Commit

Permalink
update curl to use HTTP/1.1 protocol (#311)
Browse files Browse the repository at this point in the history
Update the `curl_opts` to use HTTP/1.1 instead of HTTP/2
  • Loading branch information
Sventour authored Feb 18, 2022
1 parent 663614c commit 79885b6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/Vimeo/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,14 @@ public function uploadTexttrack($texttracks_uri, $file_path, $track_type, $langu

$upload_url = $texttrack_response['body']['link'];

$texttrack_resource = fopen($file_path, 'r');
$handle = fopen($file_path, 'r');
$texttrack_resource = fread($handle, filesize($file_path));

$curl_opts = array(
CURLOPT_TIMEOUT => 240,
CURLOPT_UPLOAD => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_READDATA => $texttrack_resource
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_POSTFIELDS => $texttrack_resource
);

$curl = curl_init($upload_url);
Expand All @@ -499,7 +500,8 @@ public function uploadTexttrack($texttracks_uri, $file_path, $track_type, $langu
}

curl_close($curl);

fclose($handle);

if ($curl_info['http_code'] !== 200) {
throw new VimeoUploadException($response);
}
Expand Down

0 comments on commit 79885b6

Please sign in to comment.