diff --git a/wp-mat.php b/wp-mat.php index af56c19678d4b7029ed7db8a0be718ae80905ecc..0f61ed62e711f35546e9460507622986f48d64dc 100644 --- a/wp-mat.php +++ b/wp-mat.php @@ -3,7 +3,7 @@ * Plugin Name: wp-mat * Plugin URI: https://git.autistici.org/noblogs/wp-mat * Description: Process uploaded files through MAT - * Version: 0.1.2 + * Version: 0.1.4 * Author: Autistici/Inventati * Author URI: https://www.autistici.org/ * License: MIT @@ -38,7 +38,8 @@ class WP_Mat { } // Make a POST request to the MAT service with the uploaded file and - // store the results into '$output_path'. + // store the results into '$output_path'. Returns true on success, + // false on any error. function issue_cleanup_request($path, $mimetype, $output_path) { $upfile = new CURLFile($path, $mimetype, 'input'); @@ -59,6 +60,16 @@ class WP_Mat { $ret = curl_exec($curl); + if ($ret === false) { + error_log("wp-mat: curl error: ".curl_error($curl)); + } else { + $status = curl_getinfo($curl, CURLINFO_HTTP_CODE); + if ($status != 200) { + error_log("wp-mat: curl error: server returned HTTP status ".$status); + $ret = false; + } + } + fclose($fp); curl_close($curl);