Fix an infinite loop in SslHandler due to mysterious BUFFER_OVERFLOW state

- Fixes #1134