Re: [protobuf] Python fails to parse protobuf structure in http body

2021-09-28 Thread 'Adam Cozzette' via Protocol Buffers
You can just parse the containing message normally and then use the usual accessors to access the elements inside the oneof. On Tue, Sep 28, 2021 at 12:15 PM Irad K wrote: > I believe the extra 2 bytes where related to the fact that HttpRequest > Protobuf struct is in fact part union object

Re: [protobuf] Python fails to parse protobuf structure in http body

2021-09-28 Thread Irad K
I believe the extra 2 bytes where related to the fact that HttpRequest Protobuf struct is in fact part union object that may include several other Protobuf structure, and those bytes where identifier that the selected struct is in fact HttpRequest. Do you know how do parse the correct struct

Re: [protobuf] Python fails to parse protobuf structure in http body

2021-09-28 Thread Irad K
Yes, you where right about the first 2 bytes, it was indeed what's corrupted my Protobuf structure. Thanks ! ipdb> message.ParseFromString(data[2:]) 64 ipdb> message.osVersion '11.5.1' On Tuesday, September 28, 2021 at 9:08:49 PM UTC+3 acoz...@google.com wrote: > I think something is wrong

Re: [protobuf] allow_alias true

2021-09-28 Thread 'Adam Cozzette' via Protocol Buffers
No, there is no flag to disable this check. On Mon, Sep 27, 2021 at 1:55 AM hy kam wrote: > Hi, > > I got proto file from other team but they defined as below > enum Aaa{ > *option allow_alias = true;* > MAX_NUMBER = 400; > } > > and I got error during compile > > *"ppp.proto:17:1:

Re: [protobuf] Python fails to parse protobuf structure in http body

2021-09-28 Thread 'Adam Cozzette' via Protocol Buffers
I think something is wrong with that serialized proto. There may be a valid proto in there somewhere, but at least the first few bytes seem to be wrong. I starts with 0x32 which would indicate field number 6 and wire type 2 (see encoding details here