httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Pioch <pi...@grasp.insa-lyon.fr>
Subject no subject (file transmission)
Date Wed, 15 Mar 1995 17:17:22 GMT
From: eillihca@drizzle.StanFord.EDU ( Achille Hui, the Day Dreamer )
Newsgroups: comp.infosystems.www.providers
Subject: Re: NCSA httpd: Multiple DirectoryIndex's?
Date: 15 Mar 95 02:21:09 GMT
Organization: Dept. of Physics, Stanford University.
Lines: 133
Message-ID: <eillihca.95031418210919643@drizzle.Stanford.EDU>
References: <3k4ur5$12ea@grasp.insa-lyon.fr>
	<3k4os5$35c@illuminati.io.com>
NNTP-Posting-Host: drizzle.stanford.edu
X-Transfer-Agent: nntp.stanford.edu (NNTP)

+---In <3k4ur5$12ea@grasp.insa-lyon.fr>---
|   pioch@email.enst.fr (Nicolas Pioch) writes...
+---------
| [zachary@io.com (Zachary )]
| [comp.infosystems.www.providers]
|  | Is there a way to get NCSA's httpd to recognize multiple DirectoryInd...
| 
| You can't... that's one of the reasons why I switched to Netsite
| (to have as directory indexes "index.html,index.shtml,index.cgi")
| 
| A list of CERN/WN/NCSA/Netsite features is available on
| 	http://mistral.enst.fr/~pioch/httpd/
| 
| and you'll see which servers support it at the appropriate line.
| 
| Enjoy
| -- Nicolas
| 

One advantage of CERN/WN?/NCSA servers are that you have the source. If you
don't like something, modify it! At the end of this message is the patch for
NCSA httpd1.3 (it should also works for httpd1.3R) to support:

[1] user defined DirectoryIndex (use same authorization check as AddType)
[2] multiple DirectoryIndex

For example, this is the relevant potion of my .htaccess:

Options Indexes FollowSymLinks Includes ExecCGI
DirectoryIndex .index.cgi,.index.html

PS: If one want to use .cgi files to handle a directory, one need to
     uncomment the line:
				AddType application/x-httpd-cgi .cgi
	
     in the srm.conf. Put this in the .htaccess simply won't work.)

--------------------------------------achille (eillihca@drizzle.stanford.edu)
*** src.dist/http_config.c	Sat May  7 19:47:01 PDT 1994
--- src/http_config.c	Tue Mar 14 16:24:55 PST 1995
***************
*** 624,629 ****
--- 624,635 ----
              }
              add_type(w2,w,out);
          }
+         else if(!strcasecmp(w,"DirectoryIndex")) {
+             if(!(or & OR_FILEINFO))
+                 access_syntax_error(n,"override violation",file,out);
+             cfg_getword(w,l);
+             strcpy(index_name,w);
+         } 
          else if(!strcasecmp(w,"DefaultType")) {
              if(!(or & OR_FILEINFO))
                  access_syntax_error(n,"override violation",file,out);
*** src.dist/http_get.c	Sat May  7 19:47:04 PDT 1994
--- src/http_get.c	Tue Mar 14 16:26:48 PST 1995
***************
*** 145,150 ****
--- 145,151 ----
  
      if(S_ISDIR(finfo.st_mode)) {
          char ifile[MAX_STRING_LEN];
+         char ch, *p, *q;
  
          if(file[strlen(file) - 1] != '/') {
              char url[MAX_STRING_LEN];
***************
*** 154,177 ****
              escape_url(url);
              die(REDIRECT,url,fd);
          }
!         make_full_path(file,index_name,ifile);
!         if(stat(ifile,&finfo) == -1) {
!             if(allow_options & OPT_INDEXES)
!                 index_directory(file,fd);
!             else {
!                 log_reason("file permissions deny server access",file);
!                 unmunge_name(file);
!                 die(FORBIDDEN,file,fd);
              }
          }
-         else {
-             probe_content_type(ifile);
-             if(!strcmp(content_type,CGI_MAGIC_TYPE))
-                 send_cgi("GET",ifile,pa,args,&finfo,in,fd);
-             else
-                 send_file(ifile,fd,&finfo,pa,args);
-         }
-         return;
      }
      if(S_ISREG(finfo.st_mode))
          send_file(file,fd,&finfo,pa,args);
--- 155,192 ----
              escape_url(url);
              die(REDIRECT,url,fd);
          }
!         p = &index_name[0];
!         for(;;){
!             /* strip out leading , in front of candidate */
!             for(;*p && (*p == ','); p++);
! 
!             /* if there isn't any candidate, try the default index */
!             if(*p == '\0'){
!                 if(allow_options & OPT_INDEXES)
!                     index_directory(file,fd);
!                 else {
!                     log_reason("file permissions deny server access",file);
!                     unmunge_name(file);
!                     die(FORBIDDEN,file,fd);
!                 } return;
              }
+ 
+             /* remember start of candidate's name and search to its end */
+             for(q = p; (ch = *p) && (ch != ','); p++);
+ 
+             /* construct the path of a potential candidate of a index */
+             *p = '\0'; make_full_path(file,q,ifile); *p = ch;
+             
+             /* great, we find a candidate */
+             if(stat(ifile,&finfo) != -1){
+                 probe_content_type(ifile);
+                 if(!strcmp(content_type,CGI_MAGIC_TYPE))
+                     send_cgi("GET",ifile,pa,args,&finfo,in,fd);
+                 else
+                     send_file(ifile,fd,&finfo,pa,args);
+                 return;
+             }
          }
      }
      if(S_ISREG(finfo.st_mode))
          send_file(file,fd,&finfo,pa,args);


Mime
View raw message