Author: chabotc
Date: Wed Oct 15 16:57:35 2008
New Revision: 705100

URL: http://svn.apache.org/viewvc?rev=705100&view=rev
Log:
Small cleanup to the metadata interface: urldecode the request string, and give 
higher priority to the post['request'] var (in case someone has 
always_populate_raw_post turned on in their php.ini)

Modified:
    incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php

Modified: incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php?rev=705100&r1=705099&r2=705100&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php 
(original)
+++ incubator/shindig/trunk/php/src/gadgets/servlet/MetadataServlet.php Wed Oct 
15 16:57:35 2008
@@ -58,13 +58,13 @@
                        // we support both a raw http post (without 
application/x-www-form-urlencoded headers) like java does
                        // and a more php / curl safe version of a form post 
with 'request' as the post field that holds the request json data
                        if (isset($GLOBALS['HTTP_RAW_POST_DATA']) || 
isset($_POST['request'])) {
-                               $requestParam = 
isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : 
$_POST['request'];
+                               $requestParam = 
urldecode(isset($_POST['request']) ? $_POST['request'] : 
$GLOBALS['HTTP_RAW_POST_DATA']);
                                if (get_magic_quotes_gpc()) {
                                        $requestParam = 
stripslashes($requestParam);
                                }
                                $request = json_decode($requestParam);
-                               if ($request == 
(isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : 
$_POST['request'])) {
-                                       throw new Exception("Malformed json 
string");
+                               if ($request == $requestParam) {
+                                       throw new Exception("Malformed json 
string: $requestParam");
                                }
                                $handler = new MetadataHandler();
                                $response = $handler->process($request);


Reply via email to