What happens if we don't find \r\n\r\n in the first 256 bytes ?
I didn't test but I'm not sure it's not an infinite loop (depends on what returns tcp_read when it is instructed to read 0 bytes).