Skip to content

Doesn't handle messages split over multiple lines #42

@timhaines

Description

@timhaines

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..).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions