httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1205419 - in /httpd/httpd/trunk: include/util_filter.h server/util_filter.c
Date Wed, 23 Nov 2011 14:52:44 GMT
Author: jim
Date: Wed Nov 23 14:52:43 2011
New Revision: 1205419

URL: http://svn.apache.org/viewvc?rev=1205419&view=rev
Log:
Add ap_pass_brigade_fchk() which does a Filter CHecK on the
brigade pass.

Modified:
    httpd/httpd/trunk/include/util_filter.h
    httpd/httpd/trunk/server/util_filter.c

Modified: httpd/httpd/trunk/include/util_filter.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/util_filter.h?rev=1205419&r1=1205418&r2=1205419&view=diff
==============================================================================
--- httpd/httpd/trunk/include/util_filter.h (original)
+++ httpd/httpd/trunk/include/util_filter.h Wed Nov 23 14:52:43 2011
@@ -315,6 +315,26 @@ AP_DECLARE(apr_status_t) ap_pass_brigade
                                          apr_bucket_brigade *bucket);
 
 /**
+ * Pass the current bucket brigade down to the next filter on the filter
+ * stack checking for filter errors.  The filter returns an apr_status_t value.
+ * Returns ::OK if the brigade is successfully passed
+ *         ::AP_FILTER_ERROR on a filter error
+ *         ::HTTP_INTERNAL_SERVER_ERROR on all other errors
+ * @param r      The request rec
+ * @param bucket The current bucket brigade
+ * @param msg    Optional error msg; if NULL defaults to "ap_pass_brigade returned"
+ *
+ * @remark Ownership of the brigade is retained by the caller. On return,
+ *         the contents of the brigade are UNDEFINED, and the caller must
+ *         either call apr_brigade_cleanup or apr_brigade_destroy on
+ *         the brigade.
+ */
+AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
+                                              apr_bucket_brigade *bucket,
+                                              const char *msg);
+
+
+/**
  * This function is used to register an input filter with the system.
  * After this registration is performed, then a filter may be added
  * into the filter chain by using ap_add_input_filter() and simply

Modified: httpd/httpd/trunk/server/util_filter.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/util_filter.c?rev=1205419&r1=1205418&r2=1205419&view=diff
==============================================================================
--- httpd/httpd/trunk/server/util_filter.c (original)
+++ httpd/httpd/trunk/server/util_filter.c Wed Nov 23 14:52:43 2011
@@ -535,6 +535,33 @@ AP_DECLARE(apr_status_t) ap_pass_brigade
     return AP_NOBODY_WROTE;
 }
 
+/* Pass the buckets to the next filter in the filter stack
+ * checking return status for filter errors.
+ * returns: OK if ap_pass_brigade returns APR_SUCCESS
+ *          AP_FILTER_ERROR if filter error exists
+ *          HTTP_INTERNAL_SERVER_ERROR for all other cases
+ *          logged with optional errmsg
+ */
+AP_DECLARE(apr_status_t) ap_pass_brigade_fchk(request_rec *r,
+                                              apr_bucket_brigade *bb,
+                                              const char *errmsg)
+{
+    apr_status_t rv;
+    if (!errmsg)
+        errmsg = "ap_pass_brigade returned";
+
+    rv = ap_pass_brigade(r->output_filters, bb);
+    if (rv != APR_SUCCESS) {
+        if (rv != AP_FILTER_ERROR) {
+            ap_log_rerror(APLOG_MARK, APLOG_DEBUG, rv, r,
+                          "%s %d", errmsg, rv);
+            return HTTP_INTERNAL_SERVER_ERROR;
+        }
+        return AP_FILTER_ERROR;
+    }
+    return OK;
+}
+
 AP_DECLARE(apr_status_t) ap_save_brigade(ap_filter_t *f,
                                          apr_bucket_brigade **saveto,
                                          apr_bucket_brigade **b, apr_pool_t *p)



Mime
View raw message