Skip to content
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

parsing: fixed parsing frames with attributes contained dashes #37

Merged
merged 1 commit into from
Sep 17, 2024

Conversation

cheshirskycode
Copy link
Contributor

Hello!

I'm building a prototype of 0.9.1 amqp server using amq-protocol and found issue with parsing frames with arguments contained dashes. It doesn't affect lapin as the client library.

Example:

#[test]
    fn test_parse_declare_queue_frame() {
        let frame = AMQPFrame::Method(
            1,
            AMQPClass::Queue(queue::AMQPMethod::Declare(queue::Declare {
                queue: "some_queue".into(),
                passive: true,
                durable: true,
                exclusive: true,
                auto_delete: true,
                nowait: true,
                arguments: Default::default(),
            })),
        );

        let mut buffer = vec![0u8; 30];

        assert!(gen_frame(&frame)(buffer.as_mut_slice().into()).is_ok());
        assert_eq!(parse_frame(buffer.as_slice()), Ok((&[][..], frame)));
    }

Output:

assertion `left == right` failed
  left: Ok(([], Method(1, Queue(Declare(Declare { queue: ShortString("some_queue"), passive: true, durable: true, exclusive: true, auto_delete: false, nowait: true, arguments: FieldTable({}) })))))
 right: Ok(([], Method(1, Queue(Declare(Declare { queue: ShortString("some_queue"), passive: true, durable: true, exclusive: true, auto_delete: true, nowait: true, arguments: FieldTable({}) })))))

The source is serialized as auto_delete: true and parsed as auto_delete: false

@Keruspe
Copy link
Collaborator

Keruspe commented Sep 17, 2024

Thanks!
Your project sounds fun btw.
I'll try to issue a release soon

@Keruspe Keruspe merged commit 2174c29 into amqp-rs:main Sep 17, 2024
15 checks passed
@cheshirskycode cheshirskycode deleted the fixed_parsing_flags_with_dash branch September 17, 2024 15:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants