Skip to content

Commit 79885b6

Browse files
authored
update curl to use HTTP/1.1 protocol (#311)
Update the `curl_opts` to use HTTP/1.1 instead of HTTP/2
1 parent 663614c commit 79885b6

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Diff for: src/Vimeo/Vimeo.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,14 @@ public function uploadTexttrack($texttracks_uri, $file_path, $track_type, $langu
477477

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

480-
$texttrack_resource = fopen($file_path, 'r');
480+
$handle = fopen($file_path, 'r');
481+
$texttrack_resource = fread($handle, filesize($file_path));
481482

482483
$curl_opts = array(
483484
CURLOPT_TIMEOUT => 240,
484-
CURLOPT_UPLOAD => true,
485485
CURLOPT_CUSTOMREQUEST => 'PUT',
486-
CURLOPT_READDATA => $texttrack_resource
486+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
487+
CURLOPT_POSTFIELDS => $texttrack_resource
487488
);
488489

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

501502
curl_close($curl);
502-
503+
fclose($handle);
504+
503505
if ($curl_info['http_code'] !== 200) {
504506
throw new VimeoUploadException($response);
505507
}

0 commit comments

Comments
 (0)