aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c/GRPCClient/private
diff options
context:
space:
mode:
authorGravatar thassss <tommy@vsco.co>2017-06-26 13:34:40 -0700
committerGravatar thassss <tommy@vsco.co>2017-06-26 13:34:40 -0700
commita139bfdc4c8c785e05dc6e8ac8ccbd50a92b2f89 (patch)
treeac2322fc2b0bb0b6bcd523c9daf4e7b468e6a220 /src/objective-c/GRPCClient/private
parent8bec6a93163861e467005a23c997eb93b793710b (diff)
Expose :authority pseudo-header to Obj-C API.
Diffstat (limited to 'src/objective-c/GRPCClient/private')
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannel.h1
-rw-r--r--src/objective-c/GRPCClient/private/GRPCChannel.m5
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.h1
-rw-r--r--src/objective-c/GRPCClient/private/GRPCHost.m4
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.h1
-rw-r--r--src/objective-c/GRPCClient/private/GRPCWrappedCall.m5
6 files changed, 13 insertions, 4 deletions
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h
index e4dfbca38d..e2aa5bd036 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannel.h
+++ b/src/objective-c/GRPCClient/private/GRPCChannel.h
@@ -62,5 +62,6 @@ struct grpc_channel_credentials;
channelArgs:(nullable NSDictionary *)channelArgs;
- (nullable grpc_call *)unmanagedCallWithPath:(nonnull NSString *)path
+ serverName:(nonnull NSString *)serverName
completionQueue:(nonnull GRPCCompletionQueue *)queue;
@end
diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m
index ca494d5ff2..690fad2596 100644
--- a/src/objective-c/GRPCClient/private/GRPCChannel.m
+++ b/src/objective-c/GRPCClient/private/GRPCChannel.m
@@ -181,14 +181,17 @@ static grpc_channel_args *BuildChannelArgs(NSDictionary *dictionary) {
}
- (grpc_call *)unmanagedCallWithPath:(NSString *)path
+ serverName:(NSString *)serverName
completionQueue:(GRPCCompletionQueue *)queue {
+ grpc_slice host_slice = grpc_slice_from_copied_string(serverName.UTF8String);
grpc_slice path_slice = grpc_slice_from_copied_string(path.UTF8String);
grpc_call *call = grpc_channel_create_call(_unmanagedChannel,
NULL, GRPC_PROPAGATE_DEFAULTS,
queue.unmanagedQueue,
path_slice,
- NULL, // Passing NULL for host
+ &host_slice,
gpr_inf_future(GPR_CLOCK_REALTIME), NULL);
+ grpc_slice_unref(host_slice);
grpc_slice_unref(path_slice);
return call;
}
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.h b/src/objective-c/GRPCClient/private/GRPCHost.h
index 4b1f780dd2..bb68fa3ec4 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.h
+++ b/src/objective-c/GRPCClient/private/GRPCHost.h
@@ -54,6 +54,7 @@ struct grpc_channel_credentials;
/** Create a grpc_call object to the provided path on this host. */
- (nullable struct grpc_call *)unmanagedCallWithPath:(NSString *)path
+ serverName:(nullable NSString *)serverName
completionQueue:(GRPCCompletionQueue *)queue;
// TODO: There's a race when a new RPC is coming through just as an existing one is getting
diff --git a/src/objective-c/GRPCClient/private/GRPCHost.m b/src/objective-c/GRPCClient/private/GRPCHost.m
index 5b4d647a1a..5658150b33 100644
--- a/src/objective-c/GRPCClient/private/GRPCHost.m
+++ b/src/objective-c/GRPCClient/private/GRPCHost.m
@@ -120,6 +120,7 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil;
}
- (nullable grpc_call *)unmanagedCallWithPath:(NSString *)path
+ serverName:(nullable NSString *)serverName
completionQueue:(GRPCCompletionQueue *)queue {
GRPCChannel *channel;
// This is racing -[GRPCHost disconnect].
@@ -129,7 +130,8 @@ static GRPCConnectivityMonitor *connectivityMonitor = nil;
}
channel = _channel;
}
- return [channel unmanagedCallWithPath:path completionQueue:queue];
+ NSString *name = serverName ? serverName : _address;
+ return [channel unmanagedCallWithPath:path serverName:name completionQueue:queue];
}
- (BOOL)setTLSPEMRootCerts:(nullable NSString *)pemRootCerts
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h
index ed245ff7ed..e24d246912 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.h
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.h
@@ -75,6 +75,7 @@
@interface GRPCWrappedCall : NSObject
- (instancetype)initWithHost:(NSString *)host
+ serverName:(nullable NSString *)serverName
path:(NSString *)path NS_DESIGNATED_INITIALIZER;
- (void)startBatchWithOperations:(NSArray *)ops errorHandler:(void(^)())errorHandler;
diff --git a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
index 8c8b0b2570..2d98f70899 100644
--- a/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
+++ b/src/objective-c/GRPCClient/private/GRPCWrappedCall.m
@@ -232,10 +232,11 @@
}
- (instancetype)init {
- return [self initWithHost:nil path:nil];
+ return [self initWithHost:nil serverName:nil path:nil];
}
- (instancetype)initWithHost:(NSString *)host
+ serverName:(nullable NSString *)serverName
path:(NSString *)path {
if (!path || !host) {
[NSException raise:NSInvalidArgumentException
@@ -248,7 +249,7 @@
// queue. Currently we use a singleton queue.
_queue = [GRPCCompletionQueue completionQueue];
- _call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path completionQueue:_queue];
+ _call = [[GRPCHost hostWithAddress:host] unmanagedCallWithPath:path serverName:serverName completionQueue:_queue];
if (_call == NULL) {
return nil;
}