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 1996/01/04 08:03:08 UTC

Internal Redirect Patch

Having observed no opposition to the idea, I am submitting a patch for
the 1.1b internal_redirect code.  It causes the new query to have the same
method type as the original.  The current function hard codes the redirected
request into a GET, which is not always desireable.

-- snip --
From: asussman@vidya.com (Adam Sussman)
Subject: Preserve HTTP Method accross an internal redirect.
Affects: http_protocol.c
ChangeLog: The current internal_redirect() function causes the new request to
	always be a GET request.  This patch causes the internal_redirect
	function to create a new request which is of the same method type
	as the original.

*** http_request.c.old	Fri Nov 17 13:33:15 1995
--- http_request.c	Wed Jan  3 01:34:14 1996
***************
*** 658,671 ****
      new->prev = r;
      r->next = new;
      
-     /* We are redirecting.  Treat the internally generated transaction
-      * as a GET, since there is not a chance of its getting POST-style
-      * arguments.   
-      */
-     new->method = "GET";
-     new->method_number = M_GET;
- 
      /* Inherit the rest of the protocol info... */
      
      new->status = r->status;
      new->assbackwards = r->assbackwards;
--- 658,667 ----
      new->prev = r;
      r->next = new;
      
      /* Inherit the rest of the protocol info... */
+ 
+     new->method = pstrdup(r->pool, r->method);
+     new->method_number = r->method_number;
      
      new->status = r->status;
      new->assbackwards = r->assbackwards;

Re: Internal Redirect Patch

Posted by Alexei Kosut <ak...@nueva.pvt.k12.ca.us>.
On Wed, 3 Jan 1996, Adam Sussman wrote:

> 
> Having observed no opposition to the idea, I am submitting a patch for
> the 1.1b internal_redirect code.  It causes the new query to have the same
> method type as the original.  The current function hard codes the redirected
> request into a GET, which is not always desireable.

Yes... your patch looks good, with one exception: you *must* then have
mod_cgi.c hard-set the method to GET. The reason for this is, as I said
earlier, if you have a script POSTed to, which then sends an internal
redirect to another CGI script. So I would add the following to the patch: 

*** mod_cgi.c.orig      Wed Jan  3 23:10:33 1996
--- mod_cgi.c   Wed Jan  3 23:11:17 1996
***************
*** 315,320 ****
--- 315,323 ----
                continue;
            kill_timeout (r);

+           r->method = pstrdup(r->pool, "GET");
+           r->method_number = M_GET;
+
            internal_redirect (location, r);
            return OK;
          }


--/ Alexei Kosut <ak...@nueva.pvt.k12.ca.us> /--------/ Lefler on IRC
----------------------------/ <http://www.nueva.pvt.k12.ca.us/~akosut/>
The viewpoints expressed above are entirely false, and in no way
represent Alexei Kosut nor any other person or entity. /--------------