diff --git a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java index 9c787b600..940866963 100644 --- a/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java +++ b/httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java @@ -302,7 +302,7 @@ class ResponseCachingPolicy { private boolean from1_0Origin(final HttpResponse response) { final Iterator it = MessageSupport.iterate(response, HeaderConstants.VIA); - while (it.hasNext()) { + if (it.hasNext()) { final HeaderElement elt = it.next(); final String proto = elt.toString().split("\\s")[0]; if (proto.contains("/")) {