From 615bdb7487ee38cabc57d72f20aa5e949f9b883c Mon Sep 17 00:00:00 2001 From: Tatsuyuki Ishi Date: Sat, 21 Apr 2018 22:38:07 +0900 Subject: [PATCH 1/6] Fix Grpc-Message decoding (#117) * Fix decoding of Grpc-Message Percent encoded as https://github.com/grpc/grpc/blob/master/doc/PROTOCOL-HTTP2.md * Return as-is when gRPC-Message fails to decode --- .../_proto/improbable/grpcweb/test/test.pb.go | 103 +++++++++--------- test/go/testserver/testserver.go | 6 +- test/proto/improbable/grpcweb/test/test.proto | 1 + .../improbable/grpcweb/test/test_pb.d.ts | 1 + .../_proto/improbable/grpcweb/test/test_pb.js | 35 +++--- test/ts/src/client.spec.ts | 48 +++++++- test/ts/src/invoke.spec.ts | 10 +- test/ts/src/unary.spec.ts | 6 +- ts/src/client.ts | 21 +++- 9 files changed, 147 insertions(+), 84 deletions(-) diff --git a/test/go/_proto/improbable/grpcweb/test/test.pb.go b/test/go/_proto/improbable/grpcweb/test/test.pb.go index 04ea7be7..c9ceb6cf 100644 --- a/test/go/_proto/improbable/grpcweb/test/test.pb.go +++ b/test/go/_proto/improbable/grpcweb/test/test.pb.go @@ -1,6 +1,5 @@ -// Code generated by protoc-gen-go. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: improbable/grpcweb/test/test.proto -// DO NOT EDIT! /* Package improbable_grpcweb_test is a generated protocol buffer package. @@ -42,20 +41,23 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PingRequest_FailureType int32 const ( - PingRequest_NONE PingRequest_FailureType = 0 - PingRequest_CODE PingRequest_FailureType = 1 - PingRequest_DROP PingRequest_FailureType = 2 + PingRequest_NONE PingRequest_FailureType = 0 + PingRequest_CODE PingRequest_FailureType = 1 + PingRequest_DROP PingRequest_FailureType = 2 + PingRequest_CODE_UNICODE PingRequest_FailureType = 3 ) var PingRequest_FailureType_name = map[int32]string{ 0: "NONE", 1: "CODE", 2: "DROP", + 3: "CODE_UNICODE", } var PingRequest_FailureType_value = map[string]int32{ - "NONE": 0, - "CODE": 1, - "DROP": 2, + "NONE": 0, + "CODE": 1, + "DROP": 2, + "CODE_UNICODE": 3, } func (x PingRequest_FailureType) String() string { @@ -777,46 +779,47 @@ var _FailService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("improbable/grpcweb/test/test.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 652 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x6f, 0xd3, 0x4c, - 0x10, 0x8e, 0xdb, 0xb4, 0x4d, 0x27, 0x4d, 0xdf, 0x74, 0x5f, 0x28, 0x26, 0x5c, 0x82, 0xa1, 0x52, - 0xa4, 0x4a, 0x4e, 0x49, 0xef, 0x1c, 0x48, 0xc3, 0x87, 0xe8, 0x97, 0xdc, 0x94, 0x03, 0x1f, 0xb2, - 0x1c, 0x7b, 0x92, 0xae, 0xea, 0x78, 0xcd, 0xee, 0xba, 0xb4, 0x12, 0x3f, 0x84, 0xff, 0xc8, 0x95, - 0x1f, 0x80, 0x76, 0xd7, 0xa6, 0x41, 0x6d, 0x4a, 0x40, 0xb9, 0x58, 0x3b, 0xcf, 0xce, 0xcc, 0xce, - 0x3c, 0x33, 0x8f, 0xc1, 0xa1, 0xe3, 0x94, 0xb3, 0x41, 0x30, 0x88, 0xb1, 0x3d, 0xe2, 0x69, 0xf8, - 0x05, 0x07, 0x6d, 0x89, 0x42, 0xea, 0x8f, 0x9b, 0x72, 0x26, 0x19, 0x79, 0x70, 0xed, 0xe3, 0xe6, - 0x3e, 0xae, 0xba, 0x6e, 0x3c, 0x1a, 0x31, 0x36, 0x8a, 0xb1, 0xad, 0xdd, 0x06, 0xd9, 0xb0, 0x8d, - 0xe3, 0x54, 0x5e, 0x99, 0x28, 0xe7, 0xdb, 0x22, 0x54, 0x8f, 0x69, 0x32, 0xf2, 0xf0, 0x73, 0x86, - 0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ad, - 0x19, 0x73, 0x4f, 0x69, 0xc5, 0x29, 0x91, 0x0f, 0x50, 0x51, 0x8e, 0xfb, 0x54, 0xc8, 0x39, 0xd7, - 0xb9, 0x63, 0x91, 0xc0, 0x6c, 0xf3, 0x31, 0x4b, 0x46, 0x2f, 0x68, 0x44, 0xe7, 0xfc, 0x40, 0xcb, - 0xda, 0xb1, 0xc8, 0x27, 0x00, 0x85, 0x9a, 0xa9, 0xcf, 0xfd, 0x01, 0xd2, 0x87, 0x72, 0x2f, 0x3c, - 0x63, 0x77, 0x24, 0x9e, 0x90, 0x5b, 0x63, 0x26, 0x2f, 0xa7, 0xd4, 0xf9, 0x6e, 0xc1, 0x7f, 0x6a, - 0xed, 0x4e, 0x25, 0x8d, 0x8b, 0xd5, 0x7b, 0x0f, 0xeb, 0xbf, 0xcb, 0x89, 0xb8, 0x53, 0xb3, 0xdd, - 0xaa, 0xbb, 0x3b, 0x86, 0xfc, 0x15, 0x36, 0x6e, 0x68, 0x83, 0x3c, 0x9b, 0x9e, 0x7e, 0x8a, 0x20, - 0x1b, 0x9d, 0xbf, 0x09, 0x29, 0x58, 0xec, 0x9c, 0x9b, 0x1f, 0x60, 0xd1, 0xe8, 0x47, 0xa8, 0x1e, - 0xb2, 0xa4, 0x77, 0x49, 0x85, 0x0c, 0x92, 0x79, 0x2f, 0xdd, 0x60, 0x59, 0x37, 0xbf, 0xfb, 0x33, - 0x00, 0x00, 0xff, 0xff, 0xae, 0x5a, 0x23, 0xd6, 0x3e, 0x07, 0x00, 0x00, + // 662 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, + 0x10, 0x8e, 0x9b, 0xb4, 0x4d, 0x27, 0x49, 0x49, 0x17, 0x28, 0x26, 0x5c, 0x82, 0xa1, 0x52, 0x24, + 0x24, 0xa7, 0xa4, 0x67, 0x38, 0x90, 0x06, 0xa8, 0x68, 0xd3, 0xca, 0x4d, 0x39, 0xf0, 0x23, 0xcb, + 0xb1, 0x27, 0xe9, 0xaa, 0x8e, 0xd7, 0xac, 0xd7, 0xa5, 0x95, 0x78, 0x22, 0x5e, 0x8d, 0x2b, 0x0f, + 0x80, 0x76, 0xd7, 0xa6, 0x41, 0x6d, 0x4a, 0x40, 0xb9, 0x58, 0x3b, 0xdf, 0xfc, 0xec, 0xec, 0x37, + 0xf3, 0x19, 0x2c, 0x3a, 0x89, 0x39, 0x1b, 0x7a, 0xc3, 0x10, 0xdb, 0x63, 0x1e, 0xfb, 0x5f, 0x71, + 0xd8, 0x16, 0x98, 0x08, 0xf5, 0xb1, 0x63, 0xce, 0x04, 0x23, 0x0f, 0xae, 0x62, 0xec, 0x2c, 0xc6, + 0x96, 0xee, 0xc6, 0xa3, 0x31, 0x63, 0xe3, 0x10, 0xdb, 0x2a, 0x6c, 0x98, 0x8e, 0xda, 0x38, 0x89, + 0xc5, 0xa5, 0xce, 0xb2, 0xbe, 0x17, 0xa1, 0x72, 0x44, 0xa3, 0xb1, 0x83, 0x5f, 0x52, 0x4c, 0x04, + 0xb9, 0x07, 0xcb, 0xe7, 0x5e, 0x98, 0xa2, 0x69, 0x34, 0x8d, 0xd6, 0x9a, 0xa3, 0x0d, 0xb2, 0x05, + 0xeb, 0x1c, 0x93, 0x98, 0x45, 0x09, 0xba, 0x3e, 0x4b, 0x23, 0x61, 0x2e, 0x35, 0x8d, 0xd6, 0xb2, + 0x53, 0xcb, 0xd1, 0xae, 0x04, 0x89, 0x0d, 0x77, 0x91, 0x73, 0xc6, 0x5d, 0x9f, 0x05, 0xe8, 0x72, + 0x14, 0x29, 0x8f, 0x30, 0x30, 0x8b, 0x4d, 0xa3, 0x55, 0x73, 0x36, 0x94, 0xab, 0xcb, 0x02, 0x74, + 0x32, 0x07, 0x39, 0x86, 0xea, 0xc8, 0xa3, 0x61, 0xca, 0xd1, 0x15, 0x97, 0x31, 0x9a, 0xa5, 0x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 0x86, 0xf9, 0xea, 0x7d, + 0x80, 0xf5, 0x3f, 0xe5, 0x44, 0xec, 0x99, 0xd5, 0x6e, 0xd4, 0xdd, 0x2d, 0x43, 0xfe, 0x06, 0x1b, + 0xd7, 0xb4, 0x41, 0x9e, 0xcf, 0x2e, 0x3f, 0x43, 0x90, 0x8d, 0xce, 0xbf, 0xa4, 0xe4, 0x2c, 0x76, + 0xce, 0xf4, 0x2f, 0x31, 0x7f, 0xe8, 0x27, 0xa8, 0xf4, 0x59, 0xd4, 0xbb, 0xa0, 0x89, 0xf0, 0xa2, + 0x45, 0x2f, 0xdd, 0x70, 0x45, 0x3d, 0x7e, 0xe7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xef, + 0x91, 0x01, 0x50, 0x07, 0x00, 0x00, } diff --git a/test/go/testserver/testserver.go b/test/go/testserver/testserver.go index 16ae54c2..9b7d5bc5 100644 --- a/test/go/testserver/testserver.go +++ b/test/go/testserver/testserver.go @@ -158,7 +158,11 @@ func (s *testSrv) PingError(ctx context.Context, ping *testproto.PingRequest) (* if ping.GetSendTrailers() { grpc.SetTrailer(ctx, metadata.Pairs("TrailerTestKey1", "ServerValue1", "TrailerTestKey2", "ServerValue2")) } - return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "Intentionally returning error for PingError") + if ping.FailureType == testproto.PingRequest_CODE { + return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "Intentionally returning error for PingError") + } else { + return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "💣") + } } func (s *testSrv) ContinueStream(ctx context.Context, req *testproto.ContinueStreamRequest) (*google_protobuf.Empty, error) { diff --git a/test/proto/improbable/grpcweb/test/test.proto b/test/proto/improbable/grpcweb/test/test.proto index 2fab08de..693fb568 100644 --- a/test/proto/improbable/grpcweb/test/test.proto +++ b/test/proto/improbable/grpcweb/test/test.proto @@ -9,6 +9,7 @@ message PingRequest { NONE = 0; CODE = 1; DROP = 2; + CODE_UNICODE = 3; } string value = 1; diff --git a/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts b/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts index fe03de60..2d3619f9 100644 --- a/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts +++ b/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts @@ -55,6 +55,7 @@ export namespace PingRequest { NONE = 0, CODE = 1, DROP = 2, + CODE_UNICODE = 3, } } diff --git a/test/ts/_proto/improbable/grpcweb/test/test_pb.js b/test/ts/_proto/improbable/grpcweb/test/test_pb.js index e47ce59b..1dd25187 100644 --- a/test/ts/_proto/improbable/grpcweb/test/test_pb.js +++ b/test/ts/_proto/improbable/grpcweb/test/test_pb.js @@ -236,7 +236,8 @@ proto.improbable.grpcweb.test.PingRequest.serializeBinaryToWriter = function(mes proto.improbable.grpcweb.test.PingRequest.FailureType = { NONE: 0, CODE: 1, - DROP: 2 + DROP: 2, + CODE_UNICODE: 3 }; /** @@ -250,7 +251,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getValue = function() { /** @param {string} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setValue = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -265,7 +266,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getResponseCount = function( /** @param {number} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setResponseCount = function(value) { - jspb.Message.setField(this, 2, value); + jspb.Message.setProto3IntField(this, 2, value); }; @@ -280,7 +281,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getErrorCodeReturned = funct /** @param {number} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setErrorCodeReturned = function(value) { - jspb.Message.setField(this, 3, value); + jspb.Message.setProto3IntField(this, 3, value); }; @@ -295,7 +296,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getFailureType = function() /** @param {!proto.improbable.grpcweb.test.PingRequest.FailureType} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setFailureType = function(value) { - jspb.Message.setField(this, 4, value); + jspb.Message.setProto3EnumField(this, 4, value); }; @@ -312,7 +313,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getCheckMetadata = function( /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setCheckMetadata = function(value) { - jspb.Message.setField(this, 5, value); + jspb.Message.setProto3BooleanField(this, 5, value); }; @@ -329,7 +330,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getSendHeaders = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setSendHeaders = function(value) { - jspb.Message.setField(this, 6, value); + jspb.Message.setProto3BooleanField(this, 6, value); }; @@ -346,7 +347,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getSendTrailers = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setSendTrailers = function(value) { - jspb.Message.setField(this, 7, value); + jspb.Message.setProto3BooleanField(this, 7, value); }; @@ -361,7 +362,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getStreamIdentifier = functi /** @param {string} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setField(this, 8, value); + jspb.Message.setProto3StringField(this, 8, value); }; @@ -515,7 +516,7 @@ proto.improbable.grpcweb.test.PingResponse.prototype.getValue = function() { /** @param {string} value */ proto.improbable.grpcweb.test.PingResponse.prototype.setValue = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -530,7 +531,7 @@ proto.improbable.grpcweb.test.PingResponse.prototype.getCounter = function() { /** @param {number} value */ proto.improbable.grpcweb.test.PingResponse.prototype.setCounter = function(value) { - jspb.Message.setField(this, 2, value); + jspb.Message.setProto3IntField(this, 2, value); }; @@ -696,7 +697,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getText = function() { /** @param {string} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setText = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -713,7 +714,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getSendHeaders = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setSendHeaders = function(value) { - jspb.Message.setField(this, 2, value); + jspb.Message.setProto3BooleanField(this, 2, value); }; @@ -730,7 +731,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getSendTrailers = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setSendTrailers = function(value) { - jspb.Message.setField(this, 3, value); + jspb.Message.setProto3BooleanField(this, 3, value); }; @@ -872,7 +873,7 @@ proto.improbable.grpcweb.test.ContinueStreamRequest.prototype.getStreamIdentifie /** @param {string} value */ proto.improbable.grpcweb.test.ContinueStreamRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -1014,7 +1015,7 @@ proto.improbable.grpcweb.test.CheckStreamClosedRequest.prototype.getStreamIdenti /** @param {string} value */ proto.improbable.grpcweb.test.CheckStreamClosedRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3StringField(this, 1, value); }; @@ -1158,7 +1159,7 @@ proto.improbable.grpcweb.test.CheckStreamClosedResponse.prototype.getClosed = fu /** @param {boolean} value */ proto.improbable.grpcweb.test.CheckStreamClosedResponse.prototype.setClosed = function(value) { - jspb.Message.setField(this, 1, value); + jspb.Message.setProto3BooleanField(this, 1, value); }; diff --git a/test/ts/src/client.spec.ts b/test/ts/src/client.spec.ts index 74fe285c..e1a7744d 100644 --- a/test/ts/src/client.spec.ts +++ b/test/ts/src/client.spec.ts @@ -114,7 +114,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -161,7 +161,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -209,7 +209,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -260,7 +260,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -305,7 +305,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -357,6 +357,44 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { }); }); + headerTrailerCombos((withHeaders, withTrailers) => { + it(`should report status code in Unicode for error with headers + trailers`, (done) => { + let didGetOnHeaders = false; + let didGetOnMessage = false; + + const ping = new PingRequest(); + ping.setFailureType(PingRequest.FailureType.CODE_UNICODE); + ping.setErrorCodeReturned(12); + ping.setSendHeaders(withHeaders); + ping.setSendTrailers(withTrailers); + + const client = grpc.client(TestService.PingError, { + debug: DEBUG, + transport: transport, + host: testHostUrl, + }); + client.onHeaders((headers: grpc.Metadata) => { + DEBUG && debug("headers", headers); + didGetOnHeaders = true; + }); + client.onMessage((message: Empty) => { + didGetOnMessage = true; + }); + client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { + DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); + assert.deepEqual(trailers.get("grpc-status"), ["12"]); + assert.deepEqual(trailers.get("grpc-message"), [encodeURIComponent("💣")]); + assert.strictEqual(status, grpc.Code.Unimplemented); + assert.strictEqual(statusMessage, "💣"); + assert.ok(didGetOnHeaders); + assert.ok(!didGetOnMessage); + done(); + }); + client.start(); + client.send(ping); + }); + }); + if (!process.env.DISABLE_CORS_TESTS) { it(`should report failure for a CORS failure`, (done) => { let didGetOnHeaders = false; diff --git a/test/ts/src/invoke.spec.ts b/test/ts/src/invoke.spec.ts index 9ca00fe9..24f2334e 100644 --- a/test/ts/src/invoke.spec.ts +++ b/test/ts/src/invoke.spec.ts @@ -79,7 +79,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -129,7 +129,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -173,7 +173,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -223,7 +223,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -267,7 +267,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); diff --git a/test/ts/src/unary.spec.ts b/test/ts/src/unary.spec.ts index 7d2023e0..94da737f 100644 --- a/test/ts/src/unary.spec.ts +++ b/test/ts/src/unary.spec.ts @@ -70,7 +70,7 @@ conditionallyRunTestSuite(SuiteEnum.unary, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); @@ -111,7 +111,7 @@ conditionallyRunTestSuite(SuiteEnum.unary, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); @@ -149,7 +149,7 @@ conditionallyRunTestSuite(SuiteEnum.unary, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.strictEqual(statusMessage, undefined, "expected no message"); + assert.isNotOk(statusMessage, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); diff --git a/ts/src/client.ts b/ts/src/client.ts index 587889e1..2fc3c692 100644 --- a/ts/src/client.ts +++ b/ts/src/client.ts @@ -101,7 +101,8 @@ class GrpcClient Date: Sun, 22 Apr 2018 00:56:07 +1000 Subject: [PATCH 2/6] Update the localhost certificate generation to create certs from a local certificate authority. (#169) --- .gitignore | 7 +++++- example/README.md | 5 ++-- misc/gen_cert.sh | 22 +++++++++++++++-- misc/localhost.conf | 8 +++++++ misc/localhost.crt | 47 +++++++++++++++++++++--------------- misc/localhost.key | 55 +++++++++++++++++++++---------------------- misc/localhostCA.conf | 12 ++++++++++ misc/localhostCA.pem | 24 +++++++++++++++++++ 8 files changed, 127 insertions(+), 53 deletions(-) create mode 100644 misc/localhost.conf create mode 100644 misc/localhostCA.conf create mode 100644 misc/localhostCA.pem diff --git a/.gitignore b/.gitignore index 8c7749da..97c10bd2 100644 --- a/.gitignore +++ b/.gitignore @@ -161,5 +161,10 @@ ENV/ # Rope project settings .ropeproject +# localhost cert authority intermediate files +misc/localhost.csr +misc/localhostCA.key +misc/localhostCA.srl + node_modules -vendor \ No newline at end of file +vendor diff --git a/example/README.md b/example/README.md index b5b99c61..015031ec 100644 --- a/example/README.md +++ b/example/README.md @@ -10,9 +10,8 @@ ### Using HTTP2 -HTTP2 requires TLS. This repository contains certificates in the `misc` directory. You can optionally generate your own replacements using the `gen_cert.sh` in the same directory. - -Follow [this guide](http://stackoverflow.com/questions/7580508/getting-chrome-to-accept-self-signed-localhost-certificate) to accept the certificates in Chrome. +HTTP2 requires TLS. This repository contains certificates in the `../misc` directory which are used by the server. You can optionally generate your own replacements using the `gen_cert.sh` in the same directory. +You will need to import the `../misc/localhostCA.pem` certificate authority into your browser, checking the "Trust this CA to identify websites" so that your browser trusts the localhost server. * `npm run start:tls` to start the Golang server and Webpack dev server with the certificates in `misc` * Go to `https://localhost:8082` diff --git a/misc/gen_cert.sh b/misc/gen_cert.sh index e4b76fac..8d598aaa 100755 --- a/misc/gen_cert.sh +++ b/misc/gen_cert.sh @@ -1,5 +1,23 @@ #!/bin/bash -# Regenerate the self-signed certificate for local host. +# Regenerate the self-signed certificate for local host. Recent versions of firefox and chrome(ium) +# require a certificate authority to be imported by the browser (localhostCA.pem) while +# the server uses a cert and key signed by that certificate authority. +# Based partly on https://stackoverflow.com/a/48791236 +CA_PASSWORD=notsafe -openssl req -x509 -sha256 -nodes -newkey rsa:2048 -days 1024 -keyout localhost.key -out localhost.crt +# Generate the root certificate authority key with the set password +openssl genrsa -des3 -passout pass:$CA_PASSWORD -out localhostCA.key 2048 +# Generate a root-certificate based on the root-key for importing to browsers. +openssl req -x509 -new -nodes -key localhostCA.key -passin pass:$CA_PASSWORD -config localhostCA.conf -sha256 -days 1825 -out localhostCA.pem + +# Generate a new private key +openssl genrsa -out localhost.key 2048 + +# Generate a Certificate Signing Request (CSR) based on that private key (reusing the +# localhostCA.conf details) +openssl req -new -key localhost.key -out localhost.csr -config localhostCA.conf + +# Create the certificate for the webserver to serve using the localhost.conf config. +openssl x509 -req -in localhost.csr -CA localhostCA.pem -CAkey localhostCA.key -CAcreateserial \ +-out localhost.crt -days 1024 -sha256 -extfile localhost.conf -passin pass:$CA_PASSWORD diff --git a/misc/localhost.conf b/misc/localhost.conf new file mode 100644 index 00000000..9e348e31 --- /dev/null +++ b/misc/localhost.conf @@ -0,0 +1,8 @@ +authorityKeyIdentifier=keyid,issuer +basicConstraints=CA:FALSE +keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment +subjectAltName = @alt_names + +[alt_names] +DNS.1 = localhost + diff --git a/misc/localhost.crt b/misc/localhost.crt index 91e66525..007162a4 100644 --- a/misc/localhost.crt +++ b/misc/localhost.crt @@ -1,21 +1,30 @@ -----BEGIN CERTIFICATE----- -MIIDXTCCAkWgAwIBAgIJAJ9+sGD4WNLKMA0GCSqGSIb3DQEBCwUAMEUxCzAJBgNV -BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX -aWRnaXRzIFB0eSBMdGQwHhcNMTcxMTE5MDAxNDQzWhcNMjAwOTA4MDAxNDQzWjBF -MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50 -ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB -CgKCAQEAtbP4y7NBsoYDv1JLdowsE6+OZmH9ll4U7g0DASrgRly+UVIUXt9RumKl -ly/zCPlDWbzilbdNab8bXLibsodozjo8c3GMIaJXfMKZNvj5Hdv5NLBhPzBfTXNZ -nPASFwe25Hb9dgnNaTkmxeBCehBBHfg5WP+XEuFvzqTw8rs2yh6oH79Jkrf0+VKv -J2qpa3CQ3DdFtOKhg5KI4OfvcFvdLmgB8T8qWIx/U73MiNi8jaQEzK+qR2eBXjhC -8x6iRrba9yVw+SKIJy0q4jMVhwkPbApLUUt0R1VeHwaiEEkKLKS6wPvP4Uo12lH7 -chLWNqewfq+n7T2foCHR7Z9kVylUDQIDAQABo1AwTjAdBgNVHQ4EFgQU42OhBKej -WYWFW4P+2SWZT+4tERQwHwYDVR0jBBgwFoAU42OhBKejWYWFW4P+2SWZT+4tERQw -DAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEAJGI+eBF6vAtNjXoz+o8o -8ryXleCayKGs2ehpSk4IEzWAk5uMa+QEOQMeb5JkNMDitNpTw/xX3N7w+Dt/2ohw -r4ZkBisZLhM8Foz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ADJSAK81dUCTXkcYV2KKAKPcQVO +HQVY2Fcm1E6x7ZrZ5vFgQ9GaWPrsuZ1Xi/UoYzCTen2CpAcLshhC4Sps++QUI8F8 +XBVjjAh6F0Zp6pnS+kIG9zlxwBSDpqtD5Uo0qatBXSycOiFAeVxIQL+8gF6Q45lX +3aTCWGbGhkuiLwyqRr89S9YecwNqdOj8vNTwe8a9IcQyWzMdAgMBAAGjggEXMIIB +EzCB4gYDVR0jBIHaMIHXoYHJpIHGMIHDMQswCQYDVQQGEwJVUzETMBEGA1UECAwK +R1JQQyBTdGF0ZTESMBAGA1UEBwwJR1JQQyBUb3duMSgwJgYDVQQKDB9HUlBDIFdl +YiBsb2NhbGhvc3QgT3JnYW5pc2F0aW9uMRYwFAYDVQQLDA1PcmcgVW5pdCBOYW1l +MSQwIgYDVQQDDBtHUlBDIFdlYiBleGFtcGxlIGRldiBzZXJ2ZXIxIzAhBgkqhkiG +9w0BCQEWFGdycGMtd2ViQGV4YW1wbGUuY29tggkAgFvCFZ4S5fIwCQYDVR0TBAIw +ADALBgNVHQ8EBAMCBPAwFAYDVR0RBA0wC4IJbG9jYWxob3N0MA0GCSqGSIb3DQEB +CwUAA4IBAQApL/qb/LfwpFyA8IbnkXnPMbx6kZjHxlAHjmmUUUOL2LtkmwGm2qDx +9BjXPwg41IEVkYzNYGUJPuS1CWL5lcX5FkZfcvvP3aNznVeDkizCE3kPO7NO4lAt +lVbfQZbTZaU7BmnwkoQwkVRZkctAF39sD06i5hsC0bOZXWL1KExvkb5IUWhjAsQC +N7O0aWXX1jalSRIlQ7eEcpX93lk2ehKriaBNNRl4OEd36vxhFQ+OG1dATqrwroPz +HbWLHxyNRZiLoW3kgiHCKjrwWksm/l3dti6tBIvc42WUOo6qkHQE5MuJI9wYt8My +twXlc+kW8TOaxGhkHjszrKFgqHSAKjmx -----END CERTIFICATE----- diff --git a/misc/localhost.key b/misc/localhost.key index e5c517e3..b87c956b 100644 --- a/misc/localhost.key +++ b/misc/localhost.key @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+v/E4LsZC8rW40q/HdHqBhBC6FFd23LV5cx6d0z+06RlasDEvFfBg7iFSIJL22o2B +Lpye7y95ratx8p6lYXcPVeO4zPKdvGg9ZKA0WD0TS4fL6kFo5Wb+ +-----END RSA PRIVATE KEY----- diff --git a/misc/localhostCA.conf b/misc/localhostCA.conf new file mode 100644 index 00000000..0bcaa2fe --- /dev/null +++ b/misc/localhostCA.conf @@ -0,0 +1,12 @@ +[ req ] +prompt = no +distinguished_name = req_distinguished_name + +[ req_distinguished_name ] +C = US +ST = GRPC State +L = GRPC Town +O = GRPC Web localhost Organisation +OU = Org Unit Name +CN = GRPC Web example dev server +emailAddress = grpc-web@example.com diff --git a/misc/localhostCA.pem b/misc/localhostCA.pem new file mode 100644 index 00000000..2efac5c2 --- /dev/null +++ b/misc/localhostCA.pem @@ -0,0 +1,24 @@ +-----BEGIN CERTIFICATE----- +MIIEBDCCAuwCCQCAW8IVnhLl8jANBgkqhkiG9w0BAQsFADCBwzELMAkGA1UEBhMC +VVMxEzARBgNVBAgMCkdSUEMgU3RhdGUxEjAQBgNVBAcMCUdSUEMgVG93bjEoMCYG +A1UECgwfR1JQQyBXZWIgbG9jYWxob3N0IE9yZ2FuaXNhdGlvbjEWMBQGA1UECwwN +T3JnIFVuaXQgTmFtZTEkMCIGA1UEAwwbR1JQQyBXZWIgZXhhbXBsZSBkZXYgc2Vy +dmVyMSMwIQYJKoZIhvcNAQkBFhRncnBjLXdlYkBleGFtcGxlLmNvbTAeFw0xODA0 +MTQxMjIzMDZaFw0yMzA0MTMxMjIzMDZaMIHDMQswCQYDVQQGEwJVUzETMBEGA1UE +CAwKR1JQQyBTdGF0ZTESMBAGA1UEBwwJR1JQQyBUb3duMSgwJgYDVQQKDB9HUlBD +IFdlYiBsb2NhbGhvc3QgT3JnYW5pc2F0aW9uMRYwFAYDVQQLDA1PcmcgVW5pdCBO +YW1lMSQwIgYDVQQDDBtHUlBDIFdlYiBleGFtcGxlIGRldiBzZXJ2ZXIxIzAhBgkq +hkiG9w0BCQEWFGdycGMtd2ViQGV4YW1wbGUuY29tMIIBIjANBgkqhkiG9w0BAQEF +AAOCAQ8AMIIBCgKCAQEA07Yhtl3Q3UQ7Rk3h525x/9S6vGLuxHHDRL5rqO6W3sxq +Bci5jJpqo+z2skzvyhXMsTSQGbzOzU4iLt+a87oAsSCaR+qLXYJJZK0zmW31+/MA +xpEEv6Tj0mi43TWbXBs6GmwFd5eUXZsl5j72Cq9RyrHTDG3AWyszwwX/TF0VdRaL +yILlSNBkq+ipm+yH2GD1rTgxHwNE9FVGQmU60NIBSsP9d0pphKRiRPh6PxJvIxHw +b8sznBmTPklNmSBlU2bnHhVdkjPtENWam4O7ompNLBd3gTL5yXxRudBECEQpHBCN +saqtxfwoR6RgUw5/dOAfZlCvIdbRX0XQW0WpHJabMwIDAQABMA0GCSqGSIb3DQEB +CwUAA4IBAQAp21I0w1zT43gZ7zWqZVEotIdxUSSRbG/YmkC2fGiRcPzxjNIkobYM +YWGc1kSrn1fKPd7sYo8suA/tjIQCiROLA6Lkh5x9NTtwN/cen7c13TrOckcfTgBK +CI83LFuSixYFF7nKli2bN0v9G+FSTC1Rk7PPTToNI3QNwCGTQj0BBzcY1xUN/2bg +KwUa8TaeqjMqpnZWaVZ9j1YEkyFhoI9wG/oGHGD9S6OBiN4smzmd30FZtjXl4XhX +LZqicnHYr9kJog15W94XD8g/1S8xuMyPkIapEXXytYwJ+K78NrUIASHq2P6j1Tor +ebAVe9mZRbZ0spIEr0PrxZtX1eWnR5n8 +-----END CERTIFICATE----- From 9df9c0a453673a3ceed1b91a794d731834bf54c7 Mon Sep 17 00:00:00 2001 From: Milan Pavlik Date: Sun, 22 Apr 2018 00:24:14 +0100 Subject: [PATCH 3/6] Revert "Fix Grpc-Message decoding (#117)" (#177) This reverts commit 615bdb7487ee38cabc57d72f20aa5e949f9b883c. --- .../_proto/improbable/grpcweb/test/test.pb.go | 103 +++++++++--------- test/go/testserver/testserver.go | 6 +- test/proto/improbable/grpcweb/test/test.proto | 1 - .../improbable/grpcweb/test/test_pb.d.ts | 1 - .../_proto/improbable/grpcweb/test/test_pb.js | 35 +++--- test/ts/src/client.spec.ts | 48 +------- test/ts/src/invoke.spec.ts | 10 +- test/ts/src/unary.spec.ts | 6 +- ts/src/client.ts | 21 +--- 9 files changed, 84 insertions(+), 147 deletions(-) diff --git a/test/go/_proto/improbable/grpcweb/test/test.pb.go b/test/go/_proto/improbable/grpcweb/test/test.pb.go index c9ceb6cf..04ea7be7 100644 --- a/test/go/_proto/improbable/grpcweb/test/test.pb.go +++ b/test/go/_proto/improbable/grpcweb/test/test.pb.go @@ -1,5 +1,6 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. +// Code generated by protoc-gen-go. // source: improbable/grpcweb/test/test.proto +// DO NOT EDIT! /* Package improbable_grpcweb_test is a generated protocol buffer package. @@ -41,23 +42,20 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PingRequest_FailureType int32 const ( - PingRequest_NONE PingRequest_FailureType = 0 - PingRequest_CODE PingRequest_FailureType = 1 - PingRequest_DROP PingRequest_FailureType = 2 - PingRequest_CODE_UNICODE PingRequest_FailureType = 3 + PingRequest_NONE PingRequest_FailureType = 0 + PingRequest_CODE PingRequest_FailureType = 1 + PingRequest_DROP PingRequest_FailureType = 2 ) var PingRequest_FailureType_name = map[int32]string{ 0: "NONE", 1: "CODE", 2: "DROP", - 3: "CODE_UNICODE", } var PingRequest_FailureType_value = map[string]int32{ - "NONE": 0, - "CODE": 1, - "DROP": 2, - "CODE_UNICODE": 3, + "NONE": 0, + "CODE": 1, + "DROP": 2, } func (x PingRequest_FailureType) String() string { @@ -779,47 +777,46 @@ var _FailService_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("improbable/grpcweb/test/test.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 662 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0x8e, 0x9b, 0xb4, 0x4d, 0x27, 0x49, 0x49, 0x17, 0x28, 0x26, 0x5c, 0x82, 0xa1, 0x52, 0x24, - 0x24, 0xa7, 0xa4, 0x67, 0x38, 0x90, 0x06, 0xa8, 0x68, 0xd3, 0xca, 0x4d, 0x39, 0xf0, 0x23, 0xcb, - 0xb1, 0x27, 0xe9, 0xaa, 0x8e, 0xd7, 0xac, 0xd7, 0xa5, 0x95, 0x78, 0x22, 0x5e, 0x8d, 0x2b, 0x0f, - 0x80, 0x76, 0xd7, 0xa6, 0x41, 0x6d, 0x4a, 0x40, 0xb9, 0x58, 0x3b, 0xdf, 0xfc, 0xec, 0xec, 0x37, - 0xf3, 0x19, 0x2c, 0x3a, 0x89, 0x39, 0x1b, 0x7a, 0xc3, 0x10, 0xdb, 0x63, 0x1e, 0xfb, 0x5f, 0x71, - 0xd8, 0x16, 0x98, 0x08, 0xf5, 0xb1, 0x63, 0xce, 0x04, 0x23, 0x0f, 0xae, 0x62, 0xec, 0x2c, 0xc6, - 0x96, 0xee, 0xc6, 0xa3, 0x31, 0x63, 0xe3, 0x10, 0xdb, 0x2a, 0x6c, 0x98, 0x8e, 0xda, 0x38, 0x89, - 0xc5, 0xa5, 0xce, 0xb2, 0xbe, 0x17, 0xa1, 0x72, 0x44, 0xa3, 0xb1, 0x83, 0x5f, 0x52, 0x4c, 0x04, - 0xb9, 0x07, 0xcb, 0xe7, 0x5e, 0x98, 0xa2, 0x69, 0x34, 0x8d, 0xd6, 0x9a, 0xa3, 0x0d, 0xb2, 0x05, - 0xeb, 0x1c, 0x93, 0x98, 0x45, 0x09, 0xba, 0x3e, 0x4b, 0x23, 0x61, 0x2e, 0x35, 0x8d, 0xd6, 0xb2, - 0x53, 0xcb, 0xd1, 0xae, 0x04, 0x89, 0x0d, 0x77, 0x91, 0x73, 0xc6, 0x5d, 0x9f, 0x05, 0xe8, 0x72, - 0x14, 0x29, 0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ea, - 0xa9, 0x2f, 0xfc, 0x02, 0x32, 0x80, 0x52, 0xcf, 0x3f, 0x65, 0xb7, 0x14, 0x9e, 0x92, 0x5b, 0x63, - 0xae, 0x28, 0xab, 0xd0, 0xf9, 0x61, 0xc0, 0x1d, 0xb9, 0x76, 0x27, 0x82, 0x86, 0xf9, 0xea, 0x7d, - 0x80, 0xf5, 0x3f, 0xe5, 0x44, 0xec, 0x99, 0xd5, 0x6e, 0xd4, 0xdd, 0x2d, 0x43, 0xfe, 0x06, 0x1b, - 0xd7, 0xb4, 0x41, 0x9e, 0xcf, 0x2e, 0x3f, 0x43, 0x90, 0x8d, 0xce, 0xbf, 0xa4, 0xe4, 0x2c, 0x76, - 0xce, 0xf4, 0x2f, 0x31, 0x7f, 0xe8, 0x27, 0xa8, 0xf4, 0x59, 0xd4, 0xbb, 0xa0, 0x89, 0xf0, 0xa2, - 0x45, 0x2f, 0xdd, 0x70, 0x45, 0x3d, 0x7e, 0xe7, 0x57, 0x00, 0x00, 0x00, 0xff, 0xff, 0x63, 0xef, - 0x91, 0x01, 0x50, 0x07, 0x00, 0x00, + // 652 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0x4d, 0x6f, 0xd3, 0x4c, + 0x10, 0x8e, 0xdb, 0xb4, 0x4d, 0x27, 0x4d, 0xdf, 0x74, 0x5f, 0x28, 0x26, 0x5c, 0x82, 0xa1, 0x52, + 0xa4, 0x4a, 0x4e, 0x49, 0xef, 0x1c, 0x48, 0xc3, 0x87, 0xe8, 0x97, 0xdc, 0x94, 0x03, 0x1f, 0xb2, + 0x1c, 0x7b, 0x92, 0xae, 0xea, 0x78, 0xcd, 0xee, 0xba, 0xb4, 0x12, 0x3f, 0x84, 0xff, 0xc8, 0x95, + 0x1f, 0x80, 0x76, 0xd7, 0xa6, 0x41, 0x6d, 0x4a, 0x40, 0xb9, 0x58, 0x3b, 0xcf, 0xce, 0xcc, 0xce, + 0x3c, 0x33, 0x8f, 0xc1, 0xa1, 0xe3, 0x94, 0xb3, 0x41, 0x30, 0x88, 0xb1, 0x3d, 0xe2, 0x69, 0xf8, + 0x05, 0x07, 0x6d, 0x89, 0x42, 0xea, 0x8f, 0x9b, 0x72, 0x26, 0x19, 0x79, 0x70, 0xed, 0xe3, 0xe6, + 0x3e, 0xae, 0xba, 0x6e, 0x3c, 0x1a, 0x31, 0x36, 0x8a, 0xb1, 0xad, 0xdd, 0x06, 0xd9, 0xb0, 0x8d, + 0xe3, 0x54, 0x5e, 0x99, 0x28, 0xe7, 0xdb, 0x22, 0x54, 0x8f, 0x69, 0x32, 0xf2, 0xf0, 0x73, 0x86, + 0x42, 0x92, 0x7b, 0xb0, 0x74, 0x11, 0xc4, 0x19, 0xda, 0x56, 0xd3, 0x6a, 0xad, 0x7a, 0xc6, 0x20, + 0x5b, 0xb0, 0xce, 0x51, 0xa4, 0x2c, 0x11, 0xe8, 0x87, 0x2c, 0x4b, 0xa4, 0xbd, 0xd0, 0xb4, 0x5a, + 0x4b, 0x5e, 0xad, 0x40, 0xbb, 0x0a, 0x24, 0x2e, 0xfc, 0x8f, 0x9c, 0x33, 0xee, 0x87, 0x2c, 0x42, + 0x9f, 0xa3, 0xcc, 0x78, 0x82, 0x91, 0xbd, 0xd8, 0xb4, 0x5a, 0x35, 0x6f, 0x43, 0x5f, 0x75, 0x59, + 0x84, 0x5e, 0x7e, 0x41, 0x4e, 0x60, 0x6d, 0x18, 0xd0, 0x38, 0xe3, 0xe8, 0xcb, 0xab, 0x14, 0xed, + 0x72, 0xd3, 0x6a, 0xad, 0x77, 0x76, 0xdc, 0x29, 0x9d, 0xb8, 0x13, 0x85, 0xba, 0x2f, 0x4d, 0x60, + 0xff, 0x2a, 0x45, 0xaf, 0x3a, 0xbc, 0x36, 0x54, 0xad, 0xe1, 0x19, 0x86, 0xe7, 0xfe, 0x18, 0x65, + 0x10, 0x05, 0x32, 0xb0, 0x97, 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x77, 0x49, 0x85, 0x0c, 0x92, 0x79, 0x2f, 0xdd, 0x60, 0x59, 0x37, 0xbf, 0xfb, 0x33, + 0x00, 0x00, 0xff, 0xff, 0xae, 0x5a, 0x23, 0xd6, 0x3e, 0x07, 0x00, 0x00, } diff --git a/test/go/testserver/testserver.go b/test/go/testserver/testserver.go index 9b7d5bc5..16ae54c2 100644 --- a/test/go/testserver/testserver.go +++ b/test/go/testserver/testserver.go @@ -158,11 +158,7 @@ func (s *testSrv) PingError(ctx context.Context, ping *testproto.PingRequest) (* if ping.GetSendTrailers() { grpc.SetTrailer(ctx, metadata.Pairs("TrailerTestKey1", "ServerValue1", "TrailerTestKey2", "ServerValue2")) } - if ping.FailureType == testproto.PingRequest_CODE { - return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "Intentionally returning error for PingError") - } else { - return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "💣") - } + return nil, grpc.Errorf(codes.Code(ping.ErrorCodeReturned), "Intentionally returning error for PingError") } func (s *testSrv) ContinueStream(ctx context.Context, req *testproto.ContinueStreamRequest) (*google_protobuf.Empty, error) { diff --git a/test/proto/improbable/grpcweb/test/test.proto b/test/proto/improbable/grpcweb/test/test.proto index 693fb568..2fab08de 100644 --- a/test/proto/improbable/grpcweb/test/test.proto +++ b/test/proto/improbable/grpcweb/test/test.proto @@ -9,7 +9,6 @@ message PingRequest { NONE = 0; CODE = 1; DROP = 2; - CODE_UNICODE = 3; } string value = 1; diff --git a/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts b/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts index 2d3619f9..fe03de60 100644 --- a/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts +++ b/test/ts/_proto/improbable/grpcweb/test/test_pb.d.ts @@ -55,7 +55,6 @@ export namespace PingRequest { NONE = 0, CODE = 1, DROP = 2, - CODE_UNICODE = 3, } } diff --git a/test/ts/_proto/improbable/grpcweb/test/test_pb.js b/test/ts/_proto/improbable/grpcweb/test/test_pb.js index 1dd25187..e47ce59b 100644 --- a/test/ts/_proto/improbable/grpcweb/test/test_pb.js +++ b/test/ts/_proto/improbable/grpcweb/test/test_pb.js @@ -236,8 +236,7 @@ proto.improbable.grpcweb.test.PingRequest.serializeBinaryToWriter = function(mes proto.improbable.grpcweb.test.PingRequest.FailureType = { NONE: 0, CODE: 1, - DROP: 2, - CODE_UNICODE: 3 + DROP: 2 }; /** @@ -251,7 +250,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getValue = function() { /** @param {string} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setValue = function(value) { - jspb.Message.setProto3StringField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -266,7 +265,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getResponseCount = function( /** @param {number} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setResponseCount = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -281,7 +280,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getErrorCodeReturned = funct /** @param {number} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setErrorCodeReturned = function(value) { - jspb.Message.setProto3IntField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -296,7 +295,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getFailureType = function() /** @param {!proto.improbable.grpcweb.test.PingRequest.FailureType} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setFailureType = function(value) { - jspb.Message.setProto3EnumField(this, 4, value); + jspb.Message.setField(this, 4, value); }; @@ -313,7 +312,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getCheckMetadata = function( /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setCheckMetadata = function(value) { - jspb.Message.setProto3BooleanField(this, 5, value); + jspb.Message.setField(this, 5, value); }; @@ -330,7 +329,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getSendHeaders = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setSendHeaders = function(value) { - jspb.Message.setProto3BooleanField(this, 6, value); + jspb.Message.setField(this, 6, value); }; @@ -347,7 +346,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getSendTrailers = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setSendTrailers = function(value) { - jspb.Message.setProto3BooleanField(this, 7, value); + jspb.Message.setField(this, 7, value); }; @@ -362,7 +361,7 @@ proto.improbable.grpcweb.test.PingRequest.prototype.getStreamIdentifier = functi /** @param {string} value */ proto.improbable.grpcweb.test.PingRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setProto3StringField(this, 8, value); + jspb.Message.setField(this, 8, value); }; @@ -516,7 +515,7 @@ proto.improbable.grpcweb.test.PingResponse.prototype.getValue = function() { /** @param {string} value */ proto.improbable.grpcweb.test.PingResponse.prototype.setValue = function(value) { - jspb.Message.setProto3StringField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -531,7 +530,7 @@ proto.improbable.grpcweb.test.PingResponse.prototype.getCounter = function() { /** @param {number} value */ proto.improbable.grpcweb.test.PingResponse.prototype.setCounter = function(value) { - jspb.Message.setProto3IntField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -697,7 +696,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getText = function() { /** @param {string} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setText = function(value) { - jspb.Message.setProto3StringField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -714,7 +713,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getSendHeaders = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setSendHeaders = function(value) { - jspb.Message.setProto3BooleanField(this, 2, value); + jspb.Message.setField(this, 2, value); }; @@ -731,7 +730,7 @@ proto.improbable.grpcweb.test.TextMessage.prototype.getSendTrailers = function() /** @param {boolean} value */ proto.improbable.grpcweb.test.TextMessage.prototype.setSendTrailers = function(value) { - jspb.Message.setProto3BooleanField(this, 3, value); + jspb.Message.setField(this, 3, value); }; @@ -873,7 +872,7 @@ proto.improbable.grpcweb.test.ContinueStreamRequest.prototype.getStreamIdentifie /** @param {string} value */ proto.improbable.grpcweb.test.ContinueStreamRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setProto3StringField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1015,7 +1014,7 @@ proto.improbable.grpcweb.test.CheckStreamClosedRequest.prototype.getStreamIdenti /** @param {string} value */ proto.improbable.grpcweb.test.CheckStreamClosedRequest.prototype.setStreamIdentifier = function(value) { - jspb.Message.setProto3StringField(this, 1, value); + jspb.Message.setField(this, 1, value); }; @@ -1159,7 +1158,7 @@ proto.improbable.grpcweb.test.CheckStreamClosedResponse.prototype.getClosed = fu /** @param {boolean} value */ proto.improbable.grpcweb.test.CheckStreamClosedResponse.prototype.setClosed = function(value) { - jspb.Message.setProto3BooleanField(this, 1, value); + jspb.Message.setField(this, 1, value); }; diff --git a/test/ts/src/client.spec.ts b/test/ts/src/client.spec.ts index e1a7744d..74fe285c 100644 --- a/test/ts/src/client.spec.ts +++ b/test/ts/src/client.spec.ts @@ -114,7 +114,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -161,7 +161,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -209,7 +209,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -260,7 +260,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -305,7 +305,7 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -357,44 +357,6 @@ conditionallyRunTestSuite(SuiteEnum.client, () => { }); }); - headerTrailerCombos((withHeaders, withTrailers) => { - it(`should report status code in Unicode for error with headers + trailers`, (done) => { - let didGetOnHeaders = false; - let didGetOnMessage = false; - - const ping = new PingRequest(); - ping.setFailureType(PingRequest.FailureType.CODE_UNICODE); - ping.setErrorCodeReturned(12); - ping.setSendHeaders(withHeaders); - ping.setSendTrailers(withTrailers); - - const client = grpc.client(TestService.PingError, { - debug: DEBUG, - transport: transport, - host: testHostUrl, - }); - client.onHeaders((headers: grpc.Metadata) => { - DEBUG && debug("headers", headers); - didGetOnHeaders = true; - }); - client.onMessage((message: Empty) => { - didGetOnMessage = true; - }); - client.onEnd((status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { - DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); - assert.deepEqual(trailers.get("grpc-status"), ["12"]); - assert.deepEqual(trailers.get("grpc-message"), [encodeURIComponent("💣")]); - assert.strictEqual(status, grpc.Code.Unimplemented); - assert.strictEqual(statusMessage, "💣"); - assert.ok(didGetOnHeaders); - assert.ok(!didGetOnMessage); - done(); - }); - client.start(); - client.send(ping); - }); - }); - if (!process.env.DISABLE_CORS_TESTS) { it(`should report failure for a CORS failure`, (done) => { let didGetOnHeaders = false; diff --git a/test/ts/src/invoke.spec.ts b/test/ts/src/invoke.spec.ts index 24f2334e..9ca00fe9 100644 --- a/test/ts/src/invoke.spec.ts +++ b/test/ts/src/invoke.spec.ts @@ -79,7 +79,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -129,7 +129,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -173,7 +173,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -223,7 +223,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); @@ -267,7 +267,7 @@ conditionallyRunTestSuite(SuiteEnum.invoke, () => { onEnd: (status: grpc.Code, statusMessage: string, trailers: grpc.Metadata) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withTrailers) { assert.deepEqual(trailers.get("TrailerTestKey1"), ["ServerValue1"]); assert.deepEqual(trailers.get("TrailerTestKey2"), ["ServerValue2"]); diff --git a/test/ts/src/unary.spec.ts b/test/ts/src/unary.spec.ts index 94da737f..7d2023e0 100644 --- a/test/ts/src/unary.spec.ts +++ b/test/ts/src/unary.spec.ts @@ -70,7 +70,7 @@ conditionallyRunTestSuite(SuiteEnum.unary, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); @@ -111,7 +111,7 @@ conditionallyRunTestSuite(SuiteEnum.unary, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); @@ -149,7 +149,7 @@ conditionallyRunTestSuite(SuiteEnum.unary, () => { onEnd: ({status, statusMessage, headers, message, trailers}) => { DEBUG && debug("status", status, "statusMessage", statusMessage, "headers", headers, "res", message, "trailers", trailers); assert.strictEqual(status, grpc.Code.OK, "expected OK (0)"); - assert.isNotOk(statusMessage, "expected no message"); + assert.strictEqual(statusMessage, undefined, "expected no message"); if (withHeaders) { assert.deepEqual(headers.get("HeaderTestKey1"), ["ServerValue1"]); assert.deepEqual(headers.get("HeaderTestKey2"), ["ServerValue2"]); diff --git a/ts/src/client.ts b/ts/src/client.ts index 2fc3c692..587889e1 100644 --- a/ts/src/client.ts +++ b/ts/src/client.ts @@ -101,8 +101,7 @@ class GrpcClient Date: Tue, 24 Apr 2018 11:02:10 +0100 Subject: [PATCH 4/6] Fix dependencies in example (#175) --- example/go/Gopkg.lock | 94 +++++++++++++++++++++++++++++++++++-------- example/go/Gopkg.toml | 30 ++++++++++++-- 2 files changed, 104 insertions(+), 20 deletions(-) diff --git a/example/go/Gopkg.lock b/example/go/Gopkg.lock index cfd5b181..6dcad9ab 100644 --- a/example/go/Gopkg.lock +++ b/example/go/Gopkg.lock @@ -2,50 +2,110 @@ [[projects]] - branch = "master" name = "github.com/golang/protobuf" - packages = ["proto","ptypes","ptypes/any","ptypes/duration","ptypes/timestamp"] - revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845" + packages = [ + "proto", + "ptypes", + "ptypes/any", + "ptypes/duration", + "ptypes/timestamp" + ] + revision = "925541529c1fa6821df4e44ce2723319eb2be768" + version = "v1.0.0" + +[[projects]] + name = "github.com/gorilla/websocket" + packages = ["."] + revision = "ea4d1f681babbce9545c9c5f3d5194a789c89f5b" + version = "v1.2.0" [[projects]] name = "github.com/improbable-eng/grpc-web" packages = ["go/grpcweb"] - revision = "7174732598544bdecfa12fb81ca2f1601cf1b587" - version = "0.3.0-beta" + revision = "58d1f6c3d97b6d81d7eebd7d26d5942a1d40cb46" + version = "0.6.0" [[projects]] name = "github.com/rs/cors" packages = ["."] - revision = "7af7a1e09ba336d2ea14b1ce73bf693c6837dbf6" - version = "v1.2" + revision = "feef513b9575b32f84bafa580aad89b011259019" + version = "v1.3.0" [[projects]] branch = "master" name = "golang.org/x/net" - packages = ["context","http2","http2/hpack","idna","internal/timeseries","lex/httplex","trace"] - revision = "d866cfc389cec985d6fda2859936a575a55a3ab6" + packages = [ + "context", + "http/httpguts", + "http2", + "http2/hpack", + "idna", + "internal/timeseries", + "lex/httplex", + "trace" + ] + revision = "5f9ae10d9af5b1c89ae6904293b14b064d4ada23" [[projects]] - branch = "master" name = "golang.org/x/text" - packages = ["collate","collate/build","internal/colltab","internal/gen","internal/tag","internal/triegen","internal/ucd","language","secure/bidirule","transform","unicode/bidi","unicode/cldr","unicode/norm","unicode/rangetable"] - revision = "eb22672bea55af56d225d4e35405f4d2e9f062a0" + packages = [ + "collate", + "collate/build", + "internal/colltab", + "internal/gen", + "internal/tag", + "internal/triegen", + "internal/ucd", + "language", + "secure/bidirule", + "transform", + "unicode/bidi", + "unicode/cldr", + "unicode/norm", + "unicode/rangetable" + ] + revision = "f21a4dfb5e38f5895301dc265a8def02365cc3d0" + version = "v0.3.0" [[projects]] branch = "master" name = "google.golang.org/genproto" packages = ["googleapis/rpc/status"] - revision = "a8101f21cf983e773d0c1133ebc5424792003214" + revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200" [[projects]] name = "google.golang.org/grpc" - packages = [".","balancer","balancer/roundrobin","codes","connectivity","credentials","encoding","grpclb/grpc_lb_v1/messages","grpclog","internal","keepalive","metadata","naming","peer","resolver","resolver/dns","resolver/passthrough","stats","status","tap","transport"] - revision = "e687fa4e6424368ece6e4fe727cea2c806a0fcb4" - version = "v1.8.2" + packages = [ + ".", + "balancer", + "balancer/base", + "balancer/roundrobin", + "codes", + "connectivity", + "credentials", + "encoding", + "encoding/proto", + "grpclb/grpc_lb_v1/messages", + "grpclog", + "internal", + "keepalive", + "metadata", + "naming", + "peer", + "resolver", + "resolver/dns", + "resolver/passthrough", + "stats", + "status", + "tap", + "transport" + ] + revision = "d11072e7ca9811b1100b80ca0269ac831f06d024" + version = "v1.11.3" [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "9b63a28eff00bb27eaeb856141b43834ef58214d86c906d4220b8cd794db33c0" + inputs-digest = "7c4005512c7bcf970b40141c089e3e607d96b953116641c4635299f5a35acdb7" solver-name = "gps-cdcl" solver-version = 1 diff --git a/example/go/Gopkg.toml b/example/go/Gopkg.toml index 9425a542..01f78944 100644 --- a/example/go/Gopkg.toml +++ b/example/go/Gopkg.toml @@ -1,4 +1,3 @@ - # Gopkg.toml example # # Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md @@ -17,6 +16,31 @@ # source = "github.com/myfork/project2" # # [[override]] -# name = "github.com/x/y" -# version = "2.4.0" +# name = "github.com/x/y" +# version = "2.4.0" +# +# [prune] +# non-go = false +# go-tests = true +# unused-packages = true + + +[[constraint]] + name = "github.com/golang/protobuf" + version = "1.0.0" + +[[constraint]] + name = "github.com/improbable-eng/grpc-web" + version = "0.6.0" + +[[constraint]] + branch = "master" + name = "golang.org/x/net" + +[[constraint]] + name = "google.golang.org/grpc" + version = "1.11.3" +[prune] + go-tests = true + unused-packages = true From 76f0d56b4c102e26864ef3859b83f9e34b64500b Mon Sep 17 00:00:00 2001 From: Dominic Green Date: Fri, 27 Apr 2018 10:02:48 +0100 Subject: [PATCH 5/6] adding slack shield --- README.md | 1 + slack.png | Bin 0 -> 3987 bytes 2 files changed, 1 insertion(+) create mode 100644 slack.png diff --git a/README.md b/README.md index e842843f..1530e7f9 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ [![GoDoc](http://img.shields.io/badge/GoDoc-Reference-blue.svg)](https://godoc.org/github.com/improbable-eng/grpc-web/go/grpcweb) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE) [![quality: alpha](https://img.shields.io/badge/quality-alpha-orange.svg)](#status) +[![Slack](slack.png)](https://join.slack.com/t/improbable-eng/shared_invite/enQtMzQ1ODcyMzQ5MjM4LWY5ZWZmNGM2ODc5MmViNmQ3ZTA3ZTY3NzQwOTBlMTkzZmIxZTIxODk0OWU3YjZhNWVlNDU3MDlkZGViZjhkMjc) [gRPC](http://www.grpc.io/) is a modern, [HTTP2](https://hpbn.co/http2/)-based protocol, that provides RPC semantics using the strongly-typed *binary* data format of [protocol buffers](https://developers.google.com/protocol-buffers/docs/overview) across multiple languages (C++, C#, Golang, Java, Python, NodeJS, ObjectiveC, etc.) diff --git a/slack.png b/slack.png new file mode 100644 index 0000000000000000000000000000000000000000..eb951fcf6b9eff343f1d2cb0e8d7c3d8951ada9f GIT binary patch literal 3987 zcmZ|Sc|6nq9{}*rHn+?wq(Wjz&V|s3xsM4UceC6vN6zKk`jRLKKaIpFIdY67p;(HF zT$QhuW0tFfQjR%>-)H{&{qcM5@!9M1`Mf``$NqSKUa$9i>Grl3B0`6R000oNvNUx7 zBLO_b5PaabZW@mq7tpF~769TD0DzPN02|;f(l-EzMghPN zJOH5c0pLLRz1DO3-~gXD*1{BwpmmeBWH1PZTe?Mp(S7#_mw%QBp72Lmoi*eC%5zu{ zqU`lFZyf;O=2oUgPQ)(@9`W{0bBvv$@x}w6FT^y~%=7Yi+CwFkE@85BY@lBx-smv?IY(}c3y#2euhb!fL&+q z;>{Z-8adfDPMr{dzPK2c?BTXvSsOlinKw^R&3R?zoa5V03p2BSeYdhbp5EM(vsdEr z?bMnlT0&x#79k5h0vY!edyHC@}$ka+gSy0l*Rgdq`ys;?BV zS6oZToE>7YceXYd0o5+C(W+x>hORt~qYE)@TSI17f1`iDT220O;&{bkcuDIS0L1B9MZg31X+tya-?7cy$@C&phYto?BW^ zFsS!=b4yw;2KcqBhO`{_0!QPAA2CQ+TVyeW@pV^{Z8gR)V1bCoik~DkzUG8zaVxBs$j-;)P6~Dezn80jL++1ClUwY1^Pxo(R z5T2$nN%@jZ=o5n1GaQt3LZD;gsm8Su-+sGP#l?}%7OrtZMuCQWSzis=9$RV3OH341CZefZhiOMY#tPFs$WMQ>Eo z^v^KX2dG)szkP>fWc(U?_YR`3fA3yG0;$^NZ22Rlk|$4^n@dO`E)E~YiwcF``X;m+ zLn?=jODPBJJ#Cn@I&I0GUdA7aI>p+h7Wy>A3SaGa6QrXM0tr=+|H=LtiDI4ux^KrD1Kk z{Hblvxaw~iQs}p&PDf0?-Al)#B==k^5I$>ZX$g4mB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mL&=)Pk0Y{fsQXK#ORXgtz3%2h^TZf(2BC+KbVR=Khn1JxD8$8nV@kod zw#CyE5}u8v?U26UE2|pZAuc25tNoo%N`t8mR!;l!K8>V7#Y*u0`)24i@7XmQ7g*EN zETiPm8CC-#=G~04OF!qwT^LidSmD0?&?vT3Bs5%E>3+H`HvUu0nYwV@`>-X*pQ8pd zDdOUnn<(6mIu5C}pOW6|ebRmKszg}W9y|c^{_{Y4`7*g{-@b^=)dx>I$#2A+4i=ll zc^zrGrfcKb+q*xRz(i?12^iP`o}Ei+j8ZiD5BMkZSd^J-l<&nTKeSJT9~b}))Ja`c zl$NT7juYw>8g&w_r3qf5Q7GxDGV1>%goOEC^1t%`6A0~6@?Zjr`wNjV0ch`wk$$St z5tjh}O9Vf(y1IH)NVs~)#ehpb!K$Y;HBeS44XZGesZE4VoKbnJ$|RTzSee Date: Mon, 30 Apr 2018 15:24:41 +0100 Subject: [PATCH 6/6] Prevent fetch.pump recursively returning promises (#184) --- ts/src/transports/fetch.ts | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/ts/src/transports/fetch.ts b/ts/src/transports/fetch.ts index 9172c2e2..6de44296 100644 --- a/ts/src/transports/fetch.ts +++ b/ts/src/transports/fetch.ts @@ -22,14 +22,15 @@ class Fetch implements Transport { this.options = transportOptions; } - pump(readerArg: ReadableStreamReader, res: Response): Promise { + pump(readerArg: ReadableStreamReader, res: Response) { this.reader = readerArg; if (this.cancelled) { // If the request was cancelled before the first pump then cancel it here this.options.debug && debug("Fetch.pump.cancel at first pump"); - return this.reader.cancel(); + this.reader.cancel(); + return; } - return this.reader.read() + this.reader.read() .then((result: { done: boolean, value: Uint8Array }) => { if (result.done) { detach(() => { @@ -40,7 +41,8 @@ class Fetch implements Transport { detach(() => { this.options.onChunk(result.value); }); - return this.pump(this.reader, res); + this.pump(this.reader, res); + return; }); } @@ -56,7 +58,8 @@ class Fetch implements Transport { this.options.onHeaders(new Metadata(res.headers as any), res.status); }); if (res.body) { - return this.pump(res.body.getReader(), res) + this.pump(res.body.getReader(), res) + return; } return res; }).catch(err => {