Alanxtl opened a new issue, #3496:
URL: https://github.com/apache/dubbo-go/issues/3496

   ### Problem
   
   For Triple non-IDL calls, `protoWrapperCodec` serializes arguments with the 
configured inner codec and stores its name in 
`TripleRequestWrapper.SerializeType`.
   
   However, the server-side generic wrapper decoding path does not use 
`SerializeType` to select the inner codec. 
`protoBinaryCodec.unmarshalWrappedMessage` currently instantiates Hessian2 
directly and attempts to decode the wrapped payload with it. MsgPack decoding 
therefore depends on the Hessian2 attempt failing and the configured fallback 
codec being tried afterward.
   
   This makes inner-codec selection implicit and asymmetric even though the 
wrapper already carries an explicit serialization discriminator.
   
   ### Current behavior
   
   1. The client encodes non-IDL arguments with Hessian2 or MsgPack.
   2. The outer `TripleRequestWrapper` is encoded as Protobuf and includes 
`SerializeType`.
   3. The server parses the outer Protobuf wrapper.
   4. The generic decoding path tries Hessian2 without dispatching on 
`SerializeType`.
   5. Another configured codec may only be reached through fallback behavior.
   
   ### Expected behavior
   
   After decoding the outer Protobuf wrapper, Triple should:
   
   1. Read `TripleRequestWrapper.SerializeType`.
   2. Resolve the matching inner codec from a supported/allowed codec registry.
   3. Decode the wrapped arguments deterministically with that codec.
   4. Return a clear error for unknown, unsupported, or disallowed 
serialization types.
   
   The outer wire format and Content-Type can remain Protobuf; `SerializeType` 
should be the discriminator for the inner payload.
   
   ### Suggested approach
   
   - Introduce deterministic inner-codec lookup keyed by serialization name, 
such as `hessian2` and `msgpack`.
   - Remove the hardcoded Hessian2 choice from the generic wrapper decoding 
path.
   - Validate the requested serialization type against the codecs enabled by 
server policy.
   - Define how the response codec follows the request codec or the configured 
service policy.
   - Preserve compatibility for existing Hessian2 non-IDL clients.
   
   ### Acceptance criteria
   
   - [ ] Hessian2-wrapped requests are decoded through the Hessian2 codec 
selected from `SerializeType`.
   - [ ] MsgPack-wrapped requests are decoded directly through the MsgPack 
codec, without relying on a failed Hessian2 attempt.
   - [ ] Unknown or disabled `SerializeType` values return an explicit 
protocol/serialization error.
   - [ ] Existing Hessian2 behavior remains compatible.
   - [ ] Tests cover Hessian2, MsgPack, unknown type, disabled type, and 
mismatched/corrupted payloads.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to