Changeset

4310:b0ad1604f77e

mod_http_upload_external: update php scripts to return HTTP 201 Created on upload
author Richard Schwab <hgprosodyim-lawrpxz9uw@central-intelligence.agency>
date Mon, 21 Dec 2020 19:29:04 +0100
parents 4309:e8b9228b5265
children 4311:a6c253bc63a5
files mod_http_upload_external/share.php mod_http_upload_external/share_v2.php
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_upload_external/share.php	Wed Dec 16 22:07:09 2020 +0100
+++ b/mod_http_upload_external/share.php	Mon Dec 21 19:29:04 2020 +0100
@@ -113,6 +113,11 @@
 	/* Close the streams */
 	fclose($incoming_data);
 	fclose($store_file);
+
+	// https://xmpp.org/extensions/xep-0363.html#upload
+	// A HTTP status Code of 201 means that the server is now ready to serve the file via the provided GET URL.
+	header('HTTP/1.0 201 Created');
+	exit;
 } else if($request_method === 'GET' || $request_method === 'HEAD') {
 	// Send file (using X-Sendfile would be nice here...)
 	if(file_exists($store_file_name)) {
--- a/mod_http_upload_external/share_v2.php	Wed Dec 16 22:07:09 2020 +0100
+++ b/mod_http_upload_external/share_v2.php	Mon Dec 21 19:29:04 2020 +0100
@@ -128,6 +128,11 @@
 	fclose($incoming_data);
 	fclose($store_file);
 	file_put_contents($store_file_name.'-type', $upload_file_type);
+
+	// https://xmpp.org/extensions/xep-0363.html#upload
+	// A HTTP status Code of 201 means that the server is now ready to serve the file via the provided GET URL.
+	header('HTTP/1.0 201 Created');
+	exit;
 } else if($request_method === 'GET' || $request_method === 'HEAD') {
 	// Send file (using X-Sendfile would be nice here...)
 	if(file_exists($store_file_name)) {