Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
ee066371
Commit
ee066371
authored
9 years ago
by
Michael Lumish
Browse files
Options
Downloads
Plain Diff
Merge pull request #1839 from jcanizales/fix-certs-bundle
Fix problem loading certs for tests of library projects
parents
273f80b4
f1c368c0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/objective-c/GRPCClient/private/GRPCSecureChannel.m
+11
-7
11 additions, 7 deletions
src/objective-c/GRPCClient/private/GRPCSecureChannel.m
with
11 additions
and
7 deletions
src/objective-c/GRPCClient/private/GRPCSecureChannel.m
+
11
−
7
View file @
ee066371
...
...
@@ -38,13 +38,17 @@
@implementation
GRPCSecureChannel
-
(
instancetype
)
initWithHost
:(
NSString
*
)
host
{
// TODO(jcanizales): Load certs only once.
NSURL
*
certsURL
=
[[
NSBundle
mainBundle
]
URLForResource
:
@"gRPC.bundle/roots"
withExtension
:
@"pem"
];
NSData
*
certsData
=
[
NSData
dataWithContentsOfURL
:
certsURL
];
NSString
*
certsString
=
[[
NSString
alloc
]
initWithData
:
certsData
encoding
:
NSUTF8StringEncoding
];
grpc_credentials
*
credentials
=
grpc_ssl_credentials_create
(
certsString
.
UTF8String
,
NULL
);
return
(
self
=
[
super
initWithChannel
:
grpc_secure_channel_create
(
credentials
,
static
const
grpc_credentials
*
kCredentials
;
static
dispatch_once_t
loading
;
dispatch_once
(
&
loading
,
^
{
// Do not use NSBundle.mainBundle, as it's nil for tests of library projects.
NSBundle
*
bundle
=
[
NSBundle
bundleForClass
:
self
.
class
];
NSString
*
certsPath
=
[
bundle
pathForResource
:
@"gRPC.bundle/roots"
ofType
:
@"pem"
];
NSData
*
certsData
=
[
NSData
dataWithContentsOfFile
:
certsPath
];
NSString
*
certsString
=
[[
NSString
alloc
]
initWithData
:
certsData
encoding
:
NSUTF8StringEncoding
];
kCredentials
=
grpc_ssl_credentials_create
(
certsString
.
UTF8String
,
NULL
);
});
return
(
self
=
[
super
initWithChannel
:
grpc_secure_channel_create
(
kCredentials
,
host
.
UTF8String
,
NULL
)]);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment