apr_off_t range_end;
char *current;
const char *bound_head;
- const char *ct = make_content_type(r, r->content_type);
if (!ctx) {
int num_ranges = ap_set_byterange(r);
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
}
+
ctx = f->ctx = apr_pcalloc(r->pool, sizeof(*ctx));
- ctx->num_ranges = ap_set_byterange(r);
-
+ ctx->num_ranges = num_ranges;
+
+ /* create a brigade in case we never call ap_save_brigade() */
+ ctx->bb = ap_brigade_create(r->pool);
}
/* We can't actually deal with byte-ranges until we have the whole brigade
return APR_SUCCESS;
}
- /* compute this once (it is an invariant) and store it away */
- bound_head = apr_pstrcat(r->pool, CRLF "--", r->boundary,
- CRLF "Content-type: ", ct,
- CRLF "Content-range: bytes ",
- NULL);
+ /* compute this once (it is an invariant) */
+ bound_head = apr_pstrcat(r->pool,
+ CRLF "--", r->boundary,
+ CRLF "Content-type: ",
+ make_content_type(r, r->content_type),
+ CRLF "Content-range: bytes ",
+ NULL);
/* concat the passed brigade with our saved brigade */
AP_BRIGADE_CONCAT(ctx->bb, bb);
bb = ctx->bb;
- ctx->bb = NULL; /* ### strictly necessary? */
+ ctx->bb = NULL; /* ### strictly necessary? call brigade_destroy? */
/* this brigade holds what we will be sending */
bsend = ap_brigade_create(r->pool);
apr_off_t range_end;
int num_ranges;
+ /* ### this test for r->clength is probably a Bad Thing. need to fix */
if (!r->clength || r->assbackwards)
return 0;
*/
#include "httpd.h"
+#include "http_log.h"
#include "util_filter.h"
/* ### make this visible for direct manipulation?
{
ap_filter_func f;
f.in_func = filter_func;
- register_filter(name, f, ftype,
- ®istered_input_filters);
+ register_filter(name, f, ftype, ®istered_input_filters);
}
AP_DECLARE(void) ap_register_output_filter(const char *name,
{
ap_filter_func f;
f.out_func = filter_func;
- register_filter(name, f, ftype,
- ®istered_output_filters);
+ register_filter(name, f, ftype, ®istered_output_filters);
}
AP_DECLARE(void) ap_add_input_filter(const char *name, void *ctx,
fscan->next = f;
}
- break;
+ return;
}
}
+
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
+ "an unknown input filter was not added: %s", name);
}
AP_DECLARE(void) ap_remove_output_filter(ap_filter_t *f)
fscan->next = f;
}
- break;
+ return;
}
}
+
+ ap_log_error(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, NULL,
+ "an unknown output filter was not added: %s", name);
}
/*