Skip to content

Commit 78932ba

Browse files
committed
Fixed bug #41984 (Hangs on large SoapClient requests)
1 parent 335cac3 commit 78932ba

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ PHP NEWS
7272
- Fixed bug #42015 (ldap_rename(): server error "DSA is unwilling to perform").
7373
(bob at mroczka dot com, Jani)
7474
- Fixed bug #41989 (move_uploaded_file() & relative path in ZTS mode). (Tony)
75+
- Fixed bug #41984 (Hangs on large SoapClient requests). (Dmitry)
7576
- Fixed bug #41983 (Error Fetching http headers terminated by '\n'). (Dmitry)
7677
- Fixed bug #41964 (strtotime returns a timestamp for non-time string of
7778
pattern '(A|a) .+'). (Derick)

main/streams/xp_socket.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <sys/un.h>
3232
#endif
3333

34+
#ifndef MSG_DONTWAIT
35+
# define MSG_DONTWAIT 0
36+
#endif
37+
3438
php_stream_ops php_stream_generic_socket_ops;
3539
PHPAPI php_stream_ops php_stream_socket_ops;
3640
php_stream_ops php_stream_udp_socket_ops;
@@ -59,7 +63,7 @@ static size_t php_sockop_write(php_stream *stream, const char *buf, size_t count
5963
ptimeout = &sock->timeout;
6064

6165
retry:
62-
didwrite = send(sock->socket, buf, count, 0);
66+
didwrite = send(sock->socket, buf, count, (sock->is_blocked && ptimeout) ? MSG_DONTWAIT : 0);
6367

6468
if (didwrite <= 0) {
6569
long err = php_socket_errno();
@@ -148,7 +152,7 @@ static size_t php_sockop_read(php_stream *stream, char *buf, size_t count TSRMLS
148152
return 0;
149153
}
150154

151-
nr_bytes = recv(sock->socket, buf, count, 0);
155+
nr_bytes = recv(sock->socket, buf, count, (sock->is_blocked && sock->timeout.tv_sec != -1) ? MSG_DONTWAIT : 0);
152156

153157
stream->eof = (nr_bytes == 0 || (nr_bytes == -1 && php_socket_errno() != EWOULDBLOCK));
154158

0 commit comments

Comments
 (0)