You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shindig.apache.org by li...@apache.org on 2010/02/02 01:45:58 UTC

svn commit: r905479 - in /incubator/shindig/trunk/php: config/container.php src/common/sample/BasicRemoteContentFetcher.php

Author: lindner
Date: Tue Feb  2 00:45:57 2010
New Revision: 905479

URL: http://svn.apache.org/viewvc?rev=905479&view=rev
Log:
SHINDIG-1245 | Patch from Johan Euphrosine | BasicRemoteContentFetcher timeout should not return a 404 empty page

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

Modified: incubator/shindig/trunk/php/config/container.php
URL: http://svn.apache.org/viewvc/incubator/shindig/trunk/php/config/container.php?rev=905479&r1=905478&r2=905479&view=diff
==============================================================================
--- incubator/shindig/trunk/php/config/container.php (original)
+++ incubator/shindig/trunk/php/config/container.php Tue Feb  2 00:45:57 2010
@@ -161,6 +161,7 @@
   // connection timeout setting for all curl requests, set this time something low if you want errors reported
   // quicker to the end user, and high (between 10 and 20) if your on a slow connection
   'curl_connection_timeout' => '10',
+  'curl_request_timeout' => '10',
 
   // If your development server is behind a proxy, enter the proxy details here in 'proxy.host.com:port' format.
   'proxy' => '',

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=905479&r1=905478&r2=905479&view=diff
==============================================================================
--- incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php (original)
+++ incubator/shindig/trunk/php/src/common/sample/BasicRemoteContentFetcher.php Tue Feb  2 00:45:57 2010
@@ -127,6 +127,12 @@
     if (! $httpCode) {
       $httpCode = '404';
     }
+
+    if (curl_errno($request->handle)) {
+      $httpCode = '500';
+      $body = 'Curl error: ' . curl_error($request->handle);
+    }   
+
     $request->setHttpCode($httpCode);
     $request->setHttpCodeMsg($this->resolveHttpCode($httpCode));
     $request->setContentType($contentType);
@@ -239,7 +245,7 @@
     curl_setopt($handle, CURLOPT_AUTOREFERER, 1);
     curl_setopt($handle, CURLOPT_MAXREDIRS, 10);
     curl_setopt($handle, CURLOPT_CONNECTTIMEOUT, Config::get('curl_connection_timeout'));
-    curl_setopt($handle, CURLOPT_TIMEOUT, Config::get('curl_connection_timeout'));
+    curl_setopt($handle, CURLOPT_TIMEOUT, Config::get('curl_request_timeout'));
     curl_setopt($handle, CURLOPT_HEADER, 1);
     curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, 0);
     $proxy = Config::get('proxy');