ktr0731 / grpc-web-go-client

gRPC-Web client written in Go

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Trailer parsing requires whitespace after the colon separating key and value

raboof opened this issue · comments

The gRPC-Web protocol specifies the trailer is encoded as "Key-value pairs encoded as a HTTP/1 headers block (without the terminating newline), per https://tools.ietf.org/html/rfc7230#section-3.2" in the last message in the body of the response.

https://tools.ietf.org/html/rfc7230#section-3.2 specifies that the whitespace between the colon and the field value should be optional. However, the code at https://github.com/ktr0731/grpc-web-go-client/blob/master/grpcweb/parser/parser.go#L82 requires that there is exactly one space of whitespace between the colon and the field value.

This causes the following error when using evans (which is really nice by the way, thanks!) with a server that does not leave a space between the colon and the field value:

helloworld.GreeterService@localhost:8081> call SayHello
name (TYPE_STRING) => asdf
command call: failed to send a request: grpc-web: failed to send a request: failed to parse status and trailer: unexpected EOF

helloworld.GreeterService@localhost:8081> 
commented

Thanks for submitting this issue! I fixed it in #7.

Can confirm this works!

[info] running (fork) example.myapp.CombinedServer 
[info] gRPC server bound to: /127.0.0.1:8080
[info] gRPC-Web server bound to: /127.0.0.1:8081
[info] sayHello to asdf
helloworld.GreeterService@localhost:8081> call SayHello
name (TYPE_STRING) => asdf
{
  "message": "Hello, asdf",
  "timestamp": "1970-01-02T10:17:36.000000123Z"
}

Thanks so much for this wonderful tool!