> -----Original Message----- > From: Justin Erenkrantz [mailto:jerenkrantz@;apache.org] [snip] > > @@ -366,11 +371,11 @@ > > BIO_bucket_flush(inbio->wbio); > > } > > > > - inbio->rc = APR_SUCCESS; > > - > > + BIO_clear_retry_flags(bio); > > + > > /* first use data already read from socket if any */ > > if ((len = char_buffer_read(&inbio->cbuf, in, inl))) { > > - if ((len <= inl) || inbio->mode == AP_MODE_GETLINE) { > > + if (len >= inl) { > > return len; > > } > > inl -= len; > > Hmm, what is the point of this conditional change? char_buffer_read > shouldn't be returning anything larger than inl. To me, it actually > sounds that this segment should just be returning len all the time > (as that conditional was *always* true). No need for a conditional > here. If there's anything that we've already read, just return it. > Clear out that buffer - if the user still wants more, then they can > call again. (Due to our structure, we're not sure if the caller > really wants all of inl or not - almost certainly not for > AP_MODE_GETLINE.) >
my understanding is that char_buffer_read will not return len > inl. The maximum that it'll return is inl. an example : inl = 100, buffer->length = 10 ==> len = 90 (< inl) inl = 100, buffer->length = 100 ==> len = 0 (< inl) inl = 10, buffer->length = 100 ==> len = 10 (== inl) inl = 10, buffer->length = 0 ==> len = 0 (== inl) So, I thought, if (len >= inl), nothing has to be done - you just return because you've read the required amount of data. Am I mis-reading something ?. -Madhu
