summaryrefslogtreecommitdiff
path: root/ext/sockets
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
commit0a36161e13484a99ccf69bb38f206462d27cc6d6 (patch)
treed5107db4b7369603ac7c753829e8972ee74949f7 /ext/sockets
parentce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (diff)
downloadphp-upstream/5.1.2.tar.gz
Imported Upstream version 5.1.2upstream/5.1.2
Diffstat (limited to 'ext/sockets')
-rw-r--r--ext/sockets/php_sockets.h8
-rw-r--r--ext/sockets/php_sockets_win.c8
-rw-r--r--ext/sockets/php_sockets_win.h8
-rw-r--r--ext/sockets/sockets.c33
-rw-r--r--ext/sockets/unix_socket_constants.h8
-rw-r--r--ext/sockets/win32_socket_constants.h8
6 files changed, 45 insertions, 28 deletions
diff --git a/ext/sockets/php_sockets.h b/ext/sockets/php_sockets.h
index 056bc69a7..9cff58242 100644
--- a/ext/sockets/php_sockets.h
+++ b/ext/sockets/php_sockets.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -22,7 +22,7 @@
#ifndef PHP_SOCKETS_H
#define PHP_SOCKETS_H
-/* $Id: php_sockets.h,v 1.36 2005/08/03 14:07:51 sniper Exp $ */
+/* $Id: php_sockets.h,v 1.36.2.1 2006/01/01 12:50:13 sniper Exp $ */
#if HAVE_SOCKETS
diff --git a/ext/sockets/php_sockets_win.c b/ext/sockets/php_sockets_win.c
index 6366437d9..2f21f4ae2 100644
--- a/ext/sockets/php_sockets_win.c
+++ b/ext/sockets/php_sockets_win.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sockets_win.c,v 1.12 2005/08/03 14:07:51 sniper Exp $ */
+/* $Id: php_sockets_win.c,v 1.12.2.1 2006/01/01 12:50:13 sniper Exp $ */
#ifdef PHP_WIN32
diff --git a/ext/sockets/php_sockets_win.h b/ext/sockets/php_sockets_win.h
index 6c0e3c192..af2be5601 100644
--- a/ext/sockets/php_sockets_win.h
+++ b/ext/sockets/php_sockets_win.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_sockets_win.h,v 1.12 2005/08/03 14:07:52 sniper Exp $ */
+/* $Id: php_sockets_win.h,v 1.12.2.1 2006/01/01 12:50:13 sniper Exp $ */
#ifdef PHP_WIN32
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index fa8a12d48..b601efbd1 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: sockets.c,v 1.171.2.2 2005/11/03 15:00:51 mike Exp $ */
+/* $Id: sockets.c,v 1.171.2.7 2006/01/01 12:50:13 sniper Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -112,7 +112,7 @@ static
/* {{{ sockets_functions[]
*/
-function_entry sockets_functions[] = {
+zend_function_entry sockets_functions[] = {
PHP_FE(socket_select, first_through_third_args_force_ref)
PHP_FE(socket_create, NULL)
PHP_FE(socket_create_listen, NULL)
@@ -861,7 +861,19 @@ PHP_FUNCTION(socket_read)
}
if (retval == -1) {
- PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
+ /* if the socket is in non-blocking mode and there's no data to read,
+ don't output any error, as this is a normal situation, and not an error */
+ if (errno == EAGAIN
+#ifdef EWOULDBLOCK
+ || errno == EWOULDBLOCK
+#endif
+ ) {
+ php_sock->error = errno;
+ SOCKETS_G(last_error) = errno;
+ } else {
+ PHP_SOCKET_ERROR(php_sock, "unable to read from socket", errno);
+ }
+
efree(tmpbuf);
RETURN_FALSE;
}
@@ -1482,7 +1494,7 @@ PHP_FUNCTION(socket_sendto)
RETURN_FALSE;
}
- retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &sin, sizeof(sin));
+ retval = sendto(php_sock->bsd_socket, buf, (len > buf_len) ? buf_len : len, flags, (struct sockaddr *) &sin6, sizeof(sin6));
break;
#endif
default:
@@ -1506,7 +1518,9 @@ PHP_FUNCTION(socket_get_option)
zval *arg1;
struct linger linger_val;
struct timeval tv;
+#ifdef PHP_WIN32
int timeout = 0;
+#endif
socklen_t optlen;
php_socket *php_sock;
int other_val;
@@ -1581,7 +1595,10 @@ PHP_FUNCTION(socket_set_option)
struct linger lv;
struct timeval tv;
php_socket *php_sock;
- int ov, optlen, retval, timeout;
+ int ov, optlen, retval;
+#ifdef PHP_WIN32
+ int timeout;
+#endif
long level, optname;
void *opt_ptr;
diff --git a/ext/sockets/unix_socket_constants.h b/ext/sockets/unix_socket_constants.h
index ffb13e6af..86589f744 100644
--- a/ext/sockets/unix_socket_constants.h
+++ b/ext/sockets/unix_socket_constants.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: unix_socket_constants.h,v 1.5 2005/08/03 14:07:52 sniper Exp $ */
+/* $Id: unix_socket_constants.h,v 1.5.2.1 2006/01/01 12:50:13 sniper Exp $ */
/* This file is to be included by sockets.c */
diff --git a/ext/sockets/win32_socket_constants.h b/ext/sockets/win32_socket_constants.h
index 533ac292a..c3de6bd48 100644
--- a/ext/sockets/win32_socket_constants.h
+++ b/ext/sockets/win32_socket_constants.h
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is subject to version 3.0 of the PHP license, |
+ | This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: win32_socket_constants.h,v 1.5 2005/08/03 14:07:52 sniper Exp $ */
+/* $Id: win32_socket_constants.h,v 1.5.2.1 2006/01/01 12:50:13 sniper Exp $ */
/* This file is to be included by sockets.c */