Forum Feature requests

[PHP] The `--http-timeout` method is missing from wrapper

stephenyeargin
Ran in to a case where we had to append additional properties to make this work. Wanted to propose adding it in so when we need to upgrade, we won't have regressions.

diff --git a/includes/prince-php5/prince.php b/includes/prince-php5/prince.php
index 829b019..7633a09 100644
--- a/includes/prince-php5/prince.php
+++ b/includes/prince-php5/prince.php
@@ -19,6 +19,7 @@ class Prince
     private $httpUser;
     private $httpPassword;
     private $httpProxy;
+    private $httpTimeout;
     private $insecure;
     private $logFile;
     private $fileRoot;
@@ -44,6 +45,7 @@ public function __construct($exePath)
 	$this->httpUser = '';
 	$this->httpPassword = '';
 	$this->httpProxy = '';
+    $this->httpTimeout = '';
 	$this->insecure = false;
 	$this->logFile = '';
 	$this->fileRoot = '';
@@ -181,7 +183,14 @@ public function setHttpProxy($proxy)
     {
     	$this->httpProxy = $proxy;
     }
-    
+
+    //Specify a timeout for the HTTP requests
+    //timeout: The seconds for the timeout.
+    public function setHttpTimeout($timeout)
+    {
+    	$this->httpTimeout = $timeout;
+    }
+
     //Specify whether to disable SSL verification.
     //insecure: If set to true, SSL verification is disabled. (not recommended)
     public function setInsecure($insecure)
@@ -447,7 +456,13 @@ private function getCommandLine()
 	{
 		$cmdline .= '--http-proxy="' . $this->httpProxy . '" ';
 	}
-	
+
+    /** Raven Hack **/
+    if($this->httpTimeout != '')
+	{
+		$cmdline .= '--http-timeout="' . $this->httpTimeout . '" ';
+	}
+
 	if($this->insecure)
 	{
 		$cmdline .= '--insecure ';
mikeday
We have now updated the Prince PHP wrapper to include setHttpTimeout and several other new methods. :)