jhthorsen / mojo-irc

IRC Client for the Mojo IOLoop
15 stars 13 forks source link

Fix parsing to allow CR or LF at buffer end. #24

Closed kanatohodets closed 9 years ago

kanatohodets commented 9 years ago

I started using Mojo::IRC and noticed it seemingly not getting any data, even under DEBUG. Turns out the goofball server I was talking to only emits \n, so Mojo::IRC::_read was failing to match. I added square brackets around the closing \r\n to allow either and life is good. All existing tests pass.

I added a link to the relevant bit of IRC spec by way of reference (I imagine you guys have spent a lot of time with this document, I just didn't want this hack to seem entirely unfounded :))

Unfortunately, due to backward compatibility requirements ... any LF or CR anywhere in a message marks the end of that message (instead of requiring CR-LF);

Happy to do any cleanup you'd like, I'd love to use Mojo::IRC for this quick project of mine!

jhthorsen commented 9 years ago

LGTM. I've asked @kanatohodets to also change Test::Mojo::IRC to not care about "\r". That way if all the unit tests still go through, we should be good to go.

marcusramberg commented 9 years ago

LGTM.