restore res.end/res.write back after rewrite