Author: chabotc
Date: Mon Feb 23 14:35:30 2009
New Revision: 747029

URL: http://svn.apache.org/viewvc?rev=747029&view=rev
Log:
Don't use the client's headers to make a proxied request, since the resulting 
object will be cached and re-used for everyone, so the language, content 
encoding etc might screw things up... I *think* that's the right approach but 
please let me know if it breaks anything for you

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

Modified: incubator/shindig/trunk/php/src/gadgets/ProxyBase.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/gadgets/ProxyBase.php?rev=747029&r1=747028&r2=747029&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/gadgets/ProxyBase.php (original)
+++ incubator/shindig/trunk/php/src/gadgets/ProxyBase.php Mon Feb 23 14:35:30 
2009
@@ -23,7 +23,7 @@
  */
 class ProxyBase {
   public $context;
-  protected $disallowedHeaders = array('Keep-Alive', 'Host', 
'Accept-Encoding', 'Set-Cookie', 'Content-Length', 'Content-Encoding', 'ETag', 
'Last-Modified', 'Accept-Ranges', 'Vary', 'Expires', 'Date', 'Pragma', 
'Cache-Control', 'Transfer-Encoding', 'If-Modified-Since');
+  protected $disallowedHeaders = array('User-Agent', 'Keep-Alive', 'Host', 
'Accept-Encoding', 'Set-Cookie', 'Content-Length', 'Content-Encoding', 'ETag', 
'Last-Modified', 'Accept-Ranges', 'Vary', 'Expires', 'Date', 'Pragma', 
'Cache-Control', 'Transfer-Encoding', 'If-Modified-Since');
 
   public function __construct($context) {
     $this->context = $context;
@@ -47,15 +47,6 @@
         throw new Exception("Invalid protocol specified in url: " . 
htmlentities($protocol));
       }
     }
-    $headers = '';
-    $requestHeaders = $this->request_headers();
-    foreach ($requestHeaders as $key => $val) {
-      $key = str_replace(' ', '-', ucwords(str_replace('-', ' ', $key))); // 
force the header name to have the proper Header-Name casing
-      if (! in_array($key, $this->disallowedHeaders)) {
-        // propper curl header format according to 
http://www.php.net/manual/en/function.curl-setopt.php#80099
-        $headers .= "$key: $val\n";
-      }
-    }
     if ($method == 'POST') {
       $data = isset($_GET['postData']) ? $_GET['postData'] : false;
       if (! $data) {
@@ -79,10 +70,10 @@
       }
       // even if postData is an empty string, it will still post (since 
RemoteContentRquest checks if its false)
       // so the request to POST is still honored
-      $request = new RemoteContentRequest($url, $headers, $postData);
+      $request = new RemoteContentRequest($url, null, $postData);
       $request = $this->context->getHttpFetcher()->fetch($request, 
$this->context);
     } else {
-      $request = new RemoteContentRequest($url, $headers);
+      $request = new RemoteContentRequest($url);
       $request = $this->context->getHttpFetcher()->fetch($request, 
$this->context);
     }
     return $request;


Reply via email to