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

Doesn't handle messages split over multiple lines #42

Open
timhaines opened this issue Jan 31, 2015 · 0 comments
Open

Doesn't handle messages split over multiple lines #42

timhaines opened this issue Jan 31, 2015 · 0 comments

Comments

@timhaines
Copy link

Using sitestreams, sometimes messages are split over multiple lines (possibly in userstreams too - I don't know?).

There's a few changes that need to be made to handle split lines with this library, but I wanted to point out a non-obvious one.

If a message is split, the split can be anywhere in the message content. Sometimes this means a space from the message is at the start or end of a split line.

The parse_stream_line method starts out by calling ln.strip! with the intention of removing the leading newline. This is problematic, as it also removes the leading or trailing space when they should be there in split lines, causing data corruption.

Changing ln.strip! to ln[0] = '' resolves the issue - but you probably also want to update later checks for ln.empty? as the heartbeat signals from Twitter will now look like "\n" instead of being empty strings (or something similar to this..).

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

No branches or pull requests

1 participant