premature exits bork cache

Jason A. Donenfeld Jason at
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:

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:

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?


More information about the CGit mailing list