Skip to content
Snippets Groups Projects
Commit be303e12 authored by Jorge Canizales's avatar Jorge Canizales
Browse files

Add user agent of the library to that of the app.

parent 20b79e70
No related branches found
No related tags found
No related merge requests found
...@@ -40,6 +40,10 @@ ...@@ -40,6 +40,10 @@
#import "GRPCCompletionQueue.h" #import "GRPCCompletionQueue.h"
#import "NSDictionary+GRPC.h" #import "NSDictionary+GRPC.h"
// TODO(jcanizales): Generate the version in a standalone header, from templates. Like
// templates/src/core/surface/version.c.template .
#define GRPC_OBJC_VERSION_STRING @"0.13.0"
@interface GRPCHost () @interface GRPCHost ()
// TODO(mlumish): Investigate whether caching channels with strong links is a good idea. // TODO(mlumish): Investigate whether caching channels with strong links is a good idea.
@property(nonatomic, strong) GRPCChannel *channel; @property(nonatomic, strong) GRPCChannel *channel;
...@@ -109,9 +113,14 @@ ...@@ -109,9 +113,14 @@
if (!_channel) { if (!_channel) {
NSMutableDictionary *args = [NSMutableDictionary dictionary]; NSMutableDictionary *args = [NSMutableDictionary dictionary];
// TODO(jcanizales): Add OS and device information (see
// https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md#user-agents ).
NSString *userAgent = @"grpc-objc/" GRPC_OBJC_VERSION_STRING;
if (_userAgentPrefix) { if (_userAgentPrefix) {
args[@GRPC_ARG_PRIMARY_USER_AGENT_STRING] = _userAgentPrefix; userAgent = [@[_userAgentPrefix, userAgent] componentsJoinedByString:@" "];
} }
args[@GRPC_ARG_PRIMARY_USER_AGENT_STRING] = userAgent;
if (_secure) { if (_secure) {
if (_hostNameOverride) { if (_hostNameOverride) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment