httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/modules/http http_protocol.c
Date Wed, 08 Aug 2001 15:42:08 GMT
rbb         01/08/08 08:42:08

  Modified:    modules/http http_protocol.c
  Log:
  Re-apply the patch from yesterday that makes ap_http_filter use
  apr_brigade_partition.  In order to do this cleanly, I had to make
  some changes to the apr_brigade_partition API, so this also adds fixes
  all of the calls to that function throughout the server.
  
  Revision  Changes    Path
  1.347     +9 -35     httpd-2.0/modules/http/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/http/http_protocol.c,v
  retrieving revision 1.346
  retrieving revision 1.347
  diff -u -r1.346 -r1.347
  --- http_protocol.c	2001/08/07 19:54:06	1.346
  +++ http_protocol.c	2001/08/08 15:42:08	1.347
  @@ -648,46 +648,20 @@
   
       /* readbytes == 0 is "read a single line". otherwise, read a block. */
       if (*readbytes) {
  +        apr_off_t total;
   
           /* ### the code below, which moves bytes from one brigade to the
              ### other is probably bogus. presuming the next filter down was
              ### working properly, it should not have returned more than
  -           ### READBYTES bytes, and we wouldn't have to do any work. further,
  -           ### we could probably just use brigade_partition() in here.
  +           ### READBYTES bytes, and we wouldn't have to do any work.
           */
   
  -        while (!APR_BRIGADE_EMPTY(ctx->b)) {
  -            const char *ignore;
  +        apr_brigade_partition(ctx->b, *readbytes, &e, APR_NONBLOCK_READ);
  +        APR_BRIGADE_CONCAT(b, ctx->b);
  +        ctx->b = apr_brigade_split(b, e);
  +        apr_brigade_length(b, 1, &total);
  +        *readbytes -= total;
   
  -            e = APR_BRIGADE_FIRST(ctx->b);
  -            if ((rv = apr_bucket_read(e, &ignore, &len, mode)) != APR_SUCCESS)
{
  -                /* probably APR_IS_EAGAIN(rv); socket state isn't correct;
  -                 * remove log once we get this squared away */
  -                ap_log_error(APLOG_MARK, APLOG_ERR, rv, f->c->base_server, 
  -                             "apr_bucket_read");
  -                return rv;
  -            }
  -
  -            if (len) {
  -                /* note: this can sometimes insert empty buckets into the
  -                 * brigade, or the data might come in a few characters at
  -                 * a time - don't assume that one call to apr_bucket_read()
  -                 * will return the full string.
  -                 */
  -                if (*readbytes < len) {
  -                    apr_bucket_split(e, *readbytes);
  -                    *readbytes = 0;
  -                }
  -                else {
  -                    *readbytes -= len;
  -                }
  -                APR_BUCKET_REMOVE(e);
  -                APR_BRIGADE_INSERT_TAIL(b, e);
  -                break; /* once we've gotten some data, deliver it to caller */
  -            }
  -            apr_bucket_delete(e);
  -        }
  -
           /* ### this is a hack. it is saying, "if we have read everything
              ### that was requested, then we are at the end of the request."
              ### it presumes that the next filter up will *only* call us
  @@ -2426,12 +2400,12 @@
           /* these calls to apr_brigade_partition() should theoretically
            * never fail because of the above call to apr_brigade_length(),
            * but what the heck, we'll check for an error anyway */
  -        if ((rv = apr_brigade_partition(bb, range_start, &ec)) != APR_SUCCESS) {
  +        if ((rv = apr_brigade_partition(bb, range_start, &ec, APR_BLOCK_READ)) != APR_SUCCESS)
{
               ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                             PARTITION_ERR_FMT, range_start, clength);
               continue;
           }
  -        if ((rv = apr_brigade_partition(bb, range_end+1, &e2)) != APR_SUCCESS) {
  +        if ((rv = apr_brigade_partition(bb, range_end+1, &e2, APR_BLOCK_READ)) != APR_SUCCESS)
{
               ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
                             PARTITION_ERR_FMT, range_end+1, clength);
               continue;
  
  
  

Mime
View raw message