httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gst...@apache.org
Subject cvs commit: httpd-2.0/server protocol.c
Date Wed, 25 Sep 2002 01:51:13 GMT
gstein      2002/09/24 18:51:13

  Modified:    server   protocol.c
  Log:
  Minor simplification... The can_send_content_length variable is
  redundant with ctx->data_sent.
  
  Revision  Changes    Path
  1.118     +13 -19    httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.117
  retrieving revision 1.118
  diff -u -r1.117 -r1.118
  --- protocol.c	17 Sep 2002 01:14:57 -0000	1.117
  +++ protocol.c	25 Sep 2002 01:51:13 -0000	1.118
  @@ -1212,8 +1212,9 @@
    * of bytes sent to the client.  This means that this filter will always run
    * through all of the buckets in all brigades
    */
  -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(ap_filter_t *f,
  -                                         apr_bucket_brigade *b)
  +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_content_length_filter(
  +    ap_filter_t *f,
  +    apr_bucket_brigade *b)
   {
       request_rec *r = f->r;
       struct content_length_ctx *ctx;
  @@ -1221,20 +1222,10 @@
       int eos = 0;
       apr_read_type_e eblock = APR_NONBLOCK_READ;
   
  -    int can_send_content_length;
  -
  -    /* We can only set a C-L in the response header if we
  -     * haven't already sent any buckets on to the next
  -     * output filter for this request.
  -     */
       ctx = f->ctx;
       if (!ctx) {
  -        f->ctx = ctx = apr_palloc(r->pool, sizeof(struct content_length_ctx));
  +        f->ctx = ctx = apr_palloc(r->pool, sizeof(*ctx));
           ctx->data_sent = 0;
  -        can_send_content_length = 1;
  -    }
  -    else {
  -        can_send_content_length = (ctx->data_sent == 0);
       }
   
       /* Loop through this set of buckets to compute their length
  @@ -1260,8 +1251,8 @@
                   r->bytes_sent += len;
               }
               else if (APR_STATUS_IS_EAGAIN(rv)) {
  -                /* Output everything prior to this bucket, and
  -                 * do a blocking read
  +                /* Output everything prior to this bucket, and then
  +                 * do a blocking read on the next batch.
                    */
                   if (e != APR_BRIGADE_FIRST(b)) {
                       apr_bucket_brigade *split = apr_brigade_split(b, e);
  @@ -1272,7 +1263,7 @@
                       }
                       b = split;
                       e = APR_BRIGADE_FIRST(b);
  -                    can_send_content_length = 0;
  +
                       ctx->data_sent = 1;
                   }
                   eblock = APR_BLOCK_READ;
  @@ -1292,9 +1283,12 @@
       }
   
       /* If we've now seen the entire response and it's otherwise
  -     * okay to set the C-L in the response header, do so now:
  -         */
  -    if (can_send_content_length && eos) {
  +     * okay to set the C-L in the response header, then do so now.
  +     *
  +     * We can only set a C-L in the response header if we haven't already
  +     * sent any buckets on to the next output filter for this request.
  +     */
  +    if (ctx->data_sent == 0 && eos) {
           ap_set_content_length(r, r->bytes_sent);
       }
   
  
  
  

Mime
View raw message