Generalizing body parsing and fixing header parsing