From b12bfcff03fb9860976675dfde429bd1dfdd2948 Mon Sep 17 00:00:00 2001
From: Ken Coar The document has moved pool, location),
- "\">here.
The answer to your request is located pool, location),
+ case HTTP_SEE_OTHER:
+ return(apr_pstrcat(p,
+ " The answer to your request is located "
+ "pool, location),
"\">here. This resource is only accessible "
- "through the proxy\n",
- ap_escape_html(r->pool, location),
- " This server could not verify that you\n"
- "are authorized to access the document\n"
- "requested. Either you supplied the wrong\n"
- "credentials (e.g., bad password), or your\n"
- "browser doesn't understand how to supply\n"
- "the credentials required. Your browser sent a request that "
- "this server could not understand. This server could not verify that you\n"
+ "are authorized to access the document\n"
+ "requested. Either you supplied the wrong\n"
+ "credentials (e.g., bad password), or your\n"
+ "browser doesn't understand how to supply\n"
+ "the credentials required. Your browser sent a request that "
+ "this server could not understand. You don't have permission to access ",
- ap_escape_html(r->pool, r->uri),
- "\non this server.
\nYou will need to "
- "configure your client to use that proxy.
\n",
- "error-notes",
+ "through the proxy\n",
+ ap_escape_html(r->pool, location),
+ "
\nYou will need to configure "
+ "your client to use that proxy.
\n",
+ "error-notes",
"
The requested URL ", - ap_escape_html(r->pool, r->uri), - " was not found on this server.
\n", + ap_escape_html(r->pool, r->uri), + " was not found on this server.\n", NULL)); - case HTTP_METHOD_NOT_ALLOWED: - return(apr_pstrcat(p, + case HTTP_METHOD_NOT_ALLOWED: + return(apr_pstrcat(p, "The requested method ", r->method, - " is not allowed for the URL ", + " is not allowed for the URL ", ap_escape_html(r->pool, r->uri), - ".
\n", + ".\n", NULL)); - case HTTP_NOT_ACCEPTABLE: - s1 = apr_pstrcat(p, - "An appropriate representation of the " - "requested resource ", - ap_escape_html(r->pool, r->uri), - " could not be found on this server.
\n", + case HTTP_NOT_ACCEPTABLE: + s1 = apr_pstrcat(p, + "An appropriate representation of the " + "requested resource ", + ap_escape_html(r->pool, r->uri), + " could not be found on this server.
\n", NULL); - return(add_optional_notes(r, s1, "variant-list", "")); - case HTTP_MULTIPLE_CHOICES: - return(add_optional_notes(r, "", "variant-list", "")); - case HTTP_LENGTH_REQUIRED: - s1 = apr_pstrcat(p, - "A request of the requested method ", + return(add_optional_notes(r, s1, "variant-list", "")); + case HTTP_MULTIPLE_CHOICES: + return(add_optional_notes(r, "", "variant-list", "")); + case HTTP_LENGTH_REQUIRED: + s1 = apr_pstrcat(p, + "
A request of the requested method ",
r->method,
- " requires a valid Content-length.
\n",
+ " requires a valid Content-length.
\n",
NULL);
- return(add_optional_notes(r, s1, "error-notes", "
The precondition on the request for the URL ", - ap_escape_html(r->pool, r->uri), - " evaluated to false.
\n", + return(add_optional_notes(r, s1, "error-notes", "\n")); + case HTTP_PRECONDITION_FAILED: + return(apr_pstrcat(p, + "The precondition on the request " + "for the URL ", + ap_escape_html(r->pool, r->uri), + " evaluated to false.
\n", NULL)); - case HTTP_NOT_IMPLEMENTED: - s1 = apr_pstrcat(p, "", + case HTTP_NOT_IMPLEMENTED: + s1 = apr_pstrcat(p, + "
",
ap_escape_html(r->pool, r->method), " to ",
- ap_escape_html(r->pool, r->uri),
- " not supported.
\n",
+ ap_escape_html(r->pool, r->uri),
+ " not supported.
\n",
NULL);
- return(add_optional_notes(r, s1, "error-notes", "
The proxy server received an invalid" CRLF
- "response from an upstream server.
" CRLF;
- return(add_optional_notes(r, s1, "error-notes", "
A variant for the requested resource\n
\n", - ap_escape_html(r->pool, r->uri), - "\n\nis itself a negotiable resource. " - "This indicates a configuration error.\n", + return(add_optional_notes(r, s1, "error-notes", "\n")); + case HTTP_BAD_GATEWAY: + s1 = "
The proxy server received an invalid" CRLF
+ "response from an upstream server.
" CRLF;
+ return(add_optional_notes(r, s1, "error-notes", "
A variant for the requested " + "resource\n
\n", + ap_escape_html(r->pool, r->uri), + "\n\nis itself a negotiable resource. " + "This indicates a configuration error.\n", NULL)); - case HTTP_REQUEST_TIME_OUT: - return("
I'm tired of waiting for your request.
\n"); - case HTTP_GONE: - return(apr_pstrcat(p, + case HTTP_REQUEST_TIME_OUT: + return("I'm tired of waiting for your request.
\n"); + case HTTP_GONE: + return(apr_pstrcat(p, "The requested resource
",
- ap_escape_html(r->pool, r->uri),
- "
\nis no longer available on this server "
- "and there is no forwarding address.\n"
- "Please remove all references to this resource.
The requested URL's length exceeds the capacity\n"
- "limit for this server.
\n";
+ case HTTP_REQUEST_URI_TOO_LARGE:
+ s1 = "
The requested URL's length exceeds the capacity\n"
+ "limit for this server.
\n";
return(add_optional_notes(r, s1, "error-notes", "
The supplied request data is not in a format\n" - "acceptable for processing by this resource.
\n"); - case HTTP_RANGE_NOT_SATISFIABLE: - return("None of the range-specifier values in the Range\n" - "request-header field overlap the current extent\n" - "of the selected resource.
\n"); - case HTTP_EXPECTATION_FAILED: - return(apr_pstrcat(p, - "The expectation given in the Expect request-header" - "\nfield could not be met by this server.
\n" - "The client sent
\n Expect: ", - apr_table_get(r->headers_in, "Expect"), "\n\n" - "but we only allow the 100-continue expectation.\n", - NULL)); - case HTTP_UNPROCESSABLE_ENTITY: - return("
The server understands the media type of the\n" - "request entity, but was unable to process the\n" - "contained instructions.
\n"); - case HTTP_LOCKED: - return("The requested resource is currently locked.\n" - "The lock must be released or proper identification\n" - "given before the method can be applied.
\n"); - case HTTP_FAILED_DEPENDENCY: - return("The method could not be performed on the resource\n" - "because the requested action depended on another\n" - "action and that other action failed.
\n"); - case HTTP_INSUFFICIENT_STORAGE: - return("The method could not be performed on the resource\n" - "because the server is unable to store the\n" - "representation needed to successfully complete the\n" - "request. There is insufficient free space left in\n" - "your storage allocation.
\n"); - case HTTP_SERVICE_UNAVAILABLE: - return("The server is temporarily unable to service your\n" - "request due to maintenance downtime or capacity\n" - "problems. Please try again later.
\n"); - case HTTP_GATEWAY_TIME_OUT: - return("The proxy server did not receive a timely response\n" - "from the upstream server.
\n"); - case HTTP_NOT_EXTENDED: - return("A mandatory extension policy in the request is not\n" - "accepted by the server for this resource.
\n"); - default: /* HTTP_INTERNAL_SERVER_ERROR */ - /* - * This comparison to expose error-notes could be modified to - * use a configuration directive and export based on that - * directive. For now "*" is used to designate an error-notes - * that is totally safe for any user to see (ie lacks paths, - * database passwords, etc.) - */ - if (((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) - && (h1 = apr_table_get(r->notes, "verbose-error-to")) != NULL - && (strcmp(h1, "*") == 0)) { - return(apr_pstrcat(p, error_notes, "\n", NULL)); - } - else { - return(apr_pstrcat(p, - "The server encountered an internal error or\n" - "misconfiguration and was unable to complete\n" - "your request.
\n" - "Please contact the server administrator,\n ", - ap_escape_html(r->pool, r->server->server_admin), - " and inform them of the time the error occurred,\n" - "and anything you might have done that may have\n" - "caused the error.
\n" - "More information about this error may be available\n" - "in the server error log.
\n", - NULL)); - } - /* - * It would be nice to give the user the information they need to - * fix the problem directly since many users don't have access to - * the error_log (think University sites) even though they can easily - * get this error by misconfiguring an htaccess file. However, the - * e error notes tend to include the real file pathname in this case, - * which some people consider to be a breach of privacy. Until we - * can figure out a way to remove the pathname, leave this commented. - * - * if ((error_notes = apr_table_get(r->notes, "error-notes")) != NULL) { - * return(apr_pstrcat(p, error_notes, "\n", NULL); - * } - * else { - * return ""; - * } - */ - } + case HTTP_UNSUPPORTED_MEDIA_TYPE: + return("The supplied request data is not in a format\n" + "acceptable for processing by this resource.
\n"); + case HTTP_RANGE_NOT_SATISFIABLE: + return("None of the range-specifier values in the Range\n" + "request-header field overlap the current extent\n" + "of the selected resource.
\n"); + case HTTP_EXPECTATION_FAILED: + return(apr_pstrcat(p, + "The expectation given in the Expect " + "request-header" + "\nfield could not be met by this server.
\n" + "The client sent
\n Expect: ", + apr_table_get(r->headers_in, "Expect"), + "\n\n" + "but we only allow the 100-continue " + "expectation.\n", + NULL)); + case HTTP_UNPROCESSABLE_ENTITY: + return("
The server understands the media type of the\n" + "request entity, but was unable to process the\n" + "contained instructions.
\n"); + case HTTP_LOCKED: + return("The requested resource is currently locked.\n" + "The lock must be released or proper identification\n" + "given before the method can be applied.
\n"); + case HTTP_FAILED_DEPENDENCY: + return("The method could not be performed on the resource\n" + "because the requested action depended on another\n" + "action and that other action failed.
\n"); + case HTTP_INSUFFICIENT_STORAGE: + return("The method could not be performed on the resource\n" + "because the server is unable to store the\n" + "representation needed to successfully complete the\n" + "request. There is insufficient free space left in\n" + "your storage allocation.
\n"); + case HTTP_SERVICE_UNAVAILABLE: + return("The server is temporarily unable to service your\n" + "request due to maintenance downtime or capacity\n" + "problems. Please try again later.
\n"); + case HTTP_GATEWAY_TIME_OUT: + return("The proxy server did not receive a timely response\n" + "from the upstream server.
\n"); + case HTTP_NOT_EXTENDED: + return("A mandatory extension policy in the request is not\n" + "accepted by the server for this resource.
\n"); + default: /* HTTP_INTERNAL_SERVER_ERROR */ + /* + * This comparison to expose error-notes could be modified to + * use a configuration directive and export based on that + * directive. For now "*" is used to designate an error-notes + * that is totally safe for any user to see (ie lacks paths, + * database passwords, etc.) + */ + if (((error_notes = apr_table_get(r->notes, + "error-notes")) != NULL) + && (h1 = apr_table_get(r->notes, "verbose-error-to")) != NULL + && (strcmp(h1, "*") == 0)) { + return(apr_pstrcat(p, error_notes, "\n", NULL)); + } + else { + return(apr_pstrcat(p, + "The server encountered an internal " + "error or\n" + "misconfiguration and was unable to complete\n" + "your request.
\n" + "Please contact the server " + "administrator,\n ", + ap_escape_html(r->pool, + r->server->server_admin), + " and inform them of the time the " + "error occurred,\n" + "and anything you might have done that " + "may have\n" + "caused the error.
\n" + "More information about this error " + "may be available\n" + "in the server error log.
\n", + NULL)); + } + /* + * It would be nice to give the user the information they need to + * fix the problem directly since many users don't have access to + * the error_log (think University sites) even though they can easily + * get this error by misconfiguring an htaccess file. However, the + * e error notes tend to include the real file pathname in this case, + * which some people consider to be a breach of privacy. Until we + * can figure out a way to remove the pathname, leave this commented. + * + * if ((error_notes = apr_table_get(r->notes, + * "error-notes")) != NULL) { + * return(apr_pstrcat(p, error_notes, "\n", NULL); + * } + * else { + * return ""; + * } + */ + } } static void reset_filters(request_rec *r) @@ -1855,7 +1908,7 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error) /* folks decided they didn't want the error code in the H1 text */ h1 = &title[4]; - /* can't count on a charset filter being in place here, + /* can't count on a charset filter being in place here, * so do ebcdic->ascii translation explicitly (if needed) */ @@ -1864,10 +1917,10 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error) "\nAdditionally, a ", @@ -1888,13 +1941,13 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error) AP_DECLARE(ap_method_list_t *) ap_make_method_list(apr_pool_t *p, int nelts) { ap_method_list_t *ml; - + ml = (ap_method_list_t *) apr_palloc(p, sizeof(ap_method_list_t)); ml->method_mask = 0; ml->method_list = apr_array_make(p, sizeof(char *), nelts); return ml; } - + /* * Make a copy of a method list (primarily for subrequests that may * subsequently change it; don't want them changing the parent's, too!). @@ -1905,7 +1958,7 @@ AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest, int i; char **imethods; char **omethods; - + dest->method_mask = src->method_mask; imethods = (char **) src->method_list->elts; for (i = 0; i < src->method_list->nelts; ++i) { @@ -1913,13 +1966,14 @@ AP_DECLARE(void) ap_copy_method_list(ap_method_list_t *dest, *omethods = apr_pstrdup(dest->method_list->pool, imethods[i]); } } - + /* * Invoke a callback routine for each method in the specified list. */ -AP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, const char *mname, +AP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, + const char *mname, int mnum), - void *rec, + void *rec, const ap_method_list_t *ml, ...) { va_list vp; @@ -1927,16 +1981,16 @@ AP_DECLARE_NONSTD(void) ap_method_list_do(int (*comp) (void *urec, const char *m ap_method_list_vdo(comp, rec, ml, vp); va_end(vp); } - + AP_DECLARE(void) ap_method_list_vdo(int (*comp) (void *mrec, const char *mname, int mnum), void *rec, const ap_method_list_t *ml, va_list vp) { - + } - + /* * Return true if the specified HTTP method is in the provided * method list. @@ -1946,7 +2000,7 @@ AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method) int methnum; int i; char **methods; - + /* * If it's one of our known methods, use the shortcut and check the * bitmask. @@ -1957,7 +2011,7 @@ AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method) } /* * Otherwise, see if the method name is in the array or string names - */ + */ if ((l->method_list == NULL) || (l->method_list->nelts == 0)) { return 0; } @@ -1969,7 +2023,7 @@ AP_DECLARE(int) ap_method_in_list(ap_method_list_t *l, const char *method) } return 0; } - + /* * Add the specified method to a method list (if it isn't already there). */ @@ -1979,7 +2033,7 @@ AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method) int i; const char **xmethod; char **methods; - + /* * If it's one of our known methods, use the shortcut and use the * bitmask. @@ -1995,7 +2049,7 @@ AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method) if (l->method_list->nelts != 0) { methods = (char **)l->method_list->elts; for (i = 0; i < l->method_list->nelts; ++i) { - if (strcmp(method, methods[i]) == 0) { + if (strcmp(method, methods[i]) == 0) { return; } } @@ -2003,7 +2057,7 @@ AP_DECLARE(void) ap_method_list_add(ap_method_list_t *l, const char *method) xmethod = (const char **) apr_array_push(l->method_list); *xmethod = method; } - + /* * Remove the specified method from a method list. */ @@ -2012,7 +2066,7 @@ AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l, { int methnum; char **methods; - + /* * If it's a known methods, either builtin or registered * by a module, use the bitmask. @@ -2033,7 +2087,7 @@ AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l, for (j = i, k = i + 1; k < l->method_list->nelts; ++j, ++k) { methods[j] = methods[k]; } - --l->method_list->nelts; + --l->method_list->nelts; } else { ++i; @@ -2041,7 +2095,7 @@ AP_DECLARE(void) ap_method_list_remove(ap_method_list_t *l, } } } - + /* * Reset a method list to be completely empty. */ @@ -2049,7 +2103,7 @@ AP_DECLARE(void) ap_clear_method_list(ap_method_list_t *l) { l->method_mask = 0; l->method_list->nelts = 0; -} +} /* * Construct an entity tag (ETag) from resource information. If it's a real @@ -2075,7 +2129,7 @@ AP_DECLARE(char *) ap_make_etag(request_rec *r, int force_weak) * be modified again later in the second, and the validation * would be incorrect. */ - + weak = ((r->request_time - r->mtime > APR_USEC_PER_SEC) && !force_weak) ? "" : "W/"; @@ -2122,16 +2176,18 @@ AP_DECLARE(void) ap_set_etag(request_rec *r) vlv = r->vlist_validator; vlv_weak = (vlv[0] == 'W'); - + variant_etag = ap_make_etag(r, vlv_weak); /* merge variant_etag and vlv into a structured etag */ variant_etag[strlen(variant_etag) - 1] = '\0'; - if (vlv_weak) + if (vlv_weak) { vlv += 3; - else + } + else { vlv++; + } etag = apr_pstrcat(r->pool, variant_etag, ";", vlv, NULL); } @@ -2143,8 +2199,9 @@ static int parse_byterange(char *range, apr_off_t clength, { char *dash = strchr(range, '-'); - if (!dash) + if (!dash) { return 0; + } if ((dash == range)) { /* In the form "-5" */ @@ -2155,20 +2212,25 @@ static int parse_byterange(char *range, apr_off_t clength, *dash = '\0'; dash++; *start = atol(range); - if (*dash) + if (*dash) { *end = atol(dash); - else /* "5-" */ + } + else { /* "5-" */ *end = clength - 1; + } } - if (*start < 0) + if (*start < 0) { *start = 0; + } - if (*end >= clength) + if (*end >= clength) { *end = clength - 1; + } - if (*start > *end) + if (*start > *end) { return -1; + } return (*start > 0 || *end < clength); } @@ -2191,18 +2253,17 @@ typedef struct byterange_ctx { static int use_range_x(request_rec *r) { const char *ua; - return (apr_table_get(r->headers_in, "Request-Range") || - ((ua = apr_table_get(r->headers_in, "User-Agent")) - && ap_strstr_c(ua, "MSIE 3"))); + return (apr_table_get(r->headers_in, "Request-Range") + || ((ua = apr_table_get(r->headers_in, "User-Agent")) + && ap_strstr_c(ua, "MSIE 3"))); } #define BYTERANGE_FMT "%" APR_OFF_T_FMT "-%" APR_OFF_T_FMT "/%" APR_OFF_T_FMT #define PARTITION_ERR_FMT "apr_brigade_partition() failed " \ "[%" APR_OFF_T_FMT ",%" APR_OFF_T_FMT "]" -AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( - ap_filter_t *f, - apr_bucket_brigade *bb) +AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter(ap_filter_t *f, + apr_bucket_brigade *bb) { #define MIN_LENGTH(len1, len2) ((len1 > len2) ? len2 : len1) request_rec *r = f->r; @@ -2220,7 +2281,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( if (!ctx) { int num_ranges = ap_set_byterange(r); - + if (num_ranges == -1) { ap_remove_output_filter(f); bsend = apr_brigade_create(r->pool); @@ -2240,9 +2301,10 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( if (num_ranges > 1) { ctx->orig_ct = r->content_type; - r->content_type = - apr_pstrcat(r->pool, "multipart", use_range_x(r) ? "/x-" : "/", - "byteranges; boundary=", r->boundary, NULL); + r->content_type = apr_pstrcat(r->pool, "multipart", + use_range_x(r) ? "/x-" : "/", + "byteranges; boundary=", + r->boundary, NULL); } /* create a brigade in case we never call ap_save_brigade() */ @@ -2251,7 +2313,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( /* We can't actually deal with byte-ranges until we have the whole brigade * because the byte-ranges can be in any order, and according to the RFC, - * we SHOULD return the data in the same order it was requested. + * we SHOULD return the data in the same order it was requested. */ if (!APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { ap_save_brigade(f, &ctx->bb, &bb, r->pool); @@ -2263,12 +2325,12 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( CRLF "--", r->boundary, CRLF "Content-type: ", ap_make_content_type(r, ctx->orig_ct), - CRLF "Content-range: bytes ", + CRLF "Content-range: bytes ", NULL); ap_xlate_proto_to_ascii(bound_head, strlen(bound_head)); /* If we have a saved brigade from a previous run, concat the passed - * brigade with our saved brigade. Otherwise just continue. + * brigade with our saved brigade. Otherwise just continue. */ if (ctx->bb) { APR_BRIGADE_CONCAT(ctx->bb, bb); @@ -2285,8 +2347,9 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( /* this brigade holds what we will be sending */ bsend = apr_brigade_create(r->pool); - while ((current = ap_getword(r->pool, &r->range, ',')) && - (rv = parse_byterange(current, clength, &range_start, &range_end))) { + while ((current = ap_getword(r->pool, &r->range, ',')) + && (rv = parse_byterange(current, clength, &range_start, + &range_end))) { apr_bucket *e2; apr_bucket *ec; @@ -2307,7 +2370,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( PARTITION_ERR_FMT, range_end+1, clength); continue; } - + found = 1; if (ctx->num_ranges > 1) { @@ -2323,7 +2386,7 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( e = apr_bucket_pool_create(ts, strlen(ts), r->pool); APR_BRIGADE_INSERT_TAIL(bsend, e); } - + do { apr_bucket *foo; const char *str; @@ -2368,8 +2431,8 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_byterange_filter( apr_brigade_destroy(bb); /* send our multipart output */ - return ap_pass_brigade(f->next, bsend); -} + return ap_pass_brigade(f->next, bsend); +} static int ap_set_byterange(request_rec *r) { @@ -2381,8 +2444,9 @@ static int ap_set_byterange(request_rec *r) apr_off_t range_end; int num_ranges; - if (r->assbackwards) + if (r->assbackwards) { return 0; + } /* is content already a single range? */ if (apr_table_get(r->headers_out, "Content-Range")) { @@ -2390,9 +2454,9 @@ static int ap_set_byterange(request_rec *r) } /* is content already a multiple range? */ - if ((ct = apr_table_get(r->headers_out, "Content-Type")) && - (!strncasecmp(ct, "multipart/byteranges", 20) || - !strncasecmp(ct, "multipart/x-byteranges", 22))) { + if ((ct = apr_table_get(r->headers_out, "Content-Type")) + && (!strncasecmp(ct, "multipart/byteranges", 20) + || !strncasecmp(ct, "multipart/x-byteranges", 22))) { return 0; } @@ -2406,8 +2470,9 @@ static int ap_set_byterange(request_rec *r) * Navigator 2-3 and MSIE 3. */ - if (!(range = apr_table_get(r->headers_in, "Range"))) + if (!(range = apr_table_get(r->headers_in, "Range"))) { range = apr_table_get(r->headers_in, "Request-Range"); + } if (!range || strncasecmp(range, "bytes=", 6)) { return 0; @@ -2419,13 +2484,15 @@ static int ap_set_byterange(request_rec *r) */ if ((if_range = apr_table_get(r->headers_in, "If-Range"))) { if (if_range[0] == '"') { - if (!(match = apr_table_get(r->headers_out, "Etag")) || - (strcmp(if_range, match) != 0)) + if (!(match = apr_table_get(r->headers_out, "Etag")) + || (strcmp(if_range, match) != 0)) { return 0; + } } - else if (!(match = apr_table_get(r->headers_out, "Last-Modified")) || - (strcmp(if_range, match) != 0)) + else if (!(match = apr_table_get(r->headers_out, "Last-Modified")) + || (strcmp(if_range, match) != 0)) { return 0; + } } /* would be nice to pick this up from f->ctx */ -- 2.50.1