-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle the body is undefined from AMQP 1.0 to AMQP 091 #6835
Conversation
thanks to @gpad for reporting the bug |
8558ee9
to
d889de0
Compare
If the body is undefined the payload return empty binary Signed-off-by: Gabriele Santomaggio <[email protected]> remove comments Signed-off-by: Gabriele Santomaggio <[email protected]>
d889de0
to
ceb78b7
Compare
Handle the body is undefined from AMQP 1.0 to AMQP 091 (backport #6835)
Note that each AMQP message must contain a body:
|
@ansd Yes. We could add this constraint on the client side or handle it on the server side but with better error handling. |
Null message body is forbidden in the AMQP 1.0 specification. We set a data section with an empty binary when the message body has not been set. Stream messages are not checked on the server side, but messages from other protocols will be checked for a non-null body in RabbitMQ 4.0, and letting null body stream messages through will crash when those messages are read with other protocols. References rabbitmq/rabbitmq-server#6835 Fixes #544
Null message body is forbidden in the AMQP 1.0 specification. We set a data section with an empty binary when the message body has not been set. Stream messages are not checked on the server side, but messages from other protocols will be checked for a non-null body in RabbitMQ 4.0, and letting null body stream messages through will crash when those messages are read with other protocols. References rabbitmq/rabbitmq-server#6835 Fixes #544
Fixes part of #6837
If the body is undefined, the payload returns an empty binary.
Signed-off-by: Gabriele Santomaggio [email protected]
This PR fixes a bug in case the native stream client sends a message without a body and an AMQP client reads the message.
example:
then try to read in AMQP:
The server raises:
This because:
rabbitmq-server/deps/rabbit/src/rabbit_msg_record.erl
Lines 221 to 224 in aa02e32
Does not consider the empty data
Proposed Changes
With this fix, the function returns an empty binary
<<>>
When the body message is not defined.Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply.You can also fill these out after creating the PR.
If you're unsure about any of them, don't hesitate to ask on the mailing list.
We're here to help!
This is simply a reminder of what we are going to look for before merging your code.
CONTRIBUTING.md
document