You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by ch...@apache.org on 2009/09/22 12:57:32 UTC

svn commit: r817597 - in /incubator/shindig/trunk/php/src/gadgets: MakeRequestOptions.php ProxyBase.php

Author: chabotc
Date: Tue Sep 22 10:57:31 2009
New Revision: 817597

URL: http://svn.apache.org/viewvc?rev=817597&view=rev
Log:
SHINDIG-1174 by Arne Roomann-Kurrik - Fix ProxyHandler to configure MakeRequest correctly

Modified:
    incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php
    incubator/shindig/trunk/php/src/gadgets/ProxyBase.php

Modified: incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php?rev=817597&r1=817596&r2=817597&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/MakeRequestOptions.php Tue Sep 22 10:57:31 2009
@@ -102,14 +102,11 @@
    *     array.
    */
   private function assertParameterIsOneOf($param, $values) {
-  	if (empty($param)) {
-  		return;
-  	}
     if (is_string($param)) {
       $param = strtoupper($param);
     }
     if (!in_array($param, $values)) {
-      throw new MakeRequestParameterException($param . " parameter must be one of " . implode(', ', $values));
+      throw new MakeRequestParameterException("Got an invalid value, was expecting one of " . implode(', ', $values));
     }
     return $param;
   }

Modified: incubator/shindig/trunk/php/src/gadgets/ProxyBase.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ProxyBase.php?rev=817597&r1=817596&r2=817597&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ProxyBase.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ProxyBase.php Tue Sep 22 10:57:31 2009
@@ -29,9 +29,13 @@
    */
   public $context;
 
-  public function __construct($context) {
+  public function __construct($context, MakeRequest $makeRequest = null) {
     $this->context = $context;
-    $this->makeRequest = new MakeRequest();
+    if (isset($makeRequest)) {
+      $this->makeRequest = $makeRequest;
+    } else {
+      $this->makeRequest = new MakeRequest();
+    }
   }
 
   /**
@@ -46,8 +50,8 @@
     // TODO: Check to see if we can just use MakeRequestOptions::fromCurrentRequest
     $st = isset($_GET['st']) ? $_GET['st'] : (isset($_POST['st']) ? $_POST['st'] : false);
     $body = isset($_GET['postData']) ? $_GET['postData'] : (isset($_POST['postData']) ? $_POST['postData'] : false);
-    $authz = isset($_GET['authz']) ? $_GET['authz'] : (isset($_POST['authz']) ? $_POST['authz'] : '');
-    $headers = isset($_GET['headers']) ? $_GET['headers'] : (isset($_POST['headers']) ? $_POST['headers'] : '');
+    $authz = isset($_GET['authz']) ? $_GET['authz'] : (isset($_POST['authz']) ? $_POST['authz'] : null);
+    $headers = isset($_GET['headers']) ? $_GET['headers'] : (isset($_POST['headers']) ? $_POST['headers'] : null);
     $params = new MakeRequestOptions($url);
     $params->setSecurityTokenString($st)
       ->setAuthz($authz)