The do_GET() and do_HEAD() functions are modified to run CGI scripts and serve the output, instead of serving files, if the request leads to somewhere below the cgi_directories path.
cgi_directories
This defaults to ['/cgi-bin', '/htbin'] and describes directories to treat as containing CGI scripts.