connection_printf_to_buf is crazypants bizarre!
connection_printf_to_buf
's callers expect it to emit a CRLF iff the format string ends with CRLF; it actually emits a CRLF iff (a) the format string ends with CRLF or (b) the resulting string is over 1023 characters long or (c) the format string does not end with CRLF and the resulting string is 1021 characters long or longer. (I may be wrong about the exact string lengths there.)
connection_printf_to_buf
should be made less flaky.