eventsource icon indicating copy to clipboard operation
eventsource copied to clipboard

Events dropped in streams with mixed CRLF and LF line terminators.

Open WcRnm opened this issue 2 years ago • 3 comments

v2.0.2.

The server sent events spec states that lines must be terminated by LF, CR, or CRLF.

In the case where the field is terminated by a CRLF and the data and dispatch lines use a single LF, no events are emitted.

WcRnm avatar Nov 16 '23 23:11 WcRnm

Maybe they should be unified?

piranna avatar Nov 17 '23 06:11 piranna

Maybe they should be unified?

My first thought was that the code on the server I'm testing against should be fixed, but it does conform to the specification. These server-sent events are processed as expected by the EventSource implemented on browsers, and one should expect this implementation to process them as well.

This behavior is actually a secondary issue caused by a parsing bug in the eventsource code where each incoming packet is parsed repeatedly from the beginning, rather from the current offset.

I should be able to submit a PR soon.

WcRnm avatar Nov 17 '23 16:11 WcRnm

Is this project totally dead or what??

markedwards avatar Jun 24 '24 20:06 markedwards