Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ PHP NEWS
- Streams:
. Applied the so_linger, so_rcvbuf and so_sndbuf context options to unix
sockets. (David Carlier)
. Improved performance of stream_socket_client() and fsockopen() connects
on Windows by avoiding a slow getsockopt(SO_ERROR) call on success
(GH-24171). (vibbow)

- Standard:
. Fixed bug #60110 (fclose(), file_put_contents(), copy() do not return false
Expand Down
7 changes: 7 additions & 0 deletions main/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,13 @@ PHPAPI int php_network_connect_socket(php_socket_t sockfd,
ret = -1;
} else if (n == 0) {
error = PHP_TIMEOUT_ERROR_VALUE;
#ifdef PHP_WIN32
} else if ((n & POLLOUT) && !(n & POLLPRI)) {
/* Writable and not in exceptfds: the connect succeeded (see the
* comment above). Skip getsockopt(SO_ERROR) here, as calling it
* right after the connection completes can block for 10-25ms. */
error = 0;
#endif
} else {
len = sizeof(error);
/* BSD-derived systems set errno correctly.
Expand Down
Loading