midchildan commented on a change in pull request #8741:
URL: https://github.com/apache/trafficserver/pull/8741#discussion_r831777922
##########
File path: proxy/http/HttpTransactCache.cc
##########
@@ -1357,47 +1359,49 @@
HttpTransactCache::match_response_to_request_conditionals(HTTPHdr *request, HTTP
return response_code;
}
- // Handling If-Range header:
- // As Range && If-Range don't occur often, we want to put the
- // If-Range code in the end
- if (request->presence(MIME_PRESENCE_RANGE) &&
request->presence(MIME_PRESENCE_IF_RANGE)) {
- int raw_len, comma_sep_list_len;
+ return response->status_get();
+}
- const char *if_value = request->value_get(MIME_FIELD_IF_RANGE,
MIME_LEN_IF_RANGE, &comma_sep_list_len);
+/**
+ Validates the contents of If-range headers in client requests.
- // this is an ETag, similar to If-Match
- if (!if_value || if_value[0] == '"' || (comma_sep_list_len > 1 &&
if_value[1] == '/')) {
- if (!if_value) {
- if_value = "";
- comma_sep_list_len = 0;
- }
+ @return Whether the condition specified by If-range is met, if there is any.
+ If there's no If-range header, then true.
- const char *raw_etags = response->value_get(MIME_FIELD_ETAG,
MIME_LEN_ETAG, &raw_len);
+*/
+bool
+HttpTransactCache::validate_ifrange_header_if_any(HTTPHdr *request, HTTPHdr
*response)
+{
+ if (!(request->presence(MIME_PRESENCE_RANGE) &&
request->presence(MIME_PRESENCE_IF_RANGE))) {
Review comment:
It's only meant as a precautionary measure. Should I turn it into an
assertion, or would it be better to remove it completely?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]