httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Roy T. Fielding" <field...@kiwi.ICS.UCI.EDU>
Subject [PATCH] CGI outputting Location: redirect not working
Date Sun, 09 Feb 1997 08:34:00 GMT
This patch fixes the problem with mod_cgi-generated internal redirects
trying to read the request message-body twice. As submitted by
Archie Cobbs <archie@whistle.com>, with the addition of comments and
the removal of the redundant check in should_client_block.

The owners of mod_fastcgi and mod_php (and any other input-reading modules
that might generate an internal redirect) should check their code for the
same problem.

.....Roy

Index: mod_cgi.c
===================================================================
RCS file: /export/home/cvs/apache/src/mod_cgi.c,v
retrieving revision 1.31
diff -c -r1.31 mod_cgi.c
*** mod_cgi.c	1997/01/25 03:08:33	1.31
--- mod_cgi.c	1997/02/09 08:24:07
***************
*** 482,487 ****
--- 482,493 ----
  	    r->method = pstrdup(r->pool, "GET");
  	    r->method_number = M_GET;
  
+ 	    /* We already read the message body (if any), so don't allow
+ 	     * the redirected request to think it has one.  We can ignore 
+ 	     * Transfer-Encoding, since we used REQUEST_CHUNKED_ERROR.
+ 	     */
+ 	    table_unset(r->headers_in, "Content-Length");
+ 
  	    internal_redirect_handler (location, r);
  	    return OK;
          }
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.98
diff -c -r1.98 http_protocol.c
*** http_protocol.c	1997/02/06 21:40:35	1.98
--- http_protocol.c	1997/02/09 08:24:08
***************
*** 1199,1207 ****
  
  int should_client_block (request_rec *r)
  {
-     if (is_HTTP_ERROR(r->status))
-        return 0;
- 
      if (!r->read_chunked && (r->remaining <= 0))
          return 0;
  
--- 1199,1204 ----

Mime
View raw message