httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Sussman <mydd...@vidya.com>
Subject New mod_dir.c patch
Date Thu, 14 Dec 1995 22:31:32 GMT

Here is a new version of the mod_dir.preserve_query patch modified according
to David Robinson's suggestions.  Apply it to whichever version suits you
best.

-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;

Mime
View raw message