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/14 22:41:22 UTC
patch to repair .asis
Here's a patch to repair .asis handling of local redirects.
If a .asis asks for a local redirect, there's little point in
handing that to the client which will get confused (the OS/2
browsers barfs, Netscape puts the servername in for you, others.. who
knows?)
So, this patch intercepts local redirects from a .asis and handles
them locally.
-=-=-=-=-=-=-
*** 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);