parse header and body