We do a stat() call to retrieve the needed information to generate Expires, max-age, Etag and Last-Modified headers. We therefore could also remove the fopen() and fclose() system calls.(I'm led to believe that stat() is better suited then fopen()+fclose() for a task like this anyway)Currently we didn't implement checking whether the file is readable or not, as we don't need this, maybe you do ..

Some things are hardcoded ( eg only use ETAG_USE_SIZE not MTIME or INODE ) and the expiration time. Adapt if needed