1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucciextern module AP_MODULE_DECLARE_DATA apreq_module;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgolluccistruct dir_config {
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci const char *temp_dir;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_uint64_t read_limit;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_size_t brigade_limit;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci};
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci/* The "warehouse", stored in r->request_config */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgolluccistruct apache2_handle {
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apreq_handle_t handle;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci request_rec *r;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_table_t *jar, *args;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_status_t jar_status, args_status;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci ap_filter_t *f;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci};
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci/* Tracks the apreq filter state */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgolluccistruct filter_ctx {
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_bucket_brigade *bb; /* input brigade that's passed to the parser */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_bucket_brigade *bbtmp; /* temporary copy of bb, destined for the spool */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_bucket_brigade *spool; /* copied prefetch data for downstream filters */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apreq_parser_t *parser;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apreq_hook_t *hook_queue;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apreq_hook_t *find_param;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_table_t *body;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_status_t body_status;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_status_t filter_error;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_uint64_t bytes_read; /* Total bytes read into this filter. */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_uint64_t read_limit; /* Max bytes the filter may show to parser */
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_size_t brigade_limit;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci const char *temp_dir;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci};
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucciapr_status_t apreq_filter_prefetch(ap_filter_t *f, apr_off_t readbytes);
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucciapr_status_t apreq_filter(ap_filter_t *f,
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_bucket_brigade *bb,
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci ap_input_mode_t mode,
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_read_type_e block,
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci apr_off_t readbytes);
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgolluccivoid apreq_filter_make_context(ap_filter_t *f);
1e5905d1f04191cad9dae6117e1508c7f7d5587apgolluccivoid apreq_filter_init_context(ap_filter_t *f);
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucciAPR_INLINE
1e5905d1f04191cad9dae6117e1508c7f7d5587apgolluccistatic void apreq_filter_relocate(ap_filter_t *f)
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci{
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci request_rec *r = f->r;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci if (f != r->input_filters) {
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci ap_filter_t *top = r->input_filters;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci ap_remove_input_filter(f);
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci r->input_filters = f;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci f->next = top;
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci }
1e5905d1f04191cad9dae6117e1508c7f7d5587apgollucci}