although it'd be much nicer if all the headers got sent right before the first .write() goes through