You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@ooo.lanl.gov> on 1996/05/16 18:41:17 UTC

asis patch

nobody moaned about my .asis patch, so will one of the CVS unchallenged
please add it. The CHANGES text to go with it is..

  mod_asis used to pass on a Location header that refered to a local
  URL to the client. This is bad for clients (which react differently)
  and unlikely to be the behaviour the user expected. Local redirects
  from .asis are now handled locally (by Apache).

=-=-=-=-

here it is again...



*** mod_asis.c.orig	Tue May 14 14:26:36 1996
--- mod_asis.c	Tue May 14 14:33:55 1996
***************
*** 62,67 ****
--- 62,68 ----
  int asis_handler (request_rec *r)
  {
      FILE *f;
+     char *location;
      
      if (r->method_number != M_GET) return DECLINED;
      if (r->finfo.st_mode == 0) {
***************
*** 77,82 ****
--- 78,99 ----
      }
        
      scan_script_header (r, f);
+     location = table_get (r->headers_out, "Location");
+ 
+     if (location && location[0] == '/' && 
+         (r->status == 200 || r->status == 301 || r->status == 302)) {
+ 
+         r->status = 200; /* Assume 200 status on whatever we're pointing to */
+ 
+ 	/* This redirect needs to be a GET no matter what the original
+ 	 * method was.
+ 	*/
+ 	r->method = pstrdup(r->pool, "GET");
+ 	r->method_number = M_GET;
+ 
+ 	internal_redirect_handler (location, r);
+ 	return OK;
+     }
      
      soft_timeout ("send", r);
      send_http_header (r);