From d6aec92545b1e6cfecb3373976fd76d0cae94768 Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Wed, 11 Aug 2021 12:09:01 +0100 Subject: [PATCH] tests --- src/core/init/responder.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/core/init/responder.php b/src/core/init/responder.php index bc3558d..eac67f7 100644 --- a/src/core/init/responder.php +++ b/src/core/init/responder.php @@ -20,6 +20,11 @@ class Responder { // Send json encoded response echo json_encode($response, true); break; + case "ms-json": + header('Content-Type: application/json'); + // Send json encoded response + echo json_encode($response->content, true); + break; case "xml": header('Content-Type: application/xml'); include ($response->content); @@ -44,7 +49,8 @@ class Responder { case "Autodiscover/Autodiscover.xml": $resp = $this->ms_autodiscover(); break; - case "/autodiscover/autodiscover.json": //?Email=psw%40wilde.cloud&Protocol=Autodiscoverv1&RedirectCount=1" + case "autodiscover/autodiscover.json": //?Email=psw%40wilde.cloud&Protocol=Autodiscoverv1&RedirectCount=1" + case "Autodiscover/Autodiscover.json": $resp = $this->ms_autodiscover_json(); break; case "none": @@ -85,8 +91,10 @@ class Responder { } private function ms_autodiscover_json(){ $response = new Response(); - $response->content_type = "xml"; - $response->content = "public/autodiscover.php"; + $response->content_type = "ms-json"; + $response->content = new MSAutodiscoverJSONResponse(); + $response->content->Protocol = "AutodiscoverV1"; + $response->content->Protocol = "https://" . $_SERVER['HTTP_HOST'] . "/Autodiscover/Autodiscover.xml"; return $response; } private function dummy_response(){ @@ -121,3 +129,7 @@ class Response { } } +class MSAutodiscoverJSONResponse { + public $Protocol; + public $Url; +}