Add optional callbacks to output_hdr and output_fragment

Using this in my SSE server.