httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-2.0/src/main http_protocol.c
Date Fri, 13 Oct 2000 09:50:02 GMT
On Fri, Oct 13, 2000 at 03:12:54AM -0000, trawick@locus.apache.org wrote:
>...
>   +        total = 0;
>   +        do {
>   +            rv = b->read(b, &tempbuf, &len_read, 0);
>   +            if (len_to_read < b->length) { /* shouldn't happen */
>   +                b->split(b, len_to_read);

Where to from here? You don't break out of the loop or anything...

Assert that it won't happen (and don't handle it), or actually handle the
darn thing.

IMO, don't handle it. An alternative would be to insert:

#ifdef AP_DEBUG
  if (len_to_read < len_read) abort();
#endif

(and note the len_read rather than b->length)

>   +            }
>   +            else {
>   +                len_to_read = len_read;
>   +            }
>   +            
>   +            memcpy(buffer, tempbuf, len_to_read);
>   +            buffer += len_to_read;
>   +            
>   +            r->read_length += len_to_read;
>   +            total += len_to_read;
>   +            r->remaining -= len_to_read;
>   +            old = b;
>   +            b = AP_BUCKET_NEXT(b);
>   +            AP_BUCKET_REMOVE(old);
>   +            ap_bucket_destroy(old);
>   +        } while (b != AP_BRIGADE_SENTINEL(bb));
>   +        ap_brigade_destroy(bb);
>   +        return total;


Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Mime
View raw message