implement protocol to buffer headers and flush on first content written