Extract check_cgi_mode_bits(). No change intended.