Commit Graph

284 Commits

Author SHA1 Message Date
Oleg Kalnichevski ccfb674a1e Upgraded HttpClient version to 5.4-alpha3-SNAPSHOT 2024-03-11 09:39:26 +01:00
Oleg Kalnichevski eb6fd6b1c2 HttpClientContext and HttpCacheContext to use instance variables for standard attributes 2024-02-29 17:12:35 +01:00
Oleg Kalnichevski 762b18fe69 HttpClientContext to use instance variables for standard attributes 2024-02-29 17:12:35 +01:00
Oleg Kalnichevski 8a7f707a61 Upgraded HttpCore to version 5.3-alpha2 2024-02-14 15:41:56 +01:00
Michael Lee 661589e386 Removed unused private fields and local variables 2024-02-10 14:18:04 +01:00
Oleg Kalnichevski f4f5f73be2 FileResourceFactory to generate stable file names for the same request Id and entity tag 2024-01-26 09:15:21 +01:00
Oleg Kalnichevski d787637e6e Cache ResourceFactory to make use of strong eTags when available 2024-01-26 09:15:21 +01:00
Oleg Kalnichevski 5ecd396f60 Deprecated #copy method in FileResourceFactory 2024-01-26 09:15:21 +01:00
Oleg Kalnichevski a1e8e9082e Better ETag handling 2024-01-18 20:08:39 +01:00
Oleg Kalnichevski d7108f60ae Added #toString methods to Resource implementations 2024-01-12 09:23:42 +01:00
Oleg Kalnichevski 7c0d083b12 Cache control and context API 2024-01-12 09:23:42 +01:00
Oleg Kalnichevski 364fa60cd3 Promote RequestCacheControl and ResponseCacheControl to public API 2024-01-12 09:23:42 +01:00
Oleg Kalnichevski aad5987246 Corrected version in @since 2024-01-06 15:25:58 +01:00
Oleg Kalnichevski f24c8010bb Made caching of 403 responses by the classic and async protocol handlers more consistent 2024-01-03 11:29:16 +01:00
Oleg Kalnichevski c5de6961d1 Upgraded HttpClient version to 5.4-alpha2-SNAPSHOT 2023-12-29 10:47:10 +01:00
Oleg Kalnichevski c3d99b130c Do not set the default HTTP version of cache response messages 2023-12-24 17:54:03 +01:00
Oleg Kalnichevski 6a497be400 Bug-fix: HTTP cache to use response Cache-Control `s-maxage` attribute only when configured as shared 2023-12-24 17:08:04 +01:00
Oleg Kalnichevski df090e4228 Use core MessageSupport methods instead of internal ones 2023-12-23 13:25:59 +01:00
Oleg Kalnichevski 4dc82b40f6 Removed references to deprecated functions 2023-12-23 13:16:25 +01:00
Oleg Kalnichevski 1bbf5f4371 Bug fix: when validating a cache entry the protocol handlers must use the current request message with additional headers generated by the previous request interceptors instead of the original request message 2023-12-13 11:54:48 +01:00
Oleg Kalnichevski 67a0b52919 Better debug logging in the caching protocol handlers 2023-12-13 11:54:48 +01:00
Oleg Kalnichevski 628a963a3a Better HTTP execution context management by caching protocol handlers 2023-12-13 11:54:48 +01:00
Oleg Kalnichevski abb958ec27 HTTPCLIENT-2277: Revised cache validation logic for conformance with the specification requirements per RFC 9111 section 4 2023-12-13 11:54:47 +01:00
Oleg Kalnichevski ebae9ef7e3 HTTPCLIENT-2277: Aligned CachedResponseSuitabilityChecker with the specification requirements per RFC 9111 section 4 2023-12-13 11:54:47 +01:00
Oleg Kalnichevski 99eb13934f HTTPCLIENT-2277: Aligned ResponseCachingPolicy with the specification requirements per RFC 9111 section 3 2023-12-13 11:54:47 +01:00
Oleg Kalnichevski fcb86dae11 HTTPCLIENT-2277: Do not store AUTHORIZATION request header in the cache entry per RFC 9111 section 3.5 2023-12-13 11:54:47 +01:00
Oleg Kalnichevski 1492f57a84 HTTPCLIENT-2277: Cache update bug fix 2023-12-13 11:54:47 +01:00
Oleg Kalnichevski 17540a7881 Moved methods used by the public API classes from CacheSupport to CacheKeyGenerator; added test cases 2023-12-13 11:54:46 +01:00
Oleg Kalnichevski 3ff5496ffb HttpCacheEntry to cache parsed DATE, EXPIRES and LAST_MODIFIED values; avoid parsing DATE header of cache entries and HTTP messages multiple times 2023-12-13 11:54:46 +01:00
Oleg Kalnichevski e7ee13701e Optimize `#isResponseCacheable` by parsing DATE and EXPIRES headers only once 2023-12-13 11:54:46 +01:00
Oleg Kalnichevski 762028805e Moved delta-second parsing routine to CacheSupport 2023-12-13 11:54:46 +01:00
Oleg Kalnichevski 6055776245 Fixed invalid flow control in CacheControlHeaderParser 2023-12-13 11:54:46 +01:00
Oleg Kalnichevski 152ba4736f Renamed cache protocol conformance response interceptor (no functional changes) 2023-12-13 11:54:45 +01:00
Oleg Kalnichevski 77fdc11818 HTTPCLIENT-2293: Via header improvements
* optimized parting of Via response header values in order to generate less intermediate garbage
* optimized Via message header generation
* moved Via request header generation to a cache request interceptor
* moved Via response header generation to a cache response interceptor
2023-12-13 11:54:45 +01:00
Oleg Kalnichevski 1b0e9cf7b0 HTTPCLIENT-2277: deprecation of obsolete config parameters and removal of oudated or meaningless tests (#484)
* HTTPCLIENT-2277: Deprecated 303 response caching switch as no longer required by RFC 9111

* Javadoc improvements (no functional changes)

* HTTPCLIENT-2277: Revision of HTTP cache protocol requirement and recommendation test cases:
* Removed links to RFC 2616
* Removed verbatim quotes from RFC 2616
* Removed obsolete test cases and test cases without result verification / assertions
* Removed test cases unrelated to HTTP caching
* Removed test cases without test result assertions
2023-12-13 11:54:45 +01:00
Oleg Kalnichevski c7d79190e6 HTTPCLIENT-2277: revised cache update handling
* improved and simplified internal cache API
* corrected cache update logic after a variant negotiation
* added more tests
2023-12-13 11:54:44 +01:00
Oleg Kalnichevski 02f09c03f4 HTTPCLIENT-2277, regression: corrected wrong variant entry keys in cache hits returned by `BasicHttpCache#getVariants` 2023-12-13 11:54:44 +01:00
Oleg Kalnichevski 893574e092 HTTPCLIENT-2284: internal cache storage improvements (#478) 2023-12-13 11:54:44 +01:00
Arturo Bernal 8466b19861 Refactor HttpClient synchronized sections for virtual threads (#476)
- Replaced `synchronized` blocks with `ReentrantLock` in `LeaseRequest` to better support virtual threads introduced in JDK 21.
- Ensured each `LeaseRequest` instance has its own unique lock for maintaining original synchronization semantics.
- Addressed potential performance and deadlock issues with virtual threads by using explicit lock primitives from `java.util.concurrent.locks`.
2023-12-13 11:54:44 +01:00
Oleg Kalnichevski 097c17b78b HTTPCLIENT-2284: Cache entry representation improvements: (#477)
* request URI stored in cache is now normalized and is presently expected to be the same as the root key
* removed references to variant cache keys from the cache entry
* Variants in root entries are now represented as a set, not as a map
2023-12-13 11:54:44 +01:00
Oleg Kalnichevski 5fe89b4e32 Removed unused method argument 2023-12-13 11:54:43 +01:00
Oleg Kalnichevski a8a66a1616 Fixed deprecation warnings 2023-12-13 11:54:43 +01:00
Oleg Kalnichevski 62d6db25e5 HTTPCLIENT-2277: Revision of the response protocol compliance checks: the caching layer should not attempt to enforce HTTP protocol compliance beyond what it required for correct operation of the caching functionality 2023-12-13 11:54:43 +01:00
Oleg Kalnichevski 0f7de55d41 HTTPCLIENT-2277: Removal of the HTTP protocol logic presently enforced in the caching layer directly related to the caching functionality. The enforcement of general protocol requirements should be implemented in the protocol layer. 2023-12-13 11:54:43 +01:00
Oleg Kalnichevski a19adcb0dd HTTPCLIENT-2277: Removal of support for deprecated `Pragma` header 2023-12-13 11:54:43 +01:00
Oleg Kalnichevski d1d6eec7dd HTTPCLIENT-2277: Removal of deprecated `Warning` header support 2023-12-13 11:54:43 +01:00
Arturo Bernal 561c949f78 Implement Cache-Control Extension in Response Caching Policy. (#462)
This commit adds the functionality to handle the 'immutable' directive in the Cache-Control header as per the RFC8246 specifications.

Key changes include:
- The 'immutable' directive is checked in the Cache-Control of an HTTP response, indicating that the origin server will not update the resource representation during the response's freshness lifetime.
- If the 'immutable' directive is present and the response is still fresh, the response is considered cacheable without further validation.
- Ignoring any arguments with the 'immutable' directive, as per RFC stipulations.
- Treating multiple instances of the 'immutable' directive as equivalent to one.
2023-12-13 11:54:42 +01:00
Oleg Kalnichevski 9bde706ae7 HTTPCLIENT-2277: Revision and simplification of the cache eviction logic; conformance to RFC 9111 section 4.4 2023-12-13 11:54:42 +01:00
Arturo Bernal a1d9d19b5b HTTPCLIENT-2277: Implement must-understand directive according to RFC 9111 (#461)
This commit introduces changes to handle the 'must-understand' directive in accordance with the updated HTTP cache-related RFC 9111. The logic ensures that the cache only stores responses with status codes it understands when the 'must-understand' directive is present.

This implementation adheres to the following RFC guidance:

- A cache that understands and conforms to the requirements of a response's status code may cache it when the 'must-understand' directive is present.
- If the 'no-store' directive is present along with the 'must-understand' directive, the cache can ignore the 'no-store' directive if it understands the status code's caching requirements.
2023-12-13 11:54:42 +01:00
Oleg Kalnichevski 5fbef8fc7f HTTPCLIENT-2277: optimization of internal cache operations 2023-12-13 11:54:42 +01:00