This commit is contained in:
iamqizhao 2015-08-26 12:40:24 -07:00
Родитель b6d240dcce
Коммит c0e23d7ef3
4 изменённых файлов: 5 добавлений и 16 удалений

Просмотреть файл

@ -187,7 +187,7 @@ func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error)
rawConn.Close()
return nil, nil, err
}
return conn, &TLSInfo{ conn.ConnectionState() }, nil
return conn, &TLSInfo{conn.ConnectionState()}, nil
}
// NewTLS uses c to construct a TransportAuthenticator based on TLS.

Просмотреть файл

@ -119,8 +119,7 @@ func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*
func (s *testServer) StreamingOutputCall(args *testpb.StreamingOutputCallRequest, stream testpb.TestService_StreamingOutputCallServer) error {
if md, ok := metadata.FromContext(stream.Context()); ok {
delete(md, "transport_security_type")
// For testing purpose, returns an error if there is attached metadata other than transport_security_type.
// For testing purpose, returns an error if there is attached metadata.
if len(md) > 0 {
return grpc.Errorf(codes.DataLoss, "got extra metadata")
}
@ -591,10 +590,6 @@ func testMetadataUnaryRPC(t *testing.T, e env) {
if err != nil {
t.Fatalf("TestService.UnaryCall(%v, _, _, _) = _, %v; want _, <nil>", ctx, err)
}
if e.security == "tls" {
delete(header, "transport_security_type")
delete(trailer, "transport_security_type")
}
if !reflect.DeepEqual(testMetadata, header) {
t.Fatalf("Received header metadata %v, want %v", header, testMetadata)
}
@ -790,9 +785,6 @@ func testMetadataStreamingRPC(t *testing.T, e env) {
}
// test the cached value.
headerMD, err = stream.Header()
if e.security == "tls" {
delete(headerMD, "transport_security_type")
}
if err != nil || !reflect.DeepEqual(testMetadata, headerMD) {
t.Errorf("#2 %v.Header() = %v, %v, want %v, <nil>", stream, headerMD, err, testMetadata)
}
@ -823,9 +815,6 @@ func testMetadataStreamingRPC(t *testing.T, e env) {
}
}
trailerMD := stream.Trailer()
if e.security == "tls" {
delete(trailerMD, "transport_security_type")
}
if !reflect.DeepEqual(testMetadata, trailerMD) {
t.Fatalf("%v.Trailer() = %v, want %v", stream, trailerMD, testMetadata)
}

Просмотреть файл

@ -55,9 +55,9 @@ import (
type http2Client struct {
target string // server name/addr
userAgent string
conn net.Conn // underlying communication channel
conn net.Conn // underlying communication channel
authInfo credentials.AuthInfo // auth info about the connection
nextID uint32 // the next stream ID to be used
nextID uint32 // the next stream ID to be used
// writableChan synchronizes write access to the transport.
// A writer acquires the write lock by sending a value on writableChan

Просмотреть файл

@ -62,7 +62,7 @@ const (
)
var (
clientPreface = []byte(http2.ClientPreface)
clientPreface = []byte(http2.ClientPreface)
http2RSTErrConvTab = map[http2.ErrCode]codes.Code{
http2.ErrCodeNo: codes.Internal,
http2.ErrCodeProtocol: codes.Internal,