You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by "Roy T. Fielding" <fi...@kiwi.ICS.UCI.EDU> on 1997/07/01 00:39:38 UTC

[PATCH] Maintain state of request body read across internal redirs

Ummm, I forgot a couple minor details, like the parts that actually fix
the problem.  Also, I changed the variable name to protect the innocent.

  *) Request processing now retains state of whether or not the request
     body has been read, so that internal redirects and subrequests will
     not try to read it twice (and block). [Roy Fielding]

Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache/src/httpd.h,v
retrieving revision 1.119
diff -c -r1.119 httpd.h
*** httpd.h	1997/06/29 19:19:36	1.119
--- httpd.h	1997/06/30 22:38:47
***************
*** 487,492 ****
--- 487,493 ----
    long read_length;		/* bytes that have been read */
    int read_body;   		/* how the request body should be read */
    int read_chunked;		/* reading chunked transfer-coding */
+   int begun_read_body;   	/* false (0) until first get_client_block */
  
    /* MIME header environments, in and out.  Also, an array containing
     * environment variables to be passed to subprocesses, so people can
Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.129
diff -c -r1.129 http_protocol.c
*** http_protocol.c	1997/06/29 17:56:47	1.129
--- http_protocol.c	1997/06/30 22:38:49
***************
*** 871,876 ****
--- 871,877 ----
      
      rnew->read_length = r->read_length;
      rnew->read_body   = REQUEST_NO_BODY;
+     rnew->begun_read_body = r->begun_read_body;
      
      rnew->main = (request_rec *)r;
  }
***************
*** 1348,1354 ****
  
  int should_client_block (request_rec *r)
  {
!     if (is_HTTP_ERROR(r->status))
          return 0;
  
      if (!r->read_chunked && (r->remaining <= 0))
--- 1349,1355 ----
  
  int should_client_block (request_rec *r)
  {
!     if (r->begun_read_body || is_HTTP_ERROR(r->status))
          return 0;
  
      if (!r->read_chunked && (r->remaining <= 0))
***************
*** 1399,1404 ****
--- 1400,1407 ----
      int c;
      long len_read, len_to_read;
      long chunk_start = 0;
+ 
+     r->begun_read_body = 1;
  
      if (!r->read_chunked) {                 /* Content-length read */
          len_to_read = (r->remaining > bufsiz) ? bufsiz : r->remaining;
Index: http_request.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_request.c,v
retrieving revision 1.53
diff -c -r1.53 http_request.c
*** http_request.c	1997/06/28 21:46:57	1.53
--- http_request.c	1997/06/30 22:38:49
***************
*** 1097,1102 ****
--- 1097,1104 ----
  				  */
      new->no_local_copy = r->no_local_copy;
  
+     new->begun_read_body = r->begun_read_body;  /* We can only read it once */
+ 
      ap_snprintf (t, sizeof(t), "%d", r->status);
      table_set (new->subprocess_env, "REDIRECT_STATUS", pstrdup (r->pool, t));
  

Re: [PATCH] Maintain state of request body read across internal redirs

Posted by Alexei Kosut <ak...@organic.com>.
On Mon, 30 Jun 1997, Roy T. Fielding wrote:

> Ummm, I forgot a couple minor details, like the parts that actually fix
> the problem.  Also, I changed the variable name to protect the innocent.

Thanks. +1

-- Alexei Kosut <ak...@organic.com>


Re: [PATCH] Maintain state of request body read across internal redirs

Posted by Dean Gaudet <dg...@arctic.org>.
On Mon, 30 Jun 1997, Roy T. Fielding wrote:

> Ummm, I forgot a couple minor details, like the parts that actually fix
> the problem.  Also, I changed the variable name to protect the innocent.
> 
>   *) Request processing now retains state of whether or not the request
>      body has been read, so that internal redirects and subrequests will
>      not try to read it twice (and block). [Roy Fielding]

Can't this same thing be gleaned from r->read_length without adding the
new field?  I haven't stared at Alexei's code enough though to say for
sure.

Dean