Index: include/httpd.h
===================================================================
--- include/httpd.h     (revision 1827658)
+++ include/httpd.h     (working copy)
@@ -531,6 +531,7 @@
 #define HTTP_TOO_MANY_REQUESTS               429
 #define HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE 431
 #define HTTP_UNAVAILABLE_FOR_LEGAL_REASONS   451
+#define HTTP_CLIENT_CLOSED_REQUEST           499
 #define HTTP_INTERNAL_SERVER_ERROR           500
 #define HTTP_NOT_IMPLEMENTED                 501
 #define HTTP_BAD_GATEWAY                     502
Index: modules/http/http_request.c
===================================================================
--- modules/http/http_request.c (revision 1827658)
+++ modules/http/http_request.c (working copy)
@@ -475,6 +475,14 @@
         b = apr_bucket_flush_create(c->bucket_alloc);
         APR_BRIGADE_INSERT_HEAD(bb, b);
         rv = ap_pass_brigade(c->output_filters, bb);
+               if (rv != APR_SUCCESS) {
+                       if (APR_STATUS_IS_ECONNRESET(rv)) {
+                               r->status = HTTP_CLIENT_CLOSED_REQUEST;
+                       }
+                       if (!APR_STATUS_IS_EAGAIN(rv)) {
+                               apr_brigade_cleanup(bb);
+                       }
+               }
         if (APR_STATUS_IS_TIMEUP(rv)) {
             /*
              * Notice a timeout as an error message. This might be
Index: server/core_filters.c
===================================================================
--- server/core_filters.c       (revision 1827658)
+++ server/core_filters.c       (working copy)
@@ -545,7 +545,6 @@
             /* The client has aborted the connection */
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, rv, c,
                           "core_output_filter: writing data to the network");
-            apr_brigade_cleanup(bb);
             c->aborted = 1;
             return rv;
         }
@@ -559,7 +558,6 @@
             /* The client has aborted the connection */
             ap_log_cerror(APLOG_MARK, APLOG_TRACE1, rv, c,
                           "core_output_filter: writing data to the network");
-            apr_brigade_cleanup(bb);
             c->aborted = 1;
             return rv;
         }