gitweb: make htmlcache compatible with FCGI mode
When running in FCGI mode, the STDOUT file handle is not
necessarily related to the STDOUT_FILENO file descriptor
in any way.
In order to capture the created output for caching, we
need to point the STDOUT file handle to the cache file.
Rather than attempting to use file descriptor operators
on it (which will only work if it's associated with a
real file descriptor), just replace the entire typeglob
with a new file handle and restore the old one when done.
This works properly whether we are running in FCGI mode
or not.
Signed-off-by: Kyle J. McKay <mackyle@gmail.com>