fix infinite loop when the initial two characters in a connection are \r\n