From dev-return-19400-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Wed Nov 14 21:41:28 2007 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 95080 invoked from network); 14 Nov 2007 21:41:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 14 Nov 2007 21:41:28 -0000 Received: (qmail 12853 invoked by uid 500); 14 Nov 2007 21:41:15 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 12486 invoked by uid 500); 14 Nov 2007 21:41:14 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 12475 invoked by uid 99); 14 Nov 2007 21:41:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2007 13:41:14 -0800 X-ASF-Spam-Status: No, hits=-4.0 required=10.0 tests=RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of wsanchez@apple.com designates 17.254.13.22 as permitted sender) Received: from [17.254.13.22] (HELO mail-out3.apple.com) (17.254.13.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 14 Nov 2007 21:42:06 +0000 Received: from relay8.apple.com (relay8.apple.com [17.128.113.38]) by mail-out3.apple.com (Postfix) with ESMTP id A0D88189631B; Wed, 14 Nov 2007 13:40:53 -0800 (PST) Received: from relay8.apple.com (unknown [127.0.0.1]) by relay8.apple.com (Symantec Mail Security) with ESMTP id 8BBC440024; Wed, 14 Nov 2007 13:40:53 -0800 (PST) X-AuditID: 11807126-9f1bfbb000005a0a-2d-473b6b656b4b Received: from pucca.apple.com (pucca.apple.com [17.221.42.43]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by relay8.apple.com (Apple SCV relay) with ESMTP id 59418400B5; Wed, 14 Nov 2007 13:40:53 -0800 (PST) Cc: Aaron Bannert , Apache Portable Runtime Developers List Message-Id: From: =?ISO-8859-1?Q?Wilfredo_S=E1nchez_Vega?= To: Davi Arnaut In-Reply-To: <473A4F00.8000707@apache.org> Content-Type: multipart/signed; boundary=Apple-Mail-6--126595127; micalg=sha1; protocol="application/pkcs7-signature" Mime-Version: 1.0 (Apple Message framework v912) Subject: Re: sendfile(2) misbehaves when header iovecs are specified Date: Wed, 14 Nov 2007 13:40:53 -0800 References: <3CDF9687-11F8-4F1D-95E3-8875E6D94C4F@apple.com> <473A4F00.8000707@apache.org> X-Mailer: Apple Mail (2.912) X-Brightmail-Tracker: AAAAAA== X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail-6--126595127 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit More from the networking team: """ With regard's to Aaron's comments above, the return value is as expected. The "len" parameter specifies the number of bytes for the header (if any) and the (possibly partial) contents of the file. In this case, it is 200,000, meaning the entire 80,000 bytes header plus 120,000 of the file contents, followed by the trailer, which is 90,029 bytes, will be sent. The total bytes sent is therefore 290,029 bytes (80,000 + 120,000 + 90,029). It implies that 80,000 bytes of the file contents did not get sent; only the first 120,000 bytes did. So, to elaborate this, on input "len" implies the maximum number of bytes in the header and/or file to be sent. It does not control the trailer whatsoever; if a trailer exists, all of it will be sent. If "len" is 0, all of the header and/or file will be sent before the trailer (all of it, always) finally gets sent. On output, "len" specifies the total number of bytes sent. I agree the man page is not clear about this and should be modified. """ This looks to agree with what you are seeing. Correct? -wsv On Nov 13, 2007, at 5:27 PM, Davi Arnaut wrote: > Aaron Bannert wrote: >> Hmm, that's not the behavior I am seeing with Leopard's sendfile. I >> am >> seeing the value-result parameter come back with the total byes in >> the >> file plus the total size of the trailers, excluding the headers. >> >> For example, with a header of 80,000 bytes, a file of 200,000 bytes, >> and a trailer of 90,029 bytes (from APR's test/sendfile.c test). The >> input to the *len param starts as 200,000 (the size of the file) and >> after the call it comes back set as 290,029. If you're saying that >> the >> *len return result should be the total bytes sent (headers + file + >> trailers) then the result should have been 370,049. Note that in this >> example, the other end of the connection appears to have received at >> least 119980 bytes. >> >> >> Could we get a detailed explanation of what all the expected inputs >> and outputs are for sendfile in Leopard() (and if it's different that >> previous versions, the same for those would help too). >> > > From what I could figure out, it works like this: > > o If length <= headers_length: Length output is headers length + > trailers length. No bytes from the file are sent, headers and trailers > are sent. > > o If length > headers_length, Length output is headers length + > trailers > length + file bytes sent. (length - headers length) bytes from the > file > are sent, headers and trailers are sent. > > o If length == 0, Length is headers_length + trailers_length + file > size. Everything is sent. > > Strange... > > Regards, > > Davi Arnaut --Apple-Mail-6--126595127 Content-Disposition: attachment; filename=smime.p7s Content-Type: application/pkcs7-signature; name=smime.p7s Content-Transfer-Encoding: base64 MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIIH7jCCAz8w ggKooAMCAQICAQ0wDQYJKoZIhvcNAQEFBQAwgdExCzAJBgNVBAYTAlpBMRUwEwYDVQQIEwxXZXN0 ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEaMBgGA1UEChMRVGhhd3RlIENvbnN1bHRpbmcx KDAmBgNVBAsTH0NlcnRpZmljYXRpb24gU2VydmljZXMgRGl2aXNpb24xJDAiBgNVBAMTG1RoYXd0 ZSBQZXJzb25hbCBGcmVlbWFpbCBDQTErMCkGCSqGSIb3DQEJARYccGVyc29uYWwtZnJlZW1haWxA dGhhd3RlLmNvbTAeFw0wMzA3MTcwMDAwMDBaFw0xMzA3MTYyMzU5NTlaMGIxCzAJBgNVBAYTAlpB MSUwIwYDVQQKExxUaGF3dGUgQ29uc3VsdGluZyAoUHR5KSBMdGQuMSwwKgYDVQQDEyNUaGF3dGUg UGVyc29uYWwgRnJlZW1haWwgSXNzdWluZyBDQTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA xKY8VXNV+065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