You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Florent Guillaume <gu...@clipper.ens.fr> on 1995/08/11 21:04:51 UTC

Patch: correct negotiation

In the current negotiation code, "index.old.html" is incorrectly
returned when you ask for "index".

Here is a patch for this.  It depends on my previous patch to mod_mime.c
(cn-any-suffix), so feel free to include it only when cn-any-suffix is
also accepted.

Note that Apache still doesn't return, "filename.html.gz" when you ask for
"filename.gz" (CERN behaviour), this will be a bit more complicated to
achieve (and it's a feature some people will want to disallow).


	Florent


*** httpd.h.orig	Sun Aug  6 22:42:47 1995
--- httpd.h	Fri Aug 11 20:37:51 1995
***************
*** 308,313 ****
--- 308,314 ----
    
    char *uri;
    char *filename;
+   char *basename;		/* basename (no path nor typing suffix) */
    char *path_info;
    char *args;			/* QUERY_ARGS, if any */
    struct stat finfo;		/* ST_MODE set to zero if no such file */
*** mod_mime.c.orig	Fri Aug 11 20:08:00 1995
--- mod_mime.c	Fri Aug 11 20:37:39 1995
***************
*** 243,248 ****
--- 243,257 ----
  	    break;
      }
  
+     /*
+      * Store the basename of the file: no path and no typing suffix.
+      */
+     r->basename = strrchr (fn, '/');
+     if (r->basename)
+ 	r->basename++;
+     else
+ 	r->basename = fn;
+ 
      if (did_type || did_lang || did_enc)
  	return OK;
  
*** mod_negotiation.c.orig	Fri Aug 11 20:47:56 1995
--- mod_negotiation.c	Fri Aug 11 20:47:21 1995
***************
*** 672,677 ****
--- 672,680 ----
  	
  	if (sub_req->status != 200 || !sub_req->content_type) continue;
  	
+ 	/* If there were dummy suffixes, it's not a match. */
+ 	if (sub_req->basename && strcmp (sub_req->basename, filp)) continue;
+ 
  	/* If it's a map file, we use that instead of the map
  	 * we're building...
  	 */