Description
What version of gRPC are you using?
1.31.1
What version of Go are you using (go version
)?
go version go1.15 linux/amd64
What operating system (Linux, Windows, …) and version?
Ubuntu 20.04
What did you do?
I am writing server that communicates with the dockerfile frontend in buildkit. This client/server communication is quite atypical since it doesn't happen through TCP or UDS, but instead it happens directly through stdio.
The dockerfile frontend (which uses the go-grpc lib) is sending an HTTP2 request with an empty authority header, and the server, which is implemented using h2 is (rightfully) rejecting it since an empty string isn't a valid authority.
This issue was already opened in #2628 but the fix involved was special-casing the UDS code path, which doesn't cover my scenario.
What did you expect to see?
A valid authority header. I don't really care about the content as long as it is RFC-compliant. In my case, I have verified that I am still hitting the following code path:
https://github.com/grpc/grpc-go/blob/master/clientconn.go#L276
Which returns an empty string. I have been able to fix it locally by adding the following code, but I am not knowledgeable about Go, GRPC or HTTP2 so I have no idea whether the change is a good idea or not:
} else {
// Use endpoint from "scheme://authority/endpoint" as the default
// authority for ClientConn.
cc.authority = cc.parsedTarget.Endpoint
if cc.authority == "" {
cc.authority = "default"
}
}
What did you see instead?
An empty authority header:
[2020-08-28T16:16:14Z DEBUG h2::server] malformed headers: malformed authority (b""): empty string