Author: dreiss
Date: Sun Jul 27 16:41:13 2008
New Revision: 680211

URL: http://svn.apache.org/viewvc?rev=680211&view=rev
Log:
THRIFT-99. php: Add scheme (http[s], etc.) support to THttpClient

Modified:
    incubator/thrift/trunk/lib/php/src/transport/THttpClient.php

Modified: incubator/thrift/trunk/lib/php/src/transport/THttpClient.php
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/php/src/transport/THttpClient.php?rev=680211&r1=680210&r2=680211&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/php/src/transport/THttpClient.php (original)
+++ incubator/thrift/trunk/lib/php/src/transport/THttpClient.php Sun Jul 27 
16:41:13 2008
@@ -41,6 +41,13 @@
   protected $uri_;
 
   /**
+   * The scheme to use for the request, i.e. http, https
+   *
+   * @var string
+   */
+  protected $scheme_;
+
+  /**
    * Buffer for the HTTP request data
    *
    * @var string
@@ -68,10 +75,11 @@
    * @param int    $port
    * @param string $uri
    */
-  public function __construct($host, $port=80, $uri='') {
+  public function __construct($host, $port=80, $uri='', $scheme = 'http') {
     if ((strlen($uri) > 0) && ($uri{0} != '/')) {
       $uri = '/'.$uri;
     }
+    $this->scheme_ = $scheme;
     $this->host_ = $host;
     $this->port_ = $port;
     $this->uri_ = $uri;
@@ -170,7 +178,7 @@
     $this->buf_ = '';
 
     $contextid = stream_context_create(array('http' => $options));
-    $this->handle_ = @fopen('http://'.$host.$this->uri_, 'r', false, 
$contextid);
+    $this->handle_ = @fopen($this->scheme_.'://'.$host.$this->uri_, 'r', 
false, $contextid);
 
     // Connect failed?
     if ($this->handle_ === FALSE) {


Reply via email to