@@ -31,23 +31,23 @@ const (
31
31
GrpcUnauthenticated = "16"
32
32
)
33
33
34
+ // +------------+---------------------------------------------+
35
+ // | 1 byte | 4 bytes |
36
+ // +------------+---------------------------------------------+
37
+ // | Compressed | Message Length |
38
+ // | Flag | (uint32) |
39
+ // +------------+---------------------------------------------+
40
+ // | |
41
+ // | Message Data |
42
+ // | (variable length) |
43
+ // | |
44
+ // +----------------------------------------------------------+
45
+ // See https://grpc.github.io/grpc/core/md_doc__p_r_o_t_o_c_o_l-_h_t_t_p2.html
34
46
func getProtobufData (r * http.Request ) ([]byte , error ) {
35
47
reqBody , err := io .ReadAll (r .Body )
36
48
if err != nil {
37
49
return nil , & httpserver.ErrorWithStatusCode {StatusCode : http .StatusInternalServerError , Err : fmt .Errorf ("cannot read request body: %s" , err )}
38
50
}
39
- // +--------+-------------------------------------------------+
40
- // | 1 byte | 4 bytes |
41
- // +--------+-------------------------------------------------+
42
- // | Compressed | Message Length |
43
- // | Flag | (uint32) |
44
- // +------------+---------------------------------------------+
45
- // | |
46
- // | Message Data |
47
- // | (variable length) |
48
- // | |
49
- // +----------------------------------------------------------+
50
- // See https://grpc.github.io/grpc/core/md_doc__p_r_o_t_o_c_o_l-_h_t_t_p2.html
51
51
if len (reqBody ) < 5 {
52
52
return nil , & httpserver.ErrorWithStatusCode {StatusCode : http .StatusBadRequest , Err : fmt .Errorf ("invalid grpc header length: %d" , len (reqBody ))}
53
53
}
0 commit comments