Better error handling in dispatch_cgi() and parse_cgi_parameters()