On Thu, Aug 27, 2020 at 07:14:32PM +0200, Tim Düsterhus wrote: > William, > > Am 27.08.20 um 18:53 schrieb William Lallemand: > > Changing the status and reason in the IO handler is the right thing to > > do since it's for the response. > > Okay, good. Is there an easier way to generate a proper status line than > the two function calls? >
I honestly don't know, maybe Christopher has a better solution. > Just using 'http_replace_res_status' is not sufficient, because then the > result will be something like '304 Ok'. It would be okay if it would > clear the reason, but 304 + Ok is ugly. > > > However I don't think that's a good idea to access the request from the > > cache_io_handler. There can be some cases where you can't access the > > headers of the request here. It's suppose to have finished everything in > > the request once here. So you probably need to do the matching in the > > http-request action ( http_action_req_cache_use ) and then store a state > > in the applet which will be read in the io_handler. > > > > It's the same with http-response actions not being able to access > req.hdr. That makes sense to me. > That's indeed the same problem. > 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. -- William Lallemand