You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by iv...@apache.org on 2023/02/06 13:03:08 UTC
svn commit: r1907464 - in /apr/apr/branches/1.7.x: ./ CHANGES CMakeLists.txt libapr.mak network_io/win32/sendrecv.c
Author: ivan
Date: Mon Feb 6 13:03:08 2023
New Revision: 1907464
URL: http://svn.apache.org/viewvc?rev=1907464&view=rev
Log:
Merge r1866932 from trunk:
win32: Do not use TransmitFile directly.
Modified:
apr/apr/branches/1.7.x/ (props changed)
apr/apr/branches/1.7.x/CHANGES
apr/apr/branches/1.7.x/CMakeLists.txt
apr/apr/branches/1.7.x/libapr.mak
apr/apr/branches/1.7.x/network_io/win32/sendrecv.c
Propchange: apr/apr/branches/1.7.x/
------------------------------------------------------------------------------
Merged /apr/apr/trunk:r1866932
Modified: apr/apr/branches/1.7.x/CHANGES
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/CHANGES?rev=1907464&r1=1907463&r2=1907464&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/CHANGES [utf-8] (original)
+++ apr/apr/branches/1.7.x/CHANGES [utf-8] Mon Feb 6 13:03:08 2023
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes for APR 1.7.3
+ *) apr_socket_sendfile: Use WSAIoctl() to get TransmitFile function
+ pointer on Windows.
+
Changes for APR 1.7.2
*) Correct a packaging issue in 1.7.1. The contents of the release were
Modified: apr/apr/branches/1.7.x/CMakeLists.txt
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/CMakeLists.txt?rev=1907464&r1=1907463&r2=1907464&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/CMakeLists.txt (original)
+++ apr/apr/branches/1.7.x/CMakeLists.txt Mon Feb 6 13:03:08 2023
@@ -80,7 +80,6 @@ SET(APR_INCLUDE_DIRECTORIES
SET(APR_SYSTEM_LIBS
ws2_32
- mswsock
rpcrt4
)
Modified: apr/apr/branches/1.7.x/libapr.mak
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/libapr.mak?rev=1907464&r1=1907463&r2=1907464&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/libapr.mak (original)
+++ apr/apr/branches/1.7.x/libapr.mak Mon Feb 6 13:03:08 2023
@@ -173,7 +173,7 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /opt:ref
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /opt:ref
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
"$(INTDIR)\apr_atomic64.obj" \
@@ -417,7 +417,7 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib"
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib"
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
"$(INTDIR)\apr_atomic64.obj" \
@@ -661,7 +661,7 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /opt:ref
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib" /opt:ref
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
"$(INTDIR)\apr_atomic64.obj" \
@@ -905,7 +905,7 @@ BSC32_FLAGS=/nologo /o"$(OUTDIR)\libapr.
BSC32_SBRS= \
LINK32=link.exe
-LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib mswsock.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib"
+LINK32_FLAGS=kernel32.lib advapi32.lib ws2_32.lib ole32.lib shell32.lib rpcrt4.lib /nologo /base:"0x6EEC0000" /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)\libapr-1.pdb" /debug /out:"$(OUTDIR)\libapr-1.dll" /implib:"$(OUTDIR)\libapr-1.lib"
LINK32_OBJS= \
"$(INTDIR)\apr_atomic.obj" \
"$(INTDIR)\apr_atomic64.obj" \
Modified: apr/apr/branches/1.7.x/network_io/win32/sendrecv.c
URL: http://svn.apache.org/viewvc/apr/apr/branches/1.7.x/network_io/win32/sendrecv.c?rev=1907464&r1=1907463&r2=1907464&view=diff
==============================================================================
--- apr/apr/branches/1.7.x/network_io/win32/sendrecv.c (original)
+++ apr/apr/branches/1.7.x/network_io/win32/sendrecv.c Mon Feb 6 13:03:08 2023
@@ -255,11 +255,29 @@ APR_DECLARE(apr_status_t) apr_socket_sen
int disconnected = 0;
int sendv_trailers = 0;
char hdtrbuf[4096];
+ LPFN_TRANSMITFILE pfn_transmit_file = NULL;
+ static GUID wsaid_transmitfile = WSAID_TRANSMITFILE;
+ DWORD dw;
if (apr_os_level < APR_WIN_NT) {
return APR_ENOTIMPL;
}
+ /* According to documentation TransmitFile() should not be used directly.
+ * Pointer to function should retrieved using WSAIoctl:
+ * https://docs.microsoft.com/en-gb/windows/win32/api/mswsock/nf-mswsock-transmitfile#remarks
+ */
+ if (WSAIoctl(sock->socketdes, SIO_GET_EXTENSION_FUNCTION_POINTER,
+ &wsaid_transmitfile, sizeof(wsaid_transmitfile),
+ &pfn_transmit_file, sizeof(pfn_transmit_file),
+ &dw, NULL, NULL) == SOCKET_ERROR) {
+ return apr_get_os_error();
+ }
+
+ if (dw != sizeof(pfn_transmit_file)) {
+ return APR_EINVAL;
+ }
+
/* Use len to keep track of number of total bytes sent (including headers) */
bytes_to_send = *len;
*len = 0;
@@ -351,13 +369,13 @@ APR_DECLARE(apr_status_t) apr_socket_sen
sock->overlapped->OffsetHigh = (DWORD)(curoff >> 32);
#endif
/* XXX BoundsChecker claims dwFlags must not be zero. */
- rv = TransmitFile(sock->socketdes, /* socket */
- file->filehand, /* open file descriptor of the file to be sent */
- xmitbytes, /* number of bytes to send. 0=send all */
- 0, /* Number of bytes per send. 0=use default */
- sock->overlapped, /* OVERLAPPED structure */
- ptfb, /* header and trailer buffers */
- dwFlags); /* flags to control various aspects of TransmitFile */
+ rv = pfn_transmit_file(sock->socketdes, /* socket */
+ file->filehand, /* open file descriptor of the file to be sent */
+ xmitbytes, /* number of bytes to send. 0=send all */
+ 0, /* Number of bytes per send. 0=use default */
+ sock->overlapped, /* OVERLAPPED structure */
+ ptfb, /* header and trailer buffers */
+ dwFlags); /* flags to control various aspects of TransmitFile */
if (!rv) {
status = apr_get_netos_error();
if ((status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) ||