So ap_http_filter winds up calling ap_get_mime_headers once it recognizes that the request body has finished, to process the trailing headers on chunked requests. This is actually a strange thing to do, because it means ap_http_filter winds up calling ap_get_brigade on r->input_filters with AP_MODE_GETLINE set, right in the middle of an existing ap_get_brigade sequence on the filter chain. In other words, this recursion only works if all post-protocol filters are written to punt on processing AP_MODE_GETLINE invocations- this is what we need to document somewhere if we don't want to fix the code.
It would be logically better if there were a way to pass a ap_filter_t argument to ap_get_mime_headers so ap_http_filter didn't need to reach backwards in the input filter chain just to finish its HTTP protocol handling.