Sweden-Number/dlls/ws2_32
Bastien Orivel d6ea38f32d ws2_32: Fix setsockopt(TCP_NODELAY) when optlen is less than 4.
According to MSDN [1], the `TCP_NODELAY` parameter should be of type
`BOOL` which is 4 bytes. Due to a bug [2] in rustc passing a byte
instead of an int, any program written in rust that tries to set that
option on a socket will fail with a "Invalid parameter supplied" error.

Turns out that setsockopt on linux does not want optlen to be less than
4 bytes [3].

Windows' behavior is the following:
- For optlen <= 0, return SOCKET_ERROR and set last error to WSAEFAULT
- For optlen > 0, ignore the optlen value and set the TCP_NODELAY value
  to one if the first byte of the given optvalue is not 0.

This will fix any rust program using the hyper library to do HTTP
requests.

[1]: https://docs.microsoft.com/en-us/windows/win32/winsock/ipproto-tcp-socket-options
[2]: 44593aeb13/library/std/src/sys/windows/net.rs (L470)
[3]: d58071a8a7/net/ipv4/tcp.c (L3419-L3420)

Signed-off-by: Bastien Orivel <eijebong@bananium.fr>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-04 09:46:07 +01:00
..
tests ws2_32: Fix setsockopt(TCP_NODELAY) when optlen is less than 4. 2022-02-04 09:46:07 +01:00
Makefile.in include: Add support for defining Win32 types as 'long' where possible. 2022-01-27 20:38:22 +01:00
async.c ws2_32: Use malloc() instead of HeapAlloc(). 2021-08-19 11:33:25 +02:00
hosts
networks
protocol
protocol.c ws2_32: Fix memory leak on error path in get_local_ips (cppcheck). 2022-02-02 18:43:10 +01:00
services
socket.c ws2_32: Fix setsockopt(TCP_NODELAY) when optlen is less than 4. 2022-02-04 09:46:07 +01:00
unixlib.c ws2_32: Fix memory leaks on error paths in unix_gethostby* (scan-build). 2022-02-02 18:43:10 +01:00
version.rc
ws2_32.spec ws2_32: Do not use the WS_ prefix in PE code. 2021-08-06 14:33:22 +02:00
ws2_32_private.h ws2_32: Do not assume that an fd_set is bounded by FD_SETSIZE. 2021-12-30 23:09:45 +01:00