dmitry Thu Jan 20 09:29:19 2005 EDT
Modified files:
/php-src/ext/soap php_http.c soap.c
Log:
Fixed bug #30901 (can't send cookies with soap envelop).
void SoapClient::__setCookie(string name [, string value])
http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.61&r2=1.62&ty=u
Index: php-src/ext/soap/php_http.c
diff -u php-src/ext/soap/php_http.c:1.61 php-src/ext/soap/php_http.c:1.62
--- php-src/ext/soap/php_http.c:1.61 Thu Jan 20 01:08:04 2005
+++ php-src/ext/soap/php_http.c Thu Jan 20 09:29:19 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.61 2005/01/20 06:08:04 dmitry Exp $ */
+/* $Id: php_http.c,v 1.62 2005/01/20 14:29:19 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -471,10 +471,10 @@
if
(zend_hash_index_find(Z_ARRVAL_PP(data), 0, (void**)&value) == SUCCESS &&
Z_TYPE_PP(value) ==
IS_STRING) {
zval **tmp;
- if
(zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == SUCCESS &&
-
strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0 &&
-
zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == SUCCESS &&
-
in_domain(phpurl->host,Z_STRVAL_PP(tmp)) &&
+ if
((zend_hash_index_find(Z_ARRVAL_PP(data), 1, (void**)&tmp) == FAILURE ||
+
strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_PP(tmp),Z_STRLEN_PP(tmp)) == 0)
&&
+
(zend_hash_index_find(Z_ARRVAL_PP(data), 2, (void**)&tmp) == FAILURE ||
+
in_domain(phpurl->host,Z_STRVAL_PP(tmp))) &&
(use_ssl ||
zend_hash_index_find(Z_ARRVAL_PP(data), 3, (void**)&tmp) == FAILURE)) {
smart_str_appendl(&soap_headers, key, strlen(key));
smart_str_appendc(&soap_headers, '=');
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.129&r2=1.130&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.129 php-src/ext/soap/soap.c:1.130
--- php-src/ext/soap/soap.c:1.129 Thu Jan 20 07:48:00 2005
+++ php-src/ext/soap/soap.c Thu Jan 20 09:29:19 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.129 2005/01/20 12:48:00 dmitry Exp $ */
+/* $Id: soap.c,v 1.130 2005/01/20 14:29:19 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -235,6 +235,7 @@
PHP_METHOD(SoapClient, __getFunctions);
PHP_METHOD(SoapClient, __getTypes);
PHP_METHOD(SoapClient, __doRequest);
+PHP_METHOD(SoapClient, __setCookie);
/* SoapVar Functions */
PHP_METHOD(SoapVar, SoapVar);
@@ -321,6 +322,7 @@
PHP_ME(SoapClient, __getFunctions, NULL, 0)
PHP_ME(SoapClient, __getTypes, NULL, 0)
PHP_ME(SoapClient, __doRequest, NULL, 0)
+ PHP_ME(SoapClient, __setCookie, NULL, 0)
{NULL, NULL, NULL}
};
@@ -2546,6 +2548,45 @@
}
/* }}} */
+/* {{{ proto void SoapClient::__setCookie(string name [, strung value])
+ Sets cookie thet will sent with SOAP request.
+ The call to this function will effect all folowing calls of SOAP methods.
+ If value is not specified cookie is removed. */
+PHP_METHOD(SoapClient, __setCookie)
+{
+ char *name;
+ char *val = NULL;
+ int name_len, val_len;
+ zval **cookies;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
+ &name, &name_len, &val, &val_len) == FAILURE) {
+ RETURN_NULL();
+ }
+
+ if (val == NULL) {
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies",
sizeof("_cookies"), (void **)&cookies) == SUCCESS) {
+ zend_hash_del(Z_ARRVAL_PP(cookies), name, name_len+1);
+ }
+ } else {
+ zval *zcookie;
+
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies",
sizeof("_cookies"), (void **)&cookies) == FAILURE) {
+ zval *tmp_cookies;
+
+ MAKE_STD_ZVAL(tmp_cookies);
+ array_init(tmp_cookies);
+ zend_hash_update(Z_OBJPROP_P(this_ptr), "_cookies",
sizeof("_cookies"), &tmp_cookies, sizeof(zval *), (void **)&cookies);
+ }
+
+ ALLOC_INIT_ZVAL(zcookie);
+ array_init(zcookie);
+ add_index_stringl(zcookie, 0, val, val_len, 1);
+ add_assoc_zval_ex(*cookies, name, name_len+1, zcookie);
+ }
+}
+/* }}} */
+
#ifndef ZEND_ENGINE_2
static void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS,
zend_property_reference *property_reference)
{
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php