Skip to content

Commit

Permalink
Merge pull request grpc#3969 from grpc/release-0_11
Browse files Browse the repository at this point in the history
Release 0 11 -> master
  • Loading branch information
nicolasnoble committed Oct 27, 2015
2 parents 49bca46 + 738220d commit dcd35b8
Show file tree
Hide file tree
Showing 31 changed files with 634 additions and 333 deletions.
10 changes: 5 additions & 5 deletions examples/objective-c/auth_sample/AuthTestService.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Pod::Spec.new do |s|
s.version = "0.0.1"
s.license = "New BSD"

s.ios.deployment_target = "6.0"
s.osx.deployment_target = "10.8"
s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9"

# Base directory where the .proto files are.
src = "../../protos"

# Directory where the generated files will be place.
# Directory where the generated files will be placed.
dir = "Pods/" + s.name

# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
Expand All @@ -22,14 +22,14 @@ Pod::Spec.new do |s|
ms.source_files = "#{dir}/*.pbobjc.{h,m}", "#{dir}/**/*.pbobjc.{h,m}"
ms.header_mappings_dir = dir
ms.requires_arc = false
ms.dependency "Protobuf", "~> 3.0.0-alpha-3"
ms.dependency "Protobuf", "~> 3.0.0-alpha-4"
end

s.subspec "Services" do |ss|
ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}"
ss.header_mappings_dir = dir
ss.requires_arc = true
ss.dependency "gRPC", "~> 0.6"
ss.dependency "gRPC", "~> 0.11"
ss.dependency "#{s.name}/Messages"
end
end
9 changes: 4 additions & 5 deletions examples/objective-c/auth_sample/MakeRPCViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

#import <AuthTestService/AuthSample.pbrpc.h>
#import <Google/SignIn.h>
#include <grpc/status.h>
#import <ProtoRPC/ProtoRPC.h>

NSString * const kTestScope = @"https://www.googleapis.com/auth/xapi.zoo";
Expand All @@ -49,10 +48,10 @@ - (NSString *)UIDescription;

