httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@locus.apache.org
Subject cvs commit: apache-2.0/src/main http_protocol.c
Date Tue, 17 Oct 2000 15:29:00 GMT
trawick     00/10/17 08:28:59

  Modified:    src/main http_protocol.c
  Log:
  http_filter():
    when delivering body bytes, only deliver one block of data (however
    much is returned by bucket read) instead of delivering the entire
    body at once; this gets painful with a large body
  
    make a note of an issue with the blocking state of the socket;
    currently, the socket is non-blocking, but when reading body bytes
    we should feel free to wait for body bytes until a timeout occurs;
  
  Revision  Changes    Path
  1.183     +24 -17    apache-2.0/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v
  retrieving revision 1.182
  retrieving revision 1.183
  diff -u -r1.182 -r1.183
  --- http_protocol.c	2000/10/17 14:37:46	1.182
  +++ http_protocol.c	2000/10/17 15:28:57	1.183
  @@ -1000,32 +1000,39 @@
           }
       }
   
  -    if (f->c->remain > 0) {
  -        const char *ignore;
  -
  +    if (f->c->remain) {
           e = AP_BRIGADE_FIRST(b);
           while (e != AP_BRIGADE_SENTINEL(b)) {
  -            ap_bucket_read(e, &ignore, &len, 0);
  -            if (f->c->remain < len) {
  -                break;
  +            const char *ignore;
  +
  +            if ((rv = ap_bucket_read(e, &ignore, &len, 0)) != 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, 
  +                             "ap_bucket_read");
  +                return rv;
               }
  -            f->c->remain -= len;
  -            e = AP_BUCKET_NEXT(e);
  -        }
  -        if (e != AP_BRIGADE_SENTINEL(b)) {
  -            if (f->c->remain < len) {
  -                ap_bucket_split(e, f->c->remain);
  -                f->c->remain = 0;
  +
  +            if (len) {
  +                if (f->c->remain < len) {
  +                    ap_bucket_split(e, f->c->remain);
  +                    f->c->remain = 0;
  +                }
  +                else {
  +                    f->c->remain -= len;
  +                }
  +                bb = ap_brigade_split(b, AP_BUCKET_NEXT(e));
  +                ctx->b = bb;
  +                break; /* once we've gotten some data, deliver it to caller */
               }
  -            bb = ap_brigade_split(b, AP_BUCKET_NEXT(e));
  -            ctx->b = bb;
  +            e = AP_BUCKET_NEXT(e);
           }
  -        else {
  +        if (e == AP_BRIGADE_SENTINEL(b)) {
               ctx->b = NULL;
           }
           if (f->c->remain == 0) {
               ap_bucket *eos = ap_bucket_create_eos();
  -
  +                
               AP_BRIGADE_INSERT_TAIL(b, eos);
           }
           return APR_SUCCESS;
  
  
  

Mime
View raw message