rewrite parse_header