aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/php/lib
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-09-07 08:39:05 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-09-07 08:39:05 -0700
commit344834b40b10a646b73f2484114f338512490cf0 (patch)
tree1561c2f2d2bdf5c6c52cfdfc80c1aa98a6a4b242 /src/php/lib
parent78dc25e86b090c7fa26e77ce6521a30002d150be (diff)
parente0321637d798fdeb21e79c376f1c26298764cac4 (diff)
Merge github.com:grpc/grpc into grand-unified-closures
Diffstat (limited to 'src/php/lib')
-rw-r--r--src/php/lib/Grpc/BaseStub.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/php/lib/Grpc/BaseStub.php b/src/php/lib/Grpc/BaseStub.php
index 2fec1bd9cc..d850eebc78 100644
--- a/src/php/lib/Grpc/BaseStub.php
+++ b/src/php/lib/Grpc/BaseStub.php
@@ -41,6 +41,7 @@ namespace Grpc;
class BaseStub
{
private $hostname;
+ private $hostname_override;
private $channel;
// a callback function
@@ -75,6 +76,9 @@ class BaseStub
} else {
$opts['grpc.primary_user_agent'] = '';
}
+ if (!empty($opts['grpc.ssl_target_name_override'])) {
+ $this->hostname_override = $opts['grpc.ssl_target_name_override'];
+ }
$opts['grpc.primary_user_agent'] .=
'grpc-php/'.$package_config['version'];
if (!array_key_exists('credentials', $opts)) {
@@ -173,7 +177,12 @@ class BaseStub
}
$service_name = substr($method, 0, $last_slash_idx);
- return 'https://'.$this->hostname.$service_name;
+ if ($this->hostname_override) {
+ $hostname = $this->hostname_override;
+ } else {
+ $hostname = $this->hostname;
+ }
+ return 'https://'.$hostname.$service_name;
}
/**