You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by tr...@apache.org on 2009/02/01 13:48:43 UTC
svn commit: r739754 - in /apr/apr/branches/1.4.x: CHANGES
network_io/unix/sendrecv.c
Author: trawick
Date: Sun Feb 1 12:48:43 2009
New Revision: 739754
URL: http://svn.apache.org/viewvc?rev=739754&view=rev
Log:
backport r739640 from trunk
apr_socket_sendfile() on Solaris: Fix handling of files truncated
after the sender determines the length. (This fixes a busy loop in
httpd when a file being served is truncated.)
Some other implementations of apr_socket_sendfile() were already
patched along the way to handle this; some apparently remain broken.
Modified:
apr/apr/branches/1.4.x/CHANGES
apr/apr/branches/1.4.x/network_io/unix/sendrecv.c
Modified: apr/apr/branches/1.4.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/CHANGES?rev=739754&r1=739753&r2=739754&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.4.x/CHANGES [utf-8] Sun Feb 1 12:48:43 2009
@@ -1,6 +1,10 @@
-*- coding: utf-8 -*-
Changes for APR 1.4.0
+ *) apr_socket_sendfile() on Solaris: Fix handling of files truncated
+ after the sender determines the length. (This fixes a busy loop in
+ httpd when a file being served is truncated.) [Jeff Trawick]
+
*) Fix documentation for apr_temp_dir_get().
PR 46303 [Carlo Marcelo Arenas Belon <carenas sajinet.com.pe>]
Modified: apr/apr/branches/1.4.x/network_io/unix/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.4.x/network_io/unix/sendrecv.c?rev=739754&r1=739753&r2=739754&view=diff
==============================================================================
--- apr/apr/branches/1.4.x/network_io/unix/sendrecv.c (original)
+++ apr/apr/branches/1.4.x/network_io/unix/sendrecv.c Sun Feb 1 12:48:43 2009
@@ -1083,6 +1083,14 @@
/* Update how much we sent */
*len = nbytes;
+
+ if (nbytes == 0) {
+ /* Most likely the file got smaller after the stat.
+ * Return an error so the caller can do the Right Thing.
+ */
+ return APR_EOF;
+ }
+
if ((sock->timeout > 0) && (*len < requested_len)) {
sock->options |= APR_INCOMPLETE_WRITE;
}