From: Joe Orton Date: Wed, 8 Jun 2005 08:44:37 +0000 (+0000) Subject: * modules/http/byterange_filter.c (ap_byterange_filter): No functional X-Git-Tag: 2.1.5~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40b2f8d2c5a926a99682aac902d75b9567a97224;p=thirdparty%2Fapache%2Fhttpd.git * modules/http/byterange_filter.c (ap_byterange_filter): No functional changes: reflow/reformat after r188797. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@189559 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/http/byterange_filter.c b/modules/http/byterange_filter.c index 422a008b855..f217ce9b99b 100644 --- a/modules/http/byterange_filter.c +++ b/modules/http/byterange_filter.c @@ -149,6 +149,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, apr_off_t clength = 0; apr_status_t rv; int found = 0; + int num_ranges; /* Iterate through the brigade until reaching EOS or a bucket with * unknown length. */ @@ -168,39 +169,37 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, return ap_pass_brigade(f->next, bb); } - { - int num_ranges = ap_set_byterange(r); - - /* We have nothing to do, get out of the way. */ - if (num_ranges == 0) { - ap_remove_output_filter(f); - return ap_pass_brigade(f->next, bb); - } - - ctx = apr_pcalloc(r->pool, sizeof(*ctx)); - ctx->num_ranges = num_ranges; - /* create a brigade in case we never call ap_save_brigade() */ - ctx->bb = apr_brigade_create(r->pool, c->bucket_alloc); - - if (ctx->num_ranges > 1) { - /* Is ap_make_content_type required here? */ - const char *orig_ct = ap_make_content_type(r, r->content_type); - ctx->boundary = apr_psprintf(r->pool, "%" APR_UINT64_T_HEX_FMT "%lx", - (apr_uint64_t)r->request_time, (long) getpid()); - - ap_set_content_type(r, apr_pstrcat(r->pool, "multipart", - use_range_x(r) ? "/x-" : "/", - "byteranges; boundary=", - ctx->boundary, NULL)); - - ctx->bound_head = apr_pstrcat(r->pool, - CRLF "--", ctx->boundary, - CRLF "Content-type: ", - orig_ct, - CRLF "Content-range: bytes ", - NULL); - ap_xlate_proto_to_ascii(ctx->bound_head, strlen(ctx->bound_head)); - } + num_ranges = ap_set_byterange(r); + + /* We have nothing to do, get out of the way. */ + if (num_ranges == 0) { + ap_remove_output_filter(f); + return ap_pass_brigade(f->next, bb); + } + + ctx = apr_pcalloc(r->pool, sizeof(*ctx)); + ctx->num_ranges = num_ranges; + /* create a brigade in case we never call ap_save_brigade() */ + ctx->bb = apr_brigade_create(r->pool, c->bucket_alloc); + + if (ctx->num_ranges > 1) { + /* Is ap_make_content_type required here? */ + const char *orig_ct = ap_make_content_type(r, r->content_type); + ctx->boundary = apr_psprintf(r->pool, "%" APR_UINT64_T_HEX_FMT "%lx", + (apr_uint64_t)r->request_time, (long) getpid()); + + ap_set_content_type(r, apr_pstrcat(r->pool, "multipart", + use_range_x(r) ? "/x-" : "/", + "byteranges; boundary=", + ctx->boundary, NULL)); + + ctx->bound_head = apr_pstrcat(r->pool, + CRLF "--", ctx->boundary, + CRLF "Content-type: ", + orig_ct, + CRLF "Content-range: bytes ", + NULL); + ap_xlate_proto_to_ascii(ctx->bound_head, strlen(ctx->bound_head)); } /* this brigade holds what we will be sending */