dmitry Wed Mar 23 03:08:54 2005 EDT
Modified files:
/php-src/ext/soap php_http.c soap.c
Log:
Allow define connection timeout throught "connection_timeout" option in
SoapClient constructor.
http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.67&r2=1.68&ty=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.67 php-src/ext/soap/php_http.c:1.68
--- php-src/ext/soap/php_http.c:1.67 Wed Mar 16 15:30:17 2005
+++ php-src/ext/soap/php_http.c Wed Mar 23 03:08:54 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.67 2005/03/16 20:30:17 iliaa Exp $ */
+/* $Id: php_http.c,v 1.68 2005/03/23 08:08:54 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -82,7 +82,7 @@
static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl,
int *use_proxy TSRMLS_DC)
{
php_stream *stream;
- zval **proxy_host, **proxy_port;
+ zval **proxy_host, **proxy_port, **tmp;
char *host;
#ifdef ZEND_ENGINE_2
php_stream_context *context = NULL;
@@ -91,6 +91,8 @@
#endif
int port;
int old_error_reporting;
+ struct timeval tv;
+ struct timeval *timeout = NULL;
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host",
sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
Z_TYPE_PP(proxy_host) == IS_STRING &&
@@ -103,6 +105,12 @@
host = phpurl->host;
port = phpurl->port;
}
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_connection_timeout",
sizeof("_connection_timeout"), (void **) &tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG && Z_LVAL_PP(tmp) > 0) {
+ tv.tv_sec = Z_LVAL_PP(tmp);
+ tv.tv_usec = 0;
+ timeout = &tv;
+ }
old_error_reporting = EG(error_reporting);
EG(error_reporting) &=
~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
@@ -126,12 +134,12 @@
ENFORCE_SAFE_MODE | REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
NULL /*persistent_id*/,
- NULL /*timeout*/,
+ timeout,
context,
NULL, NULL);
efree(name);
#else
- stream = php_stream_sock_open_host(host, port, SOCK_STREAM, NULL, NULL);
+ stream = php_stream_sock_open_host(host, port, SOCK_STREAM, timeout,
NULL);
#endif
/* SSL & proxy */
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.140&r2=1.141&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.140 php-src/ext/soap/soap.c:1.141
--- php-src/ext/soap/soap.c:1.140 Wed Mar 23 02:11:55 2005
+++ php-src/ext/soap/soap.c Wed Mar 23 03:08:54 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.140 2005/03/23 07:11:55 dmitry Exp $ */
+/* $Id: soap.c,v 1.141 2005/03/23 08:08:54 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -2094,6 +2094,11 @@
#endif
add_property_zval(this_ptr, "_classmap", class_map);
}
+
+ if (zend_hash_find(ht, "connection_timeout",
sizeof("connection_timeout"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG && Z_LVAL_PP(tmp) > 0) {
+ add_property_long(this_ptr, "_connection_timeout",
Z_LVAL_PP(tmp));
+ }
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri'
options are requred in nonWSDL mode");
return;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php