dmitry Thu Jan 20 09:28:57 2005 EDT Modified files: (Branch: PHP_5_0) /php-src NEWS /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/NEWS?r1=1.1760.2.199&r2=1.1760.2.200&ty=u Index: php-src/NEWS diff -u php-src/NEWS:1.1760.2.199 php-src/NEWS:1.1760.2.200 --- php-src/NEWS:1.1760.2.199 Thu Jan 20 07:40:14 2005 +++ php-src/NEWS Thu Jan 20 09:28:56 2005 @@ -36,6 +36,7 @@ y2k_compliance is On). (Ilia) - Fixed bug #31055 (apache2filter: per request leak proportional to the full path of the request URI). (kameshj at fastmail dot fm) +- Fixed bug #30901 (can't send cookies with soap envelop). (Dmitry) - Fixed bug #30726 (-.1 like numbers are not being handled correctly). (Ilia) - Fixed bug #30446 (apache2handler: virtual() includes files out of sequence) - Fixed bug #30430 (odbc_next_result() doesn't bind values and that results http://cvs.php.net/diff.php/php-src/ext/soap/php_http.c?r1=1.55.2.6&r2=1.55.2.7&ty=u Index: php-src/ext/soap/php_http.c diff -u php-src/ext/soap/php_http.c:1.55.2.6 php-src/ext/soap/php_http.c:1.55.2.7 --- php-src/ext/soap/php_http.c:1.55.2.6 Thu Jan 20 01:13:53 2005 +++ php-src/ext/soap/php_http.c Thu Jan 20 09:28:57 2005 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: php_http.c,v 1.55.2.6 2005/01/20 06:13:53 dmitry Exp $ */ +/* $Id: php_http.c,v 1.55.2.7 2005/01/20 14:28:57 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.110.2.17&r2=1.110.2.18&ty=u Index: php-src/ext/soap/soap.c diff -u php-src/ext/soap/soap.c:1.110.2.17 php-src/ext/soap/soap.c:1.110.2.18 --- php-src/ext/soap/soap.c:1.110.2.17 Thu Jan 20 07:47:05 2005 +++ php-src/ext/soap/soap.c Thu Jan 20 09:28:57 2005 @@ -17,7 +17,7 @@ | Dmitry Stogov <[EMAIL PROTECTED]> | +----------------------------------------------------------------------+ */ -/* $Id: soap.c,v 1.110.2.17 2005/01/20 12:47:05 dmitry Exp $ */ +/* $Id: soap.c,v 1.110.2.18 2005/01/20 14:28:57 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