summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornelsonb%netscape.com <devnull@localhost>2000-05-18 01:32:53 +0000
committernelsonb%netscape.com <devnull@localhost>2000-05-18 01:32:53 +0000
commit62241c37c85821739f8a56e142c1e7afd921f877 (patch)
tree94323132e16e7415fbc29c73c4ba54f7fc0bfa3e
parent25a2d702d734729a8cc512243e6531293c148c34 (diff)
downloadnss-hg-62241c37c85821739f8a56e142c1e7afd921f877.tar.gz
Changes to ssl_EmulateSendFile suggested by Wan-Teh.
See http://bugzilla.mozilla.org/show_bug.cgi?id=39011
-rw-r--r--security/nss/lib/ssl/emulate.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/security/nss/lib/ssl/emulate.c b/security/nss/lib/ssl/emulate.c
index 837caa9a0..bb6efc140 100644
--- a/security/nss/lib/ssl/emulate.c
+++ b/security/nss/lib/ssl/emulate.c
@@ -42,6 +42,10 @@
#if defined( XP_UNIX )
#include <fcntl.h>
#endif
+#if defined(WIN32)
+#include <windef.h>
+#include <winbase.h>
+#endif
#include <string.h>
#define AMASK 7 /* mask for alignment of PRNetAddr */
@@ -490,7 +494,15 @@ ssl_EmulateSendFile(PRFileDesc *sd, PRSendFileData *sfd,
else
file_bytes = info.size - sfd->file_offset;
+#if defined(WIN32)
+ {
+ SYSTEM_INFO sysinfo;
+ GetSystemInfo(&sysinfo);
+ pagesize = sysinfo.dwAllocationGranularity;
+ }
+#else
pagesize = PR_GetPageSize();
+#endif
/*
* If the file is large, mmap and send the file in chunks so as
* to not consume too much virtual address space
@@ -520,7 +532,7 @@ ssl_EmulateSendFile(PRFileDesc *sd, PRSendFileData *sfd,
* Map in (part of) file. Take care of zero-length files.
*/
if (len > 0) {
- mapHandle = PR_CreateFileMap(sfd->fd, mmap_len, PR_PROT_READONLY);
+ mapHandle = PR_CreateFileMap(sfd->fd, info.size, PR_PROT_READONLY);
if (!mapHandle) {
count = -1;
goto done;