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

Don't crash when a message is split in the middle of the payload length field. #22

Merged
merged 1 commit into from
Sep 18, 2022

Conversation

thejoelw
Copy link
Contributor

Today, when a packet happens to be split in the middle of the frame length, the :malformed_payload_length error will be returned. However, we should just buffer it so we can finish processing it when the next message arrives.

Example packet ending: "...}\n\x82~\x01"

Error: {:malformed_payload_length, <<252, 1::size(7)>>}

@coveralls
Copy link

Pull Request Test Coverage Report for Build c06e81a81b9d62a18bb3c48fe8e4af1cf5dfb4e8-PR-22

  • 0 of 2 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.952%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/mint/web_socket/frame.ex 0 2 0.0%
Totals Coverage Status
Change from base Build 491b763312030402695863076d30404d8b5f9224: 0.0%
Covered Lines: 314
Relevant Lines: 353

💛 - Coveralls

Copy link
Collaborator

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I agree, the original matches are too restrictive.

@the-mikedavis the-mikedavis merged commit c06e81a into elixir-mint:main Sep 18, 2022
@the-mikedavis
Copy link
Collaborator

Thanks! I released this as v1.0.1

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.

3 participants