summaryrefslogtreecommitdiff
path: root/network_io/win32
Commit message (Collapse)AuthorAgeFilesLines
* Remove trailing whitespaces in *.c.Ivan Zhakov2022-11-203-66/+66
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1905414 13f79535-47bb-0310-9956-ffa450edef68
* Following up on r1904715, rework the check to properly handle anEvgeny Kotkov2022-10-201-7/+2
| | | | | | | | | | overflow when apr_size_t is 32-bit long. * network_io/win32/sendrecv.c (apr_socket_sendv): As above. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1904734 13f79535-47bb-0310-9956-ffa450edef68
* Win32: Stop apr_socket_sendv() from splitting iovecs into multiple possibleEvgeny Kotkov2022-10-201-31/+21
| | | | | | | | | | | | | | | | | | WSABUFs and error out on theoretical cases that cannot be handled with a single WSASend(). WSASend() returns the NumberOfBytesSent as DWORD, so the previous code that splitted overflowing iovecs never worked, as the total number of sent bytes cannot be properly represented by the API. So let's maintain a 1:1 relationship between the iovecs and WSABUFs, and error out on all inputs that exceed MAXDWORD. * network_io/win32/sendrecv.c (apr_socket_sendv): Remove the code that splits iovecs into WSABUFs. Check the sizes of all iovecs and the total size. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1904715 13f79535-47bb-0310-9956-ffa450edef68
* Revert r1902312, r1904699 in preparation for a slightly different change.Evgeny Kotkov2022-10-201-62/+26
| | | | | | | | | | | | Shortlog: - r1902312: apr_socket_sendv: WIN32: Limit the number of WSABUFs allocated for a single call. - r1904699: apr_socket_sendv: WIN32: Follow up to r1902312: Avoid short writes. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1904714 13f79535-47bb-0310-9956-ffa450edef68
* apr_socket_sendv: WIN32: Follow up to r1902312: Avoid short writes.Yann Ylavic2022-10-191-30/+57
| | | | | | | | | | | | | | | | | | | | | | | | We possibly (edge cases) can't send an entire iovec array in a single WSASend() call because structs WSABUF and iovec are ABI incompatible. To avoid breaking users that rely on full-write by apr_socket_sendv(), which supposedly is guaranteed by WSASend(), repeat the call until the given iovec array is exhausted. There is no way to provide both full-write and atomicity guarantees for apr_socket_sendv() on Windows, so we choose the former.. * include/apr_network_io.h: Document apr_socket_sendv() full-write/atomicity (non-)guarantees above the system ones. * network_io/win32/sendrecv.c(apr_socket_sendv): Change to a loop on WSASend() when needed, taking care of its API limits w.r.t. the given struct iovec. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1904699 13f79535-47bb-0310-9956-ffa450edef68
* apr_socket_sendv: WIN32: Limit the number of WSABUFs allocated for a single ↵Yann Ylavic2022-06-281-12/+21
| | | | | | | | | | | | | | call. * network_io/win32/sendrecv.c(): Define WSABUF_ON_HEAP to 500. * network_io/win32/sendrecv.c(apr_socket_sendv): Do not sendv more than WSABUF_ON_HEAP WSABUFs. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1902312 13f79535-47bb-0310-9956-ffa450edef68
* On 'win32-pollset-wakeup-no-file-socket-emulation' branch:Ivan Zhakov2022-01-201-0/+195
| | | | | | | | | Windows: Use term `socket_pipe` instead for `file_socket_pipe` for internal poll wakeup socket API. Move implementation to network_io/win32/socket_pipe.c from file_io/win32/pipe.c. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897246 13f79535-47bb-0310-9956-ffa450edef68
* Stage 3 in dismantling _WIN32_WCE ... cleanup codeMladen Turk2021-12-021-21/+0
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1895508 13f79535-47bb-0310-9956-ffa450edef68
* Remove the APR_SENDFILE_DISCONNECT_SOCKET flag.Ivan Zhakov2019-09-201-34/+13
| | | | | | | | | | | | | | | | | | There are several problems with this flag: 1. The TCP socket may be subject to the TCP TIME_WAIT state. That means apr_sock_sendfile() could occupy worker thread for significant time (30 seconds) 2. With this flag specified, the socket descriptor is removed from the apr_socket_t and the caller caller is expected to maintain the descriptor and release it manually, which is particularly error-prone. See also: https://lists.apache.org/thread.html/a3c4a03961a4b5842e7f657a15fe777edf5949b768a2807619a104b1@%3Cdev.apr.apache.org%3E git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1867226 13f79535-47bb-0310-9956-ffa450edef68
* win32: Use TF_USE_KERNEL_APC for TransmitFile(). According to theIvan Zhakov2019-09-141-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | documentation [1] TF_USE_KERNEL_APC is the most performant option: [[[ Directs the driver to use kernel asynchronous procedure calls (APCs) instead of worker threads to process long TransmitFile requests. Long TransmitFile requests are defined as requests that require more than a single read from the file or a cache; the request therefore depends on the size of the file and the specified length of the send packet. Use of TF_USE_KERNEL_APC can deliver significant performance benefits. It is possible (though unlikely), however, that the thread in which context TransmitFile is initiated is being used for heavy computations; this situation may prevent APCs from launching. ]]] The downside is not applicable for our use case since calling thread is not busy and waiting for operation completion. [1] https://docs.microsoft.com/en-gb/windows/win32/api/mswsock/nf-mswsock-transmitfile git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866934 13f79535-47bb-0310-9956-ffa450edef68
* win32: Do not use TransmitFile directly. According to documentationIvan Zhakov2019-09-141-7/+25
| | | | | | | | | | | | | | TransmitFile() should not be used directly and pointer to function should retrieved using WSAIoctl: https://docs.microsoft.com/en-gb/windows/win32/api/mswsock/nf-mswsock-transmitfile#remarks * network_io/win32/sendrecv.c (apr_socket_sendfile): Retrieve pointer to TransmitFile using WSAIoctl. * CMakeLists.txt (APR_SYSTEM_LIBS): Remove reference to mswsock.lib. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866932 13f79535-47bb-0310-9956-ffa450edef68
* * network_io/win32/sendrecv.cIvan Zhakov2019-09-141-4/+0
| | | | | | | (apr_socket_sendfile): Remove Windows 95 compatibility code. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1866928 13f79535-47bb-0310-9956-ffa450edef68
* Windows: create non-inheritable sockets in one step instead of creating aIvan Zhakov2019-06-111-20/+28
| | | | | | | | | | | | | | | | socket and only then marking it as non-inheritable. This protects against a potential socket handle leak in case of certain race conditions. See also: https://support.microsoft.com/en-us/help/2398202/an-application-may-stop-responding-when-the-application-closes-a-socke * network_io/win32/sockets.c (apr_socket_create): Use the WSA_FLAG_NO_HANDLE_INHERITED when supported by the OS. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1861073 13f79535-47bb-0310-9956-ffa450edef68
* * network_io/win32/sockets.c: Remove ANSI codepath.Ivan Zhakov2019-06-111-33/+11
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1861043 13f79535-47bb-0310-9956-ffa450edef68
* apr_socket_listen(): Allow larger backlog queue lengths on Windows 8+.Ivan Zhakov2017-08-171-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Starting with Windows 8, the socket listen() function accepts a special SOMAXCONN_HINT(N) argument that allows making the backlog queue length larger than the otherwise predefined limit of around 200: https://msdn.microsoft.com/en-us/library/windows/desktop/ms739168 https://blogs.msdn.microsoft.com/winsdk/2015/06/01/winsocks-listen-backlog-offers-more-flexibility-in-windows-8/ Having a larger listen backlog can be used for certain high performance applications that need to handle lots of incoming connections. One example would be the httpd server with it's "ListenBacklog" directive where setting it to a larger value currently allows serving more concurrent connections on Windows with mpm_winnt. * include/arch/win32/apr_arch_misc.h (enum apr_oslevel_e): Add APR_WIN_8. * misc/win32/misc.c (apr_get_oslevel): Determine whether we are running on Windows 7 or on Windows 8+. * network_io/win32/sockets.c (SOMAXCONN_HINT): Define this macro in case we are building against an older version of Windows SDK. (apr_socket_listen): Use SOMAXCONN_HINT() for the backlog queue length if it's supported by the Windows version we are running on. Patch by: Evgeny Kotkov <evgeny.kotkov {at} visualsvn.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1805309 13f79535-47bb-0310-9956-ffa450edef68
* follow up to r1523384: if we disable non-blocking when a timeout is set, ↵Jeff Trawick2013-09-161-0/+1
| | | | | | forget that non-blocking is enabled git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1523615 13f79535-47bb-0310-9956-ffa450edef68
* On Windows, a socket timeout isn't implemented withJeff Trawick2013-09-151-1/+1
| | | | | | | | | non-blocking socket + poll. When a socket is non- blocking and a timeout is set, the non-blocking state must be disabled. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1523384 13f79535-47bb-0310-9956-ffa450edef68
* Add support for APR_SO_BROADCASTStefan Fritsch2011-10-151-0/+9
| | | | | | | | PR: 46389 Submitted by: Armin Müller <mueller itestra com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1183693 13f79535-47bb-0310-9956-ffa450edef68
* IPV6_V6ONLY on Windows:Jeff Trawick2011-04-132-1/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Deal with SDKs which don't have the symbol definition * Deal with old run-time platforms which don't implement the option and have hard-coded behavior internally (option always on) Behavior changes: run on Windows >= Vista, SDK has IPV6_V6ONLY: no change in behavior run on Windows >= Vista, SDK doesn't have IPV6_V6ONLY: works just like SDK had the def'n (will return APR_SUCCESS on IPv6 socket instead of WSAENOPROTOOPT) run on Windows < Vista, regardless of SDK: socket_opt_get/set(APR_IPV6_V6ONLY) reflect stack behavior (always on) previously, if IPV6_V6ONLY was defined: set returned WSAENOPROTOOPT previously, if IPV6_V6ONLY was not defined: set returned APR_ENOTIMPL previously, regardless of IPV6_V6ONLY presence: get returned not-enabled now: get always returns enabled; set returns APR_SUCCESS when enabling, APR_ENOTIMPL when trying to disable PR: 45321 Submitted by: Sob <sob hisoftware.cz> Tweaked by: trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1091757 13f79535-47bb-0310-9956-ffa450edef68
* restructure Windows apr_socket_connect() to more closely matchJeff Trawick2011-04-051-39/+67
| | | | | | | | | | | | the Unix implementation, fixing the getpeername() optimization and WSAEISCONN behavior PR: 48736 (covered WSAISCONN issue) Submitted by: <inoue ariel-networks.com> (WSAISCONN handling) Reworked/extended by: trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1089031 13f79535-47bb-0310-9956-ffa450edef68
* Windows: Save a call to getpeername() when trying to retrieve theJeff Trawick2011-04-031-0/+2
| | | | | | | remote address of a socket created by apr_socket_accept() git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1088352 13f79535-47bb-0310-9956-ffa450edef68
* apr_socket_wait() for WindowsJeff Trawick2011-04-021-1/+34
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1088103 13f79535-47bb-0310-9956-ffa450edef68
* clean up some low hanging gcc warnings on WinJeff Trawick2011-03-191-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1083169 13f79535-47bb-0310-9956-ffa450edef68
* return apr_get_netos_error() when setsockopt() failsJeff Trawick2011-03-141-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1081495 13f79535-47bb-0310-9956-ffa450edef68
* Make functions static.Guenter Knauf2010-09-011-2/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@991753 13f79535-47bb-0310-9956-ffa450edef68
* Some more NetWare build fixes.Guenter Knauf2010-08-031-0/+5
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@982038 13f79535-47bb-0310-9956-ffa450edef68
* axe unused variablesJeff Trawick2010-05-282-1/+2
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@949209 13f79535-47bb-0310-9956-ffa450edef68
* Apply the Unix fix to Win32 (gee thanks Joe ;-)William A. Rowe Jr2007-10-151-1/+4
| | | | | | | | | | Enhance the test introduced by Joe in 467600 to also invert the original IP structure as an IPv6 entity for IPv4 tests, if IPv6 is present. I settled on a test IP which Win32 just happens to tollerate if an IPv6 adapter isn't present. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@584885 13f79535-47bb-0310-9956-ffa450edef68
* I was experimenting with options on ELSE_WIN_OS_IS_ANSI,William A. Rowe Jr2007-08-241-1/+5
| | | | | | and realized this else combined with WCE is an oddball. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@569536 13f79535-47bb-0310-9956-ffa450edef68
* SetHandleInformation is not supported on WinCE, but the Win 9x code path William A. Rowe Jr2007-05-311-2/+2
| | | | | | | | | | | works fine if enabled (testsockets passes). Modifes the #if's so the Win9x code path is also used for WinCE. PR: 39859 Submitted by: Curt Arnold <carnold apache.org> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@543286 13f79535-47bb-0310-9956-ffa450edef68
* alloc_socket() now defaults to remote_host_unknown == 1William A. Rowe Jr2007-01-091-3/+1
| | | | | | | | | | Solves a bug on Win 2000 where AcceptEx inhibits the proper behavior of getpeername. PR: 41321 git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@494531 13f79535-47bb-0310-9956-ffa450edef68
* Sync Win32/OS2 unknown remote_addr and local_port flags to unix src.William A. Rowe Jr2006-11-281-0/+2
| | | | | | Reviewed by wrowe and jorton git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@480212 13f79535-47bb-0310-9956-ffa450edef68
* Fix the typo.Joe Orton2006-08-033-3/+3
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428317 13f79535-47bb-0310-9956-ffa450edef68
* Update license header.Joe Orton2006-08-033-18/+18
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@428313 13f79535-47bb-0310-9956-ffa450edef68
* Make apr_socket_recvfrom set the port in the from sockaddr.Garrett Rooney2006-04-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Submitted by: Anthony Minessale <anthmct@yahoo.com> PR: 39325 * network_io/win32/sendrecv.c (apr_socket_recvfrom): Fill in from->port. * network_io/unix/sendrecv.c (apr_socket_recvfrom): Ditto. * network_io/beos/sendrecv.c (apr_socket_recvfrom): Ditto. * test/testsockets.c (sendto_recievefrom): Zero out the port before calling recvfrom, to confirm that it's filled in. * CHANGES: Note change. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@397344 13f79535-47bb-0310-9956-ffa450edef68
* Zero the len out value on error, to follow the unix behavior ofWilliam A. Rowe Jr2006-02-041-0/+1
| | | | | | | | | apr_socket_send() Submitted by: Chris Demetriou <c.g.demetriou gmail.com> git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@374924 13f79535-47bb-0310-9956-ffa450edef68
* Support APR_SO_SNDBUF and APR_SO_RCVBUF on Windows.Jeff Trawick2005-06-141-0/+12
| | | | | | | | PR: 32177 Submitted by: Sim <sgobbi datamanagement.it>, Jeff Trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@190576 13f79535-47bb-0310-9956-ffa450edef68
* Implement pool accessor for socketsMladen Turk2005-06-122-12/+12
| | | | | | | | There is no functional change except changing stuct mamber from cntxt to pool to be able to use the ACCESSOR macros. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@190305 13f79535-47bb-0310-9956-ffa450edef68
* Update copyright year to 2005 and standardize on current copyright owner line.Justin Erenkrantz2005-02-043-3/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@151412 13f79535-47bb-0310-9956-ffa450edef68
* Implement APR_TCP_DEFER_ACCEPT for NetWare and Win32Bradley Nicholes2005-01-181-0/+15
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@125552 13f79535-47bb-0310-9956-ffa450edef68
* replaced define for DWORD_MAX with APR_DWORD_MAXJean-Jacques Clar2004-09-281-6/+6
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65354 13f79535-47bb-0310-9956-ffa450edef68
* WIN64: first in a series to get Windows IA64 builds clean, this serves pagesAllan K. Edwards2004-09-221-24/+62
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65340 13f79535-47bb-0310-9956-ffa450edef68
* Since this code only applies to sendfile, make sure that it is properly ↵Bradley Nicholes2004-07-261-0/+2
| | | | | | #ifdef'ed git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65291 13f79535-47bb-0310-9956-ffa450edef68
* Win32: Fix bug in apr_socket_sendfile that interferred with LSPs. PR 23982Bill Stoddard2004-07-222-30/+21
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65288 13f79535-47bb-0310-9956-ffa450edef68
* Fix stack overflow with IPv6 apr_socket_accept() on Win32.Jeff Trawick2004-05-211-0/+4
| | | | | | | | | PR: 28471 Submitted by: inoue <inoue ariel-networks.com> Reviewed by: Jeff Trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65108 13f79535-47bb-0310-9956-ffa450edef68
* Even if we do not check the value of APR_IPV6_V6ONLY before setting, we stillJustin Erenkrantz2004-04-031-1/+2
| | | | | | | | | | | | must set the option cache if we're setting APR_IPV6_V6ONLY. Otherwise, later apr_socket_opt_get calls will fail. This fixes Listen directives on IPv6 machines where IPV6_V6ONLY may be enabled (i.e. FreeBSD 5.x, OpenBSD, NetBSD) where it would not properly bind to the IPv4 socket. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@65034 13f79535-47bb-0310-9956-ffa450edef68
* Relicense APR under Apache License, Version 2.0Justin Erenkrantz2004-02-133-147/+30
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64904 13f79535-47bb-0310-9956-ffa450edef68
* Add apr_socket_type_get() for retrieving the type (e.g., stream)Jeff Trawick2003-11-301-0/+6
| | | | | | | | | | of the socket. Submitted by: Philippe M. Chiasson <gozer cpan.org> Reviewed by: trawick git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64801 13f79535-47bb-0310-9956-ffa450edef68
* Getting closer to 1.0 - eliminate APR_SO_TIMEOUT and replaceWilliam A. Rowe Jr2003-11-201-9/+0
| | | | | | | | | | various tests with (sock->timeout > 0). Also mop up some very hard to read statements by liberally applying parens. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64778 13f79535-47bb-0310-9956-ffa450edef68
* There were no 'cont'-named pool objects, simple copy-n-paste bug.William A. Rowe Jr2003-11-171-1/+1
| | | | git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@64770 13f79535-47bb-0310-9956-ffa450edef68