Received: (qmail 3279 invoked by uid 2012); 5 Nov 1997 22:00:13 -0000 Message-Id: <19971105220013.3278.qmail@hyperreal.org> Date: 5 Nov 1997 22:00:13 -0000 From: Ben Reser Reply-To: breser@regnow.com To: apbugs@hyperreal.org Subject: send_fd and send_fd_length do not return bytes sent properly X-Send-Pr-Version: 3.2 >Number: 1366 >Category: apache-api >Synopsis: send_fd and send_fd_length do not return bytes sent properly >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: closed >Class: sw-bug >Submitter-Id: apache >Arrival-Date: Wed Nov 5 14:10:00 PST 1997 >Last-Modified: Sat Jan 10 12:59:37 PST 1998 >Originator: breser@regnow.com >Organization: >Release: 1.3b2 >Environment: Not terribly important here, this is a logic error in the code. I've found the problem and describe it and explain how to fix it. >Description: The send_fd_lenght function (which send_fd is based off of) does not calculate total bytes sent in a logical way. It increments after it reads from the file rather than after it has actually sent the data. Thus data that wasn't actually sent will be returned as being sent. This makes it impossible for a module to detect if a file transfer was completed. >How-To-Repeat: You'll have to write an Apache Module. The one that I was working on when I found this bug is a mod_perl module. However, mod_perl itself has a bug in the Apache module so that it doesn't give the return of the send_fd function (ARGHH). If you'd like instructions on how to fix this I could send you a very simple module that will show you the problem. >Fix: Yup, delete the line in send_fd_length (http_protocol.c) that reads: total_bytes_sent += n; and replace it with this line at the bottom of the while look that controls sending the data: total_bytes_sent += w%3 >Audit-Trail: Release-Changed-From-To: All (discovered in Stronghold)-1.3b2 Release-Changed-By: Lars.Eilebrecht@unix-ag.org Release-Changed-When: Fri Nov 7 14:53:19 PST 1997 State-Changed-From-To: open-analyzed State-Changed-By: dgaudet State-Changed-When: Thu Dec 25 19:26:43 PST 1997 State-Changed-Why: Yup, patch submitted to group for next beta. Dean State-Changed-From-To: analyzed-closed State-Changed-By: Lars.Eilebrecht@unix-ag.org State-Changed-When: Sat Jan 10 12:59:37 PST 1998 State-Changed-Why: A patch to fix the problem has been applied to the current source tree and will be available with Apache version 1.3b4. >Unformatted: