--- apache_1.3.20/src/main/http_protocol.c-1 Thu Jun 27 14:03:17 2002 +++ apache_1.3.20/src/main/http_protocol.c Thu Jun 27 14:05:52 2002 @@ -946,9 +946,8 @@ } } -#ifndef RQBUF_SIZE -#define RQBUF_SIZE 4096 /* should be >= buff.c's DEFAULT_BUFSIZE */ -#endif + +#define RQBUF_SIZE (fb->bufsiz) /* * Read the request and, as quickly as possible with minimal copying, @@ -962,6 +961,8 @@ BUFF *fb; int n; + fb = r->connection->client; + /* * If r->rqbuf already exists, there could be pointers into it from * r->headers_in so instead of reusing it, just replace it. @@ -978,9 +979,11 @@ * would read directly into fb->inptr but r->the_request needs an * intact copy, sigh */ - fb = r->connection->client; fb->flags |= B_SAFEREAD; + /* make read unbuffered */ + fb->flags &= ~B_RD; n = ap_bread(fb, r->rqbuf, RQBUF_SIZE); + fb->flags |= B_RD; fb->flags &= ~B_SAFEREAD; /* 16 == strlen("GET / HTTP/1.0\n\n"): minimal valid request */ @@ -997,8 +1000,7 @@ ) { char *cp, *ep; -#if defined(IRIX) && _MIPS_SIM != _ABIO32 && \ - CACHE_ALIGNMENT > 0 && RQBUF_SIZE > CACHE_ALIGNMENT +#if defined(IRIX) && _MIPS_SIM != _ABIO32 && CACHE_ALIGNMENT > 0 /* * The first cache line was prefetched in ap_read() and used above; now * try to prefetch the second cache line so parsing can proceed without @@ -1068,9 +1070,11 @@ */ ap_assert(r->rqhdr_len == 0); if (n > 0) { - ap_assert(&fb->inptr[n] <= &fb->inbase[fb->bufsiz]); + ap_assert(fb->incnt == 0); + /* reset the cursor */ + fb->inptr = fb->inbase; memcpy(fb->inptr, r->rqbuf, n); - fb->incnt += n; + fb->incnt = n; } return 0; @@ -1327,9 +1331,11 @@ if (remain > 0) { BUFF *fb = r->connection->client; - ap_assert(&fb->inptr[remain] <= &fb->inbase[fb->bufsiz]); + ap_assert(fb->incnt == 0); + /* reset the cursor */ + fb->inptr = fb->inbase; memcpy(fb->inptr, hp, remain); - fb->incnt += remain; + fb->incnt = remain; } return ok;