ok2c commented on code in PR #874:
URL:
https://github.com/apache/httpcomponents-client/pull/874#discussion_r3795622290
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/cache/ResponseCacheControl.java:
##########
@@ -60,6 +60,13 @@ public final class ResponseCacheControl implements
CacheControl {
* The shared-max-age directive value.
*/
private final long sharedMaxAge;
+ /**
+ * Indicates whether a valid {@code s-maxage} directive was present in the
header. This is distinct from
+ * {@link #sharedMaxAge} being {@code >= 0}, since a syntactically present
but malformed value (for example
+ * {@code s-maxage=foo}) is stored as {@code 0} rather than {@code -1}.
RFC 9111 treats such an invalid
+ * directive as absent, so this flag records whether the directive
genuinely applies.
+ */
+ private final boolean sharedMaxAgePresent;
Review Comment:
@dxbjavid Any chance we could avoid this extra boolean? Can we use something
line `-Integer#MAX_VALUE` to represent an invalid value?
##########
httpclient5-cache/src/main/java/org/apache/hc/client5/http/impl/cache/CacheControlHeaderParser.java:
##########
@@ -244,6 +247,19 @@ private static long parseSeconds(final String name, final
String value) {
return delta;
}
+ private static boolean isDeltaSeconds(final String value) {
Review Comment:
@dxbjavid Could we move this logic into `#parseSeconds`?
--
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]