Commit df7b6b94 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1221 Make sure authentication during OPTIONS request is done after

processing all headers and converting charset encodings.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 0ee4231e
...@@ -55,17 +55,17 @@ include_once(ZPUSH_CONFIG); ...@@ -55,17 +55,17 @@ include_once(ZPUSH_CONFIG);
if (! Request::HasAuthenticationInfo() || !Request::GetGETUser()) if (! Request::HasAuthenticationInfo() || !Request::GetGETUser())
throw new AuthenticationRequiredException("Access denied. Please send authorisation information"); throw new AuthenticationRequiredException("Access denied. Please send authorisation information");
ZPush::CheckAdvancedConfig();
// Process request headers and look for AS headers
Request::ProcessHeaders();
// Stop here if this is an OPTIONS request // Stop here if this is an OPTIONS request
if (Request::IsMethodOPTIONS()) { if (Request::IsMethodOPTIONS()) {
RequestProcessor::Authenticate(); RequestProcessor::Authenticate();
throw new NoPostRequestException("Options request", NoPostRequestException::OPTIONS_REQUEST); throw new NoPostRequestException("Options request", NoPostRequestException::OPTIONS_REQUEST);
} }
ZPush::CheckAdvancedConfig();
// Process request headers and look for AS headers
Request::ProcessHeaders();
// Check required GET parameters // Check required GET parameters
if(Request::IsMethodPOST() && (Request::GetCommandCode() === false || !Request::GetDeviceID() || !Request::GetDeviceType())) if(Request::IsMethodPOST() && (Request::GetCommandCode() === false || !Request::GetDeviceID() || !Request::GetDeviceType()))
throw new FatalException("Requested the Z-Push URL without the required GET parameters"); throw new FatalException("Requested the Z-Push URL without the required GET parameters");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment