DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=43386>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=43386 Summary: Default handler produces wrong content length when replacing file Product: Apache httpd-2 Version: 2.2.4 Platform: Sun OS/Version: Solaris Status: NEW Severity: normal Priority: P2 Component: Core AssignedTo: [email protected] ReportedBy: [EMAIL PROTECTED] There is a race condition in the default handler which results in the content being truncated, if the file is replaced during the request. AFAIU in default_handler the following code is executed (using simple IO for demonstration): stat(path, &finfo); int fd = open(path, ...); read(fd, buf, finfo.size); If the file is replaced between the stat and the open calls, then the default handler uses the size of the old file as content length header and reads the corresponding number of bytes from the new file. So if the new file is larger, then the content is truncated. If it is smaller, then ??? To avoid this race condition, the file should be opened first and the open file handle be passed to fstat(). Alternatively, use chunked encoding to avoid having to calculate the content length in advance. -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
