guzzle/streams — pull request #28 by checat (2014-10-19 11:16:28+00:00)
Title: Fix Utils::readline() for Windows. Add optional $eol. Change $maxLength

PHP_EOL is used in Utils::readline(). First problem is clear: PHP_EOL is two-character on windows, so `$byte == PHP_EOL` will never match. This may be solved with either `$byte === substr(PHP_EOL, -1)` or `substr($buffer, -strlen(PHP_EOL)) === PHP_EOL`

Second problem is less obvious. If this function is used to read the stream opened with fopen() in text mode, read bytes will be already translated to "\n". If this function is used to read some network protocol, then protocol EOL may differ from platform EOL. So use of PHP_EOL is not right. The only way I see to fix this is providing optional parameter `$eol = PHP_EOL`.

Unrelated fix is regarding `++$size == $maxLength - 1` which means only $maxLength - 1 buffer size is allowed, not $maxLength. It looks intentional, but not clearly stated, so I've fixed it to use full $maxLength.