Parses gRPC's raw HTTP2 traffic in the HTTP2 DATA frame

18 views
Skip to first unread message

yz...@pixielabs.ai

unread,
Jun 19, 2019, 5:35:11 PM6/19/19
to grpc.io
Hi All,

Given a stream of raw HTTP2 traffic between a gRPC server and client, how to extract the protobufs?

We were following gRPC over HTTP2. We are stuck in how to extract the encoded protobuf binary string from the HTTP2 DATA frame. And the spec does not go into more details about the format of how protobuf binary strings are encoded in DATA frames.

We were trying to read the gRPC source code to figure out the protocol, but could not identify the right APIs.

Why? We are sort of reverse-engineering the gRPC protocol. And try to extract the traffic outside of the gRPC server and client, and convert them back into protobufs.

Any pointers on docs that explain the format, or to the APIs inside gRPC source code would be highly appreciated.

Michael Lumish

unread,
Jun 19, 2019, 5:49:47 PM6/19/19
to yz...@pixielabs.ai, grpc.io
You can find the relevant part of the protocol specification doc you linked to by looking for "Length-Prefixed-Message". The sequence of DATA frames is treated as a byte stream containing one or more of those Length-Prefixed-Message. Then each message is arbitrary binary data. If it is a protobuf message then it can be decoded as usual with protobuf. The stream decoder implementation in the JavaScript library might help understand this. That function handles a single DATA frame at a time.

--
You received this message because you are subscribed to the Google Groups "grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email to grpc-io+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/d1538cca-a204-4655-a142-67a2a45e053d%40googlegroups.com.

Yaxiong Zhao

unread,
Jun 24, 2019, 1:29:32 PM6/24/19
to Michael Lumish, grpc.io
Thanks Michael! You are right. I mistakenly concluded that response message is missing the doc for length prefixed message, and forgot that request section has the details. Created https://github.com/grpc/grpc/pull/19450 to add a reference.
Reply all
Reply to author
Forward
0 new messages