Remove port when assignning to CallHdr.Host
This commit is contained in:
7
call.go
7
call.go
@ -35,6 +35,7 @@ package grpc
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
@ -114,8 +115,12 @@ func Invoke(ctx context.Context, method string, args, reply proto.Message, cc *C
|
|||||||
o.after(&c)
|
o.after(&c)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
host, _, err := net.SplitHostPort(cc.target)
|
||||||
|
if err != nil {
|
||||||
|
return toRPCErr(err)
|
||||||
|
}
|
||||||
callHdr := &transport.CallHdr{
|
callHdr := &transport.CallHdr{
|
||||||
Host: cc.target,
|
Host: host,
|
||||||
Method: method,
|
Method: method,
|
||||||
}
|
}
|
||||||
topts := &transport.Options{
|
topts := &transport.Options{
|
||||||
|
@ -36,6 +36,7 @@ package grpc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
"net"
|
||||||
|
|
||||||
"github.com/golang/protobuf/proto"
|
"github.com/golang/protobuf/proto"
|
||||||
"golang.org/x/net/context"
|
"golang.org/x/net/context"
|
||||||
@ -95,8 +96,12 @@ type ClientStream interface {
|
|||||||
// by generated code.
|
// by generated code.
|
||||||
func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) {
|
func NewClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (ClientStream, error) {
|
||||||
// TODO(zhaoq): CallOption is omitted. Add support when it is needed.
|
// TODO(zhaoq): CallOption is omitted. Add support when it is needed.
|
||||||
|
host, _, err := net.SplitHostPort(cc.target)
|
||||||
|
if err != nil {
|
||||||
|
return nil, toRPCErr(err)
|
||||||
|
}
|
||||||
callHdr := &transport.CallHdr{
|
callHdr := &transport.CallHdr{
|
||||||
Host: cc.target,
|
Host: host,
|
||||||
Method: method,
|
Method: method,
|
||||||
}
|
}
|
||||||
t, _, err := cc.wait(ctx, 0)
|
t, _, err := cc.wait(ctx, 0)
|
||||||
|
Reference in New Issue
Block a user