You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@apache.org on 2012/02/01 14:28:00 UTC

svn commit: r1239122 - /httpd/httpd/branches/2.4.x/server/core_filters.c

Author: jim
Date: Wed Feb  1 13:27:59 2012
New Revision: 1239122

URL: http://svn.apache.org/viewvc?rev=1239122&view=rev
Log:
Merge r1233882 from trunk:

* 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

Modified:
    httpd/httpd/branches/2.4.x/server/core_filters.c

Modified: httpd/httpd/branches/2.4.x/server/core_filters.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/core_filters.c?rev=1239122&r1=1239121&r2=1239122&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/core_filters.c (original)
+++ httpd/httpd/branches/2.4.x/server/core_filters.c Wed Feb  1 13:27:59 2012
@@ -142,7 +142,7 @@ int ap_core_input_filter(ap_filter_t *f,
          * 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,
         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) {