Author: chabotc
Date: Tue Nov 18 22:54:29 2008
New Revision: 718866

URL: http://svn.apache.org/viewvc?rev=718866&view=rev
Log:
SHINDIG-674 fix by Eiji Kitamura, fixes feed fetching breaking on blogspot.com 
redirects

Modified:
    incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php

Modified: 
incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php
URL: 
http://svn.apache.org/viewvc/incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php?rev=718866&r1=718865&r2=718866&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php 
(original)
+++ incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php 
Tue Nov 18 22:54:29 2008
@@ -18,12 +18,13 @@
  * 
  */
 
-/*
+
+/**
  * Basic remote content fetcher, uses curl_multi to fetch multiple resources 
at the same time
  */
-
 class BasicRemoteContentFetcher extends RemoteContentFetcher {
        private $requests = array();
+       private $USER_AGENT =  'Shindig PHP';
 
        public function fetchRequest($request)
        {
@@ -48,11 +49,12 @@
                                if (strpos($header, ':')) {
                                        $key = trim(substr($header, 0, 
strpos($header, ':')));
                                        $val = trim(substr($header, 
strpos($header, ':') + 1));
-                                       if (strcasecmp($key, 
"Transfer-Encoding") != 0 && strcasecmp($key, "Cache-Control") != 0 && 
strcasecmp($key, "Expires") != 0 && strcasecmp($key, "Content-Length") != 0) {
+                                       if (strcmp($key, "User-Agent") != 0 && 
strcasecmp($key, "Transfer-Encoding") != 0 && strcasecmp($key, "Cache-Control") 
!= 0 && strcasecmp($key, "Expires") != 0 && strcasecmp($key, "Content-Length") 
!= 0) {
                                                $outHeaders[] = "$key: $val";
                                        }
                                }
                        }
+                       $outHeaders[] = "User-Agent: " . $this->USER_AGENT;
                        curl_setopt($request->handle, CURLOPT_HTTPHEADER, 
$outHeaders);
                }
                if ($request->isPost()) {
@@ -111,12 +113,12 @@
                                        if (strpos($header, ':')) {
                                                $key = trim(substr($header, 0, 
strpos($header, ':')));
                                                $val = trim(substr($header, 
strpos($header, ':') + 1));
-                                               if (strcasecmp($key, 
"Transfer-Encoding") != 0 && strcasecmp($key, "Cache-Control") != 0 && 
strcasecmp($key, "Expires") != 0 && strcasecmp($key, "Content-Length") != 0) {
+                                               if (strcmp($key, "User-Agent") 
!= 0 && strcasecmp($key, "Transfer-Encoding") != 0 && strcasecmp($key, 
"Cache-Control") != 0 && strcasecmp($key, "Expires") != 0 && strcasecmp($key, 
"Content-Length") != 0) {
                                                        $outHeaders[] = "$key: 
$val";
                                                }
                                        }
                                }
-                               $outHeaders[] = "User-Agent: Shindig PHP";
+                               $outHeaders[] = "User-Agent: " . 
$this->USER_AGENT;
                                curl_setopt($request->handle, 
CURLOPT_HTTPHEADER, $outHeaders);
                        }
                        if ($request->isPost()) {


Reply via email to