ok2c commented on code in PR #451:
URL:
https://github.com/apache/httpcomponents-client/pull/451#discussion_r1211754116
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/RequestProtocolCompliance.java:
##########
@@ -121,53 +129,67 @@ protected boolean requestVersionIsTooLow(final
HttpRequest request) {
return requestProtocol != null &&
requestProtocol.compareToVersion(HttpVersion.HTTP_1_1) < 0;
}
- private RequestProtocolError requestHasWeakETagAndRange(final HttpRequest
request) {
- // TODO: Should these be looking at all the headers marked as Range?
+ private RequestProtocolError requestHasWeakETagAndRange(final HttpRequest
request) {
final String method = request.getMethod();
- if (!(HeaderConstants.GET_METHOD.equals(method))) {
+ if (!(HeaderConstants.GET_METHOD.equals(method) ||
HeaderConstants.HEAD_METHOD.equals(method))) {
return null;
}
- final Header range = request.getFirstHeader(HttpHeaders.RANGE);
- if (range == null) {
+ final Header[] ranges = request.getHeaders(HttpHeaders.RANGE);
Review Comment:
@arturobernalg Oh please, please do not do that! Please do not create an
array just to throw it away. This is a really bad practice.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]