From ed9eebe95b8a7526a23a69209070bca7dd02d296 Mon Sep 17 00:00:00 2001 From: Olav Morken <olav.morken@uninett.no> Date: Thu, 22 Jul 2010 08:48:53 +0000 Subject: [PATCH] SAML2_Binding: Proper check for content type. In r2423, I committed an incomplete fix. This is the proper fix. git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@2429 44740490-163a-0410-bde0-09ae8108e29a --- lib/SAML2/Binding.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/SAML2/Binding.php b/lib/SAML2/Binding.php index 93c15a56f..1e05ee46b 100644 --- a/lib/SAML2/Binding.php +++ b/lib/SAML2/Binding.php @@ -61,19 +61,21 @@ abstract class SAML2_Binding { break; case 'POST': + if (isset($_SERVER['CONTENT_TYPE'])) { + $contentType = $_SERVER['CONTENT_TYPE']; + $contentType = explode(';', $contentType); + $contentType = $contentType[0]; /* Remove charset. */ + } else { + $contentType = NULL; + } if (array_key_exists('SAMLRequest', $_REQUEST) || array_key_exists('SAMLResponse', $_REQUEST)) { return new SAML2_HTTPPost(); - } elseif (array_key_exists('CONTENT_TYPE', $_SERVER) && substr($_SERVER['CONTENT_TYPE'], 0, 8) === 'text/xml'){ + } elseif ($contentType === 'text/xml') { return new SAML2_SOAP(); } break; } - $s = var_export($_SERVER, TRUE); - foreach (explode("\n", $s) as $l) { - error_log($l); - } - throw new Exception('Unable to find the current binding.'); } -- GitLab