- cgi = NULL;
-
- if (reqc->cgiroot) {
- cgi = strstr(r->uri, "cgi-bin/");
- if (cgi && (cgi != r->uri + strspn(r->uri, "/"))) {
- cgi = NULL;
- }
- }
- if (cgi) {
- /* Set exact filename for CGI script */
- cgi = apr_pstrcat(r->pool, reqc->cgiroot, cgi + strlen("cgi-bin"), NULL);
- if ((cgi = ap_server_root_relative(r->pool, cgi))) {
- ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r,
- "[mod_vhost_ldap.c]: ap_document_root is: %s",
- ap_document_root(r));
- r->filename = cgi;
- r->handler = "cgi-script";
- apr_table_setn(r->notes, "alias-forced-type", r->handler);
- }
- } else if (r->uri[0] == '/') {
- /* we don't set r->filename here, and let other modules do it
- * this allows other modules (mod_rewrite.c) to work as usual
- */
- /* r->filename = apr_pstrcat (r->pool, reqc->docroot, r->uri, NULL); */
- } else {
- /* We don't handle non-file requests here */
- return DECLINED;
- }
-
- server->server_hostname = reqc->name;
-
- if (reqc->admin) {
- server->server_admin = reqc->admin;
- }
-
- /* Stolen from server/core.c */
-
- /* Make it absolute, relative to ServerRoot */
- reqc->docroot = ap_server_root_relative(r->pool, reqc->docroot);
-
- if (reqc->docroot == NULL) {
- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
- "[mod_vhost_ldap.c] set_document_root: DocumentRoot must be a directory");
-
- return HTTP_INTERNAL_SERVER_ERROR;
- }
-
- /* TODO: ap_configtestonly && ap_docrootcheck && */
- if (apr_filepath_merge((char**)&core->ap_document_root, NULL, reqc->docroot,
- APR_FILEPATH_TRUENAME, r->pool) != APR_SUCCESS
- || !ap_is_directory(r->pool, reqc->docroot)) {
-
- ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r,
- "[mod_vhost_ldap.c] set_document_root: Warning: DocumentRoot [%s] does not exist",
- reqc->docroot);
- core->ap_document_root = reqc->docroot;
- }
-