ok2c commented on code in PR #461:
URL: 
https://github.com/apache/httpcomponents-client/pull/461#discussion_r1243310552


##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/ResponseCachingPolicy.java:
##########
@@ -94,6 +94,42 @@ class ResponseCachingPolicy {
      */
     private final boolean staleIfErrorEnabled;
 
+    /**
+     * Immutable set of HTTP status codes that the cache inherently 
understands, as per HTTP specifications and RFCs.
+     * These status codes are used to validate cacheable responses when the 
'must-understand' directive is present.
+     * <p>
+     * The list includes:
+     * <ul>
+     *     <li>200 OK: Request has succeeded</li>
+     *     <li>203 Non-Authoritative Information: The returned metainformation 
in the entity-header is not the definitive set as available from the origin 
server</li>
+     *     <li>300 Multiple Choices: The requested resource corresponds to any 
one of a set of representations</li>
+     *     <li>301 Moved Permanently: The requested resource has been assigned 
a new permanent URI</li>
+     *     <li>302 Moved Temporarily: The requested resource resides 
temporarily under a different URI</li>
+     *     <li>304 Not Modified: The client has performed a conditional GET 
request and access is allowed, but the document has not been modified</li>
+     *     <li>400 Bad Request: The request could not be understood by the 
server due to malformed syntax</li>
+     *     <li>401 Unauthorized: The request requires user authentication</li>
+     *     <li>403 Forbidden: The server understood the request, but is 
refusing to fulfill it</li>
+     *     <li>404 Not Found: The server has not found anything matching the 
Request-URI</li>
+     *     <li>410 Gone: The requested resource is no longer available at the 
server and no forwarding address is known</li>
+     *     <li>500 Internal Server Error: The server encountered an unexpected 
condition which prevented it from fulfilling the request</li>
+     * </ul>
+     */
+    private static final Set<Integer> DEFAULT_UNDERSTOOD_STATUS_CODES =

Review Comment:
   @arturobernalg There are other status codes that should be included here: 
all of 3xx, 4xx up to 417, 421, 5xx up to 505. I would also use a simple range 
checks there instead of a set contains for better performance and resource 
footprint. 
   
   Looks good otherwise.



-- 
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]

Reply via email to