From 7642408aca5e619034bfad35dc24a2213822e281 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 15 Jan 2019 14:30:27 +0100 Subject: [dozmod] Re-allow old resources for migration --- modules-available/dozmod/api.inc.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php index 74aaa003..c8139fbb 100644 --- a/modules-available/dozmod/api.inc.php +++ b/modules-available/dozmod/api.inc.php @@ -17,7 +17,7 @@ if (!Module::isAvailable('locations')) { define('LIST_URL', CONFIG_DOZMOD_URL . '/vmchooser/list'); define('VMX_URL', CONFIG_DOZMOD_URL . '/vmchooser/lecture'); -$availableRessources = ['list', 'vmx', 'test', 'netrules', 'runscript', 'netshares']; +$availableRessources = ['list', 'vmx', 'netrules', 'runscript', 'metadata']; /* BEGIN: A simple caching mechanism ---------------------------- */ @@ -216,6 +216,13 @@ function _getVmData($lecture_uuid, $subResource = false) /** Caching wrapper around _getVmData() **/ function outputResource($lecture_uuid, $resource) { + if ($resource === 'metadata') { + // HACK: config.tgz is compressed, don't use gzip output handler + @ob_end_clean(); + Header('Content-Type: application/gzip'); + } else { + Header('Content-Type: text/plain; charset=utf-8'); + } $key = $resource . '_' . $lecture_uuid; if (cache_has($key)) { cache_get_passthru($key); @@ -268,7 +275,8 @@ if ($resource === false) { } if (!in_array($resource, $availableRessources)) { - Util::traceError("unknown resource: $resource"); + Header('HTTP/1.1 400 Bad Request'); + die("unknown resource: $resource"); } $ip = $_SERVER['REMOTE_ADDR']; -- cgit v1.2.3-55-g7522