premature exits bork cache

Jason A. Donenfeld Jason at zx2c4.com
Fri Feb 26 13:29:21 CET 2016


Hi guys,

When caching is turned on, if we exit(0) early from a cmd, the cache
won't be properly finalized (or even sent), and we get a server error
because of blank output. I just fixed this bug with redirect:

https://git.zx2c4.com/cgit/commit/?id=e9cbdf64632fbe64d6b0c4974ac947ef954938e7

This is fine, because it's called only from 1 function (three times),
and that function then returns, so execution doesn't continue after
the redirect. It simply gives control back to the caching layer that
does things properly now.

But I noticed we have this issue with HTTP HEAD method:

https://git.zx2c4.com/cgit/tree/ui-shared.c#n695

Here we're calling exit(0). The motivation, I imagine, was that we
want to retain the same handlers, but just return the headers for the
HEAD method. Unfortunately, this borks the cache layer for the same
reasons as described above. I'm not yet sure the cleanest way to fix
this. Suggestions?

Jason


More information about the CGit mailing list