Note that all of this becomes *much* easier if we just switch over to
directly reading the socket.
Cheers,
-g
On Fri, Oct 05, 2001 at 08:54:19AM -0000, [EMAIL PROTECTED] wrote:
> jerenkrantz 01/10/05 01:54:19
>
> Modified: server core.c
> Log:
> Allow the core input filter to handle AP_NONBLOCK_READ request for a
> finite number of bytes (i.e. *readbytes > 0).
>
> ap_brigade_partition does a blocking read. So, what we should do is
> apr_bucket_read on the socket for non-blocking. If we get less than
> what they asked for, that's okay and we should just return that amount.
> If they were non-blocking, we should always be non-blocking.
>
> Ryan, Greg, and others can figure out if ap_brigade_partition should
> be tweaked to handle AP_NONBLOCK_READ natively. I'm of a mixed mind,
> but this addresses the short term need.
>
> Revision Changes Path
> 1.67 +9 -0 httpd-2.0/server/core.c
>
> Index: core.c
> ===================================================================
> RCS file: /home/cvs/httpd-2.0/server/core.c,v
> retrieving revision 1.66
> retrieving revision 1.67
> diff -u -r1.66 -r1.67
> --- core.c 2001/10/05 02:27:48 1.66
> +++ core.c 2001/10/05 08:54:19 1.67
> @@ -2853,7 +2853,16 @@
> apr_bucket *e;
> apr_bucket_brigade *newbb;
>
> + if (mode == APR_NONBLOCK_READ) {
> + e = APR_BRIGADE_FIRST(ctx->b);
> + rv = apr_bucket_read(e, &str, &len, mode);
> +
> + if (len < *readbytes)
> + *readbytes = len;
> + }
> +
> apr_brigade_partition(ctx->b, *readbytes, &e);
> +
> /* Must do split before CONCAT */
> newbb = apr_brigade_split(ctx->b, e);
> APR_BRIGADE_CONCAT(b, ctx->b);
>
>
>
--
Greg Stein, http://www.lyra.org/