ResourceLoader: emit headers before the content, silly me

Backport #2901