]> granicus.if.org Git - apache/commitdiff
Merge r1233882 from trunk:
authorJim Jagielski <jim@apache.org>
Wed, 1 Feb 2012 13:27:59 +0000 (13:27 +0000)
committerJim Jagielski <jim@apache.org>
Wed, 1 Feb 2012 13:27:59 +0000 (13:27 +0000)
* server/core_filters.c (ap_core_input_filter): Only treat EAGAIN as
  success if a non-blocking read was requested; for a blocking read,
  it is an error condition.

Submitted by: jorton
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1239122 13f79535-47bb-0310-9956-ffa450edef68

server/core_filters.c

index 61c4a4115fcc5b7d22ac92ab958314702bf527a6..42da5c279f41fafc026024890cd7d278c48d74d5 100644 (file)
@@ -142,7 +142,7 @@ int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
          * empty).  We do this by returning whatever we have read.  This may
          * or may not be bogus, but is consistent (for now) with EOF logic.
          */
-        if (APR_STATUS_IS_EAGAIN(rv)) {
+        if (APR_STATUS_IS_EAGAIN(rv) && block == APR_NONBLOCK_READ) {
             rv = APR_SUCCESS;
         }
         return rv;
@@ -228,7 +228,9 @@ int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
         e = APR_BRIGADE_FIRST(ctx->b);
         rv = apr_bucket_read(e, &str, &len, block);
 
-        if (APR_STATUS_IS_EAGAIN(rv)) {
+        if (APR_STATUS_IS_EAGAIN(rv) && block == APR_NONBLOCK_READ) {
+            /* getting EAGAIN for a blocking read is an error; for a
+             * non-blocking read, return an empty brigade. */
             return APR_SUCCESS;
         }
         else if (rv != APR_SUCCESS) {