Bug 55833

Summary: mod_disk_cache reads from closed files
Product: Apache httpd-2 Reporter: Eric Covener <covener>
Component: mod_cache_disk / mod_disk_cacheAssignee: Apache HTTPD Bugs Mailing List <bugs>
Status: RESOLVED FIXED    
Severity: normal Keywords: FixedInTrunk, PatchAvailable
Priority: P2    
Version: 2.4.6   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: close headers.fd only when declining open_entity

Description Eric Covener 2013-12-02 00:34:14 UTC
mod_disk_cache reads and closes hdrs.fd in recall_headers() but clearly closes hdrs.fd in open_entity (the immediately preceding callback).

On unix, the read from the closed file seems to be tolerated because they are open with buffering, but I think this is not intended.

IIUC, hdrs.fd should be left open from branches that return OK, and closed on the others.  Or the relatively short data should be buffered explicitly somewhere in memory / mod_disk_cache.
Comment 1 Eric Covener 2013-12-02 17:26:32 UTC
Created attachment 31087 [details]
close headers.fd only when declining open_entity
Comment 2 Christophe JAILLET 2014-08-18 08:24:35 UTC
Fixed and released in 2.4.8