You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Adam Sussman <my...@vidya.com> on 1995/12/19 03:40:09 UTC

mod_dir patch

Here is a new version of the mod_dir.c patch modified accordng to suggestions
from this list.  I would like to submit it as a patch for the 1.1 version.

-adam

-- snip --

From: asussman@vidya.com (Adam Sussman)
Subject: Preserve query portion of URL in mod_dir.c redirects
Affects: mod_dir.c
ChangeLog: Internal redirects which occur in mod_dir.c do not preserve the
	query portion of a request (the bit after the question mark).  If
	the directory index is redirected to a script or has an include,
	the query string is lost before invocation.

*** mod_dir.c.orig	Fri Nov 17 13:33:16 1995
--- mod_dir.c	Thu Dec 14 04:09:44 1995
***************
*** 768,774 ****
      if (r->method_number != M_GET) return NOT_IMPLEMENTED;
      
      if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
!         char* ifile = pstrcat (r->pool, r->uri, "/", NULL);
  	table_set (r->headers_out, "Location",
  		   construct_url(r->pool, ifile, r->server));
  	return REDIRECT;
--- 768,781 ----
      if (r->method_number != M_GET) return NOT_IMPLEMENTED;
      
      if (r->uri[0] == '\0' || r->uri[strlen(r->uri)-1] != '/') {
! 	char* ifile;
! 	if (r->args != NULL)
!         	ifile = pstrcat (r->pool, escape_uri(r->pool, r->uri),
! 			"/", "?", r->args, NULL);
! 	else
!         	ifile = pstrcat (r->pool, escape_uri(r->pool, r->uri),
! 			 "/", NULL);
! 
  	table_set (r->headers_out, "Location",
  		   construct_url(r->pool, ifile, r->server));
  	return REDIRECT;
***************
*** 787,793 ****
  	request_rec *rr = sub_req_lookup_uri (name_ptr, r);
             
  	if (rr->status == 200 && rr->finfo.st_mode != 0) {
!             char *new_uri = escape_uri(r->pool, rr->uri);
  	    destroy_sub_req (rr);
  	    internal_redirect (new_uri, r);
  	    return OK;
--- 794,806 ----
  	request_rec *rr = sub_req_lookup_uri (name_ptr, r);
             
  	if (rr->status == 200 && rr->finfo.st_mode != 0) {
! 	    char* new_uri = escape_uri(r->pool, rr->uri);
! 
! 	    if (rr->args != NULL)
! 		new_uri = pstrcat(r->pool, new_uri, "?", rr->args, NULL);
! 	    else if (r->args != NULL)
! 		new_uri = pstrcat(r->pool, new_uri, "?", r->args, NULL);
! 	
  	    destroy_sub_req (rr);
  	    internal_redirect (new_uri, r);
  	    return OK;