Closed kriswuollett closed 5 months ago
The grpcurl client fails to work with the Rust tonic-based server on a Unix domain socket because the server expects an authority header.
grpcurl
tonic
% grpcurl -vv -d @ -plaintext -unix -protoset REDACTED/descriptor.bin REDACTED/service.socket REDACTED/Reverse <<EOM { "text": "Hello, world!" } EOM Resolved method descriptor: rpc Reverse ( .REDACTED.ReverseRequest ) returns ( .REDACTED.ReverseResponse ); Request metadata to send: (empty) Response headers received: (empty) Response trailers received: (empty) Sent 1 request and received 0 responses ERROR: Code: Internal Message: stream terminated by RST_STREAM with error code: PROTOCOL_ERROR
For example, I'm able to use the Swift gRPC client fine since it sets authority.
authority
Both tonic/h2 and kubernetes use localhost as the authority when using Unix domain sockets. The grpcurl client should as well.
h2
kubernetes
localhost
The workaround, however inconvenient, is to manually specify the authority as localhost:
% grpcurl -vv -d @ -plaintext -unix -protoset REDACTED/descriptor.bin -authority "localhost" REDACTED/service.socket REDACTED/Reverse <<EOM { "text": "Hello, world!" } EOM Resolved method descriptor: rpc Reverse ( .REDACTED.ReverseRequest ) returns ( .REDACTED.ReverseResponse ); Request metadata to send: (empty) Response headers received: content-type: application/grpc date: Fri, 26 Jan 2024 02:46:38 GMT Estimated response size: 15 bytes Response contents: { "text": "!dlrow ,olleH" } Response trailers received: (empty) Sent 1 request and received 1 response
Seems reasonable. Maybe a patch to default authority to localhost for unix sockets if not otherwise specified?
Yes, something simple like that. I can take a look at doing that tomorrow.
The
grpcurl
client fails to work with the Rusttonic
-based server on a Unix domain socket because the server expects an authority header.For example, I'm able to use the Swift gRPC client fine since it sets
authority
.Both
tonic
/h2
andkubernetes
uselocalhost
as the authority when using Unix domain sockets. Thegrpcurl
client should as well.The workaround, however inconvenient, is to manually specify the authority as localhost: