Avoid duplicate Begin/End records on ESI subrequests

When starting an ESI subrequest, make sure that the Begin/End headers
are only output once, formatted for ESI.

Fixes: #1441