*end = clength - 1;
if (*start > *end)
- return 0;
+ return -1;
return (*start > 0 || *end < clength - 1);
}
char *current;
const char *bound_head;
int clength = 0;
+ apr_status_t rv;
+ int found = 0;
if (!ctx) {
int num_ranges = ap_set_byterange(r);
+ if (num_ranges == -1) {
+ ap_remove_output_filter(f);
+ return HTTP_RANGE_NOT_SATISFIABLE;
+ }
if (num_ranges == 0) {
ap_remove_output_filter(f);
return ap_pass_brigade(f->next, bb);
bsend = ap_brigade_create(r->pool);
while ((current = ap_getword(r->pool, &r->range, ',')) &&
- parse_byterange(current, clength, &range_start, &range_end)) {
+ (rv = parse_byterange(current, clength, &range_start, &range_end))) {
const char *str;
apr_size_t n;
const char *range;
apr_size_t segment_length;
apr_off_t curr_offset = 0;
+ if (rv == -1) {
+ continue;
+ }
+ else {
+ found = 1;
+ }
+
/* ### this is so bogus, but not dealing with it right now */
range = loc = apr_pcalloc(r->pool, range_length + 1);
AP_BRIGADE_INSERT_TAIL(bsend, e);
}
+ if (found == 0) {
+ ap_remove_output_filter(f);
+ r->status = HTTP_OK;
+ return HTTP_RANGE_NOT_SATISFIABLE;
+ }
+
if (ctx->num_ranges > 1) {
const char *end;
ct = make_content_type(r, r->content_type);
if (!ap_strchr_c(range, ',')) {
+ int rv;
/* A single range */
- /* parse_byterange() modifies the contents, so make a copy */
- if (!parse_byterange(apr_pstrdup(r->pool, range + 6), r->clength,
- &range_start, &range_end)) {
- return 0;
+ /* rvarse_byterange() modifies the contents, so make a copy */
+ if ((rv = parse_byterange(apr_pstrdup(r->pool, range + 6), r->clength,
+ &range_start, &range_end)) <= 0) {
+ return rv;
}
apr_table_setn(r->headers_out, "Content-Range",
apr_psprintf(r->pool, "bytes " BYTERANGE_FMT,
char *custom_response;
const char *location = apr_table_get(r->headers_out, "Location");
+ /* At this point, we are starting the response over, so we have to reset
+ * this value.
+ */
+ r->eos_sent = 0;
+
/*
* It's possible that the Location field might be in r->err_headers_out
* instead of r->headers_out; use the latter if possible, else the