move cgi headers parsing to cgi.c