@implementation NSError (AuthSample)
- (NSString *)UIDescription {
if (self.code == GRPC_STATUS_UNAUTHENTICATED) {
if (self.code == GRPCErrorCodeUnauthenticated) {
// Authentication error. OAuth2 specifies we'll receive a challenge header.
// |userInfo[kGRPCStatusMetadataKey]| is the dictionary of response metadata.
NSString *challengeHeader = self.userInfo[kGRPCStatusMetadataKey][@"www-authenticate"] ?: @"";
// |userInfo[kGRPCHeadersKey]| is the dictionary of response headers.
NSString *challengeHeader = self.userInfo[kGRPCHeadersKey][@"www-authenticate"] ?: @"";
return [@"Invalid credentials. Server challenge:\n" stringByAppendingString:challengeHeader];
} else {
// Any other error.
Expand Down Expand Up @@ -89,7 +88,7 @@ - (void)viewWillAppear:(BOOL)animated {

// Set the access token to be used.
NSString *accessToken = GIDSignIn.sharedInstance.currentUser.authentication.accessToken;
call.requestMetadata[@"Authorization"] = [@"Bearer " stringByAppendingString:accessToken];
call.requestHeaders[@"Authorization"] = [@"Bearer " stringByAppendingString:accessToken];

// Start the RPC.
[call start];
Expand Down
3 changes: 3 additions & 0 deletions examples/objective-c/auth_sample/Podfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'Protobuf', :path => "../../../third_party/protobuf"
pod 'gRPC', :path => "../../.."

target 'AuthSample' do
# Depend on the generated AuthTestService library.
pod 'AuthTestService', :path => '.'
Expand Down
2 changes: 2 additions & 0 deletions examples/objective-c/route_guide/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

target 'RouteGuideClient' do
pod 'Protobuf', :path => "../../../third_party/protobuf"
pod 'gRPC', :path => "../../.."
# Depend on the generated RouteGuide library.
pod 'RouteGuide', :path => '.'
end
10 changes: 5 additions & 5 deletions examples/objective-c/route_guide/RouteGuide.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ Pod::Spec.new do |s|
s.version = "0.0.1"
s.license = "New BSD"

s.ios.deployment_target = "6.0"
s.osx.deployment_target = "10.8"
s.ios.deployment_target = "7.1"
s.osx.deployment_target = "10.9"

# Base directory where the .proto files are.
src = "../../protos"

# Directory where the generated files will be place.
# Directory where the generated files will be placed.
dir = "Pods/" + s.name

# Run protoc with the Objective-C and gRPC plugins to generate protocol messages and gRPC clients.
Expand All @@ -22,14 +22,14 @@ Pod::Spec.new do |s|
ms.source_files = "#{dir}/*.pbobjc.{h,m}", "#{dir}/**/*.pbobjc.{h,m}"
ms.header_mappings_dir = dir
ms.requires_arc = false
ms.dependency "Protobuf", "~> 3.0.0-alpha-3"
ms.dependency "Protobuf", "~> 3.0.0-alpha-4"
end

s.subspec "Services" do |ss|
ss.source_files = "#{dir}/*.pbrpc.{h,m}", "#{dir}/**/*.pbrpc.{h,m}"
ss.header_mappings_dir = dir
ss.requires_arc = true
ss.dependency "gRPC", "~> 0.6"
ss.dependency "gRPC", "~> 0.11"
ss.dependency "#{s.name}/Messages"
end
end
4 changes: 2 additions & 2 deletions include/grpc++/support/sync_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class ClientReader GRPC_FINAL : public ClientReaderInterface<R> {
cq_.Pluck(&ops);
}

void WaitForInitialMetadata() {
void WaitForInitialMetadata() GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);

CallOpSet<CallOpRecvInitialMetadata> ops;
Expand Down Expand Up @@ -257,7 +257,7 @@ class ClientReaderWriter GRPC_FINAL : public ClientReaderWriterInterface<W, R> {
cq_.Pluck(&ops);
}

void WaitForInitialMetadata() {
void WaitForInitialMetadata() GRPC_OVERRIDE {
GPR_ASSERT(!context_->initial_metadata_received_);

CallOpSet<CallOpRecvInitialMetadata> ops;
Expand Down
16 changes: 9 additions & 7 deletions src/objective-c/GRPCClient/GRPCCall+OAuth2.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@

#import "GRPCCall.h"

// Helpers for setting and reading headers compatible with OAuth2.
/** Helpers for setting and reading headers compatible with OAuth2. */
@interface GRPCCall (OAuth2)

// Setting this property is equivalent to setting "Bearer <passed token>" as the value of the
// request header with key "authorization" (the authorization header). Setting it to nil removes the
// authorization header from the request.
// The value obtained by getting the property is the OAuth2 bearer token if the authorization header
// of the request has the form "Bearer <token>", or nil otherwise.
/**
* Setting this property is equivalent to setting "Bearer <passed token>" as the value of the
* request header with key "authorization" (the authorization header). Setting it to nil removes the
* authorization header from the request.
* The value obtained by getting the property is the OAuth2 bearer token if the authorization header
* of the request has the form "Bearer <token>", or nil otherwise.
*/
@property(atomic, copy) NSString *oauth2AccessToken;

// Returns the value (if any) of the "www-authenticate" response header (the challenge header).
/** Returns the value (if any) of the "www-authenticate" response header (the challenge header). */
@property(atomic, readonly) NSString *oauth2ChallengeHeader;

@end
28 changes: 17 additions & 11 deletions src/objective-c/GRPCClient/GRPCCall+Tests.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,28 @@

#import "GRPCCall.h"

// Methods to let tune down the security of gRPC connections for specific hosts. These shouldn't be
// used in releases, but are sometimes needed for testing.
/**
* Methods to let tune down the security of gRPC connections for specific hosts. These shouldn't be
* used in releases, but are sometimes needed for testing.
*/
@interface GRPCCall (Tests)

// Establish all SSL connections to the provided host using the passed SSL target name and the root
// certificates found in the file at |certsPath|.
//
// Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
// more than one invocation of the methods of this category.
/**
* Establish all SSL connections to the provided host using the passed SSL target name and the root
* certificates found in the file at |certsPath|.
*
* Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
* more than one invocation of the methods of this category.
*/
+ (void)useTestCertsPath:(NSString *)certsPath
testName:(NSString *)testName
forHost:(NSString *)host;

// Establish all connections to the provided host using cleartext instead of SSL.
//
// Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
// more than one invocation of the methods of this category.
/**
* Establish all connections to the provided host using cleartext instead of SSL.
*
* Must be called before any gRPC call to that host is made. It's illegal to pass the same host to
* more than one invocation of the methods of this category.
*/
+ (void)useInsecureConnectionsForHost:(NSString *)host;
@end
Loading

0 comments on commit dcd35b8

Please sign in to comment.