You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Mark Brown <mb...@OpenMarket.com> on 1996/10/11 03:02:22 UTC

get_client_block patch

In a recent 1.2dev snapshot (apache_19961010010010.tar.gz), the
get_client_block function arbitrarily tosses one byte of
the caller's buffer.  Thus if the caller's buffer is a single byte long,
get_client_block always signals EOF.  (mod_fastcgi tickled this
bug by passing bufsiz == len_to_read, after which len_to_read == 1.)

Here's the fix.

    --mark

* * * * *

*** http_protocol.c     Wed Oct  9 22:54:01 1996
--- http_protocol.c.orig        Wed Oct  9 22:53:20 1996
***************
*** 1146,1153 ****
      long c, len_read, len_to_read = r->remaining;
  
      if (!r->read_chunked) {   /* Content-length read */
!       if (len_to_read > bufsiz)
!           len_to_read = bufsiz;
        len_read = bread(r->connection->client, buffer, len_to_read);
        r->remaining -= len_read;
        return len_read;
--- 1146,1153 ----
      long c, len_read, len_to_read = r->remaining;
  
      if (!r->read_chunked) {   /* Content-length read */
!       if (len_to_read >= bufsiz)
!           len_to_read = bufsiz - 1;
        len_read = bread(r->connection->client, buffer, len_to_read);
        r->remaining -= len_read;
        return len_read;

* * * * *