William,

Am 28.08.20 um 13:57 schrieb William Lallemand:
>> So basically I would need to simply store the 'if-none-match' of the
>> request within the `appctx`, yes?
> 
> That's right, once the object is found in the cache, you can check the
> etag from the request action and set a flag in the appctx which can be
> used in the io handler.

Okay, thank you. I adjusted the logic to store the if-none-match header of the
request within the appctx and I also added helper functions for the ETag
comparison logic.

As of right now the code has a memory leak. It appears that 
`http_cache_applet_release`
is not being called for uncached requests, thus leaking the if-none-match. I
would assume that this is an existing bug. Unfortunately I am not knowledgeable
enough to understand and fix that one. Someone more experienced than me should
take a look.

Best regards

Tim Düsterhus (4):
  MINOR: http: Add `enum etag_type http_get_etag_type(const struct ist)`
  MINOR: compression: Make use of http_get_etag_type()
  MINOR: http: Add `int etag_compare(struct ist, struct ist, int)`
  MEDIUM: cache: Add support for if-none-match for cache responses

 include/haproxy/applet-t.h        |  1 +
 include/haproxy/http-t.h          |  6 +++
 include/haproxy/http.h            | 23 ++++++++++
 reg-tests/cache/if-none-match.vtc | 72 +++++++++++++++++++++++++++++++
 src/cache.c                       | 40 +++++++++++++++--
 src/flt_http_comp.c               |  5 +--
 src/http.c                        | 32 ++++++++++++++
 7 files changed, 172 insertions(+), 7 deletions(-)
 create mode 100644 reg-tests/cache/if-none-match.vtc

-- 
2.28.0


Reply via email to