Commit Graph

3 Commits

Author SHA1 Message Date
Huang Qiangxiong c3dea0b98e GRPC: Add support for gRPC-Web
Supporting both application/grpc-web and application/grpc-web-text.
Add test case for grpc-web(-text).

close #17939
2022-03-01 10:19:47 +00:00
Huang Qiangxiong cd2d35c1d2 Protobuf: fix bugs that parsing complex syntax .proto files
Some .proto files contain complex syntax that does not be described in protobuf official site
(https://developers.google.com/protocol-buffers/docs/reference/proto3-spec).

1. Update 'epan/protobuf_lang_parser.lemon' to:
1) Support complex option names format (EBNF):
    optionName = ( ident | "(" fullIdent ")" ) { "." ( ident | "(" fullIdent ")" ) }
for example, "option (complex_opt2).(grault) = 654;".
2) Make enum body support 'reserved' section (EBNF):
    enumBody = "{" { reserved | option | enumField | emptyStatement } "}"
3) Allow the value of field or enumValue option to be "{ ... }" other than constant:
    enumValueOption = optionName  "=" ( constant | customOptionValue ) ";"
    fieldOption = optionName  "=" ( constant | customOptionValue ) ";"
4) Allow 'group' section missing 'label' (for example, in 'oneof' section).
5) Make 'oneof' section support 'option' and 'group' sections (BNF):
    oneof = "oneof" oneofName "{" { oneofField | option | group | emptyStatement } "}"
6) Ignore unused 'extend' section.
7) Fix the bug of one string being splitted into multi-lines.

2. Update 'epan/protobuf_lang_tree.c' to:
8) Fix the bug of parsing repeated option.

3. Update 'test/suite_dissection.py' to add test case for parsing complex syntax .proto files:
  test/protobuf_lang_files/complex_proto_files/unittest_custom_options.proto
  test/protobuf_lang_files/complex_proto_files/complex_syntax.proto
and dependency files:
  test/protobuf_lang_files/well_know_types/google/protobuf/any.proto
  test/protobuf_lang_files/well_know_types/google/protobuf/descriptor.proto

Refer to issue #17046
2020-12-27 11:32:10 +00:00
Huang Qiangxiong dcf6bdda84 Protobuf/gRPC: add test cases for Protobuf and gRPC
Add case_dissect_protobuf and case_dissect_grpc in test/suite_dissection.py.
Add *.proto into the sub directories of test/protobuf_lang_files/.
Run command like 'pytest --program-path .\run\Debug\ -k "grpc or protobuf"'
in build directory (in windows) to test these cases only.
2020-12-01 12:06:43 +00:00