core_input_filter: BRIGADE_NORMALIZE() can be called with an empty brigade.
So make it a noop in this case, without dereferencing the sentinel (i.e.
change its do{}while to a while{}).
#define BRIGADE_NORMALIZE(b) \
do { \
apr_bucket *e = APR_BRIGADE_FIRST(b); \
- do { \
+ while (e != APR_BRIGADE_SENTINEL(b)) { \
+ apr_bucket *next = APR_BUCKET_NEXT(e); \
if (e->length == 0 && !APR_BUCKET_IS_METADATA(e)) { \
- apr_bucket *d; \
- d = APR_BUCKET_NEXT(e); \
apr_bucket_delete(e); \
- e = d; \
} \
- else { \
- e = APR_BUCKET_NEXT(e); \
+ e = next; \
} \
- } while (!APR_BRIGADE_EMPTY(b) && (e != APR_BRIGADE_SENTINEL(b))); \
} while (0)
/* we know core's module_index is 0 */
@@ -127,9 +123,6 @@ apr_status_t ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
}
else {
ap_filter_reinstate_brigade(f, ctx->bb, NULL);
- if (APR_BRIGADE_EMPTY(ctx->bb)) {
- return APR_EOF;
- }
}
/* ### This is bad. */
