Diff

mod_http_upload_external/share_v2.php @ 3163:31b85864a615

share_v2.php: Add error logging
author Matthew Wild <mwild1@gmail.com>
date Mon, 02 Jul 2018 12:55:59 +0100
parent 3162:3797be8f491f
child 3164:5176b8d81ec7
line wrap: on
line diff
--- a/mod_http_upload_external/share_v2.php	Mon Jul 02 12:55:43 2018 +0100
+++ b/mod_http_upload_external/share_v2.php	Mon Jul 02 12:55:59 2018 +0100
@@ -71,6 +71,7 @@
 $request_method = $_SERVER['REQUEST_METHOD'];
 
 if(array_key_exists('v2', $_GET) === TRUE && $request_method === 'PUT') {
+	error_log(var_export($_SERVER, TRUE));
 	$upload_file_size = $_SERVER['CONTENT_LENGTH'];
 	$upload_token = $_GET['v2'];
 
@@ -89,12 +90,14 @@
 	$calculated_token = hash_hmac('sha256', "$upload_file_name\0$upload_file_size\0$upload_file_type", $CONFIG_SECRET);
 	if(function_exists('hash_equals')) {
 		if(hash_equals($calculated_token, $upload_token) !== TRUE) {
+			error_log("Token mismatch: calculated $calculated_token got $upload_token");
 			header('HTTP/1.0 403 Forbidden');
 			exit;
 		}
 	}
 	else {
 		if($upload_token !== $calculated_token) {
+			error_log("Token mismatch: calculated $calculated_token got $upload_token");
 			header('HTTP/1.0 403 Forbidden');
 			exit;
 		}