Closed rainerjung closed 5 years ago
I noticed, that getline() often returns undefined, although data is available.
That's new to me and I don't have any example to trigger this behavior either (and you don't provide any). ERROR_WANT_READ and ERROR_WANT_WRITE should only happen if the socket is set to non-blocking. getline should not be expected to work correctly with a non-blocking socket because to work correctly (i.e. return only full lines) it might need to read more data than are currently available, i.e. need a blocking socket.
I noticed, that getline() often returns undefined, although data is available.
The reason is, that readline() andles EINTR and EWOULDBLOCK, but must also handle ERROR_WANT_READ and ERROR_WANT_WRITE. A good example as a starting point is Net::SSLeay::ssl_read_all():
Maybe Net::SSLeay::ssl_read_until() can be used which internally calls ssl_read_all. And for getline() something like Net::SSLeay::ssl_read_CRLF()?
I only looked at Net::SSLeay current dev version, not sure what of that is available in latest stable.