]> granicus.if.org Git - apache/commitdiff
Allow the core input filter to handle AP_NONBLOCK_READ request for a
authorJustin Erenkrantz <jerenkrantz@apache.org>
Fri, 5 Oct 2001 08:54:19 +0000 (08:54 +0000)
committerJustin Erenkrantz <jerenkrantz@apache.org>
Fri, 5 Oct 2001 08:54:19 +0000 (08:54 +0000)
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.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91312 13f79535-47bb-0310-9956-ffa450edef68

server/core.c

index b62c260fa1f0197b725e9834ce036341328e9e1a..10139a7721de49964468048f58d8bcdd91024bb9 100644 (file)
@@ -2853,7 +2853,16 @@ static int core_input_filter(ap_filter_t *f, apr_bucket_brigade *b, ap_input_mod
         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);