File php-5.1.2-soap.patch of Package php
--- ext/soap/soap.c 2006/01/01 12:50:13 1.156.2.11
+++ ext/soap/soap.c 2006/02/07 12:49:09 1.156.2.15
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.11 2006/01/01 12:50:13 sniper Exp $ */
+/* $Id: soap.c,v 1.156.2.15 2006/02/07 12:49:09 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -479,6 +479,7 @@
SOAP_GLOBAL(soap_version) = SOAP_1_1;
SOAP_GLOBAL(encoding) = NULL;
SOAP_GLOBAL(class_map) = NULL;
+ SOAP_GLOBAL(features) = 0;
return SUCCESS;
}
@@ -633,6 +634,9 @@
REGISTER_STRING_CONSTANT("XSD_NAMESPACE", XSD_NAMESPACE, CONST_CS | CONST_PERSISTENT);
REGISTER_STRING_CONSTANT("XSD_1999_NAMESPACE", XSD_1999_NAMESPACE, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT);
+
old_error_handler = zend_error_cb;
zend_error_cb = soap_error_handler;
@@ -755,7 +759,7 @@
PHP_METHOD(SoapFault, SoapFault)
{
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL;
- int fault_string_len, fault_code_len, fault_actor_len, name_len;
+ int fault_string_len, fault_actor_len, name_len, fault_code_len = 0;
zval *code = NULL, *details = NULL, *headerfault = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|s!z!s!z",
@@ -957,6 +961,11 @@
zend_hash_copy(service->class_map, (*tmp)->value.ht, (copy_ctor_func_t) zval_add_ref, (void *) &ztmp, sizeof(zval *));
}
+ if (zend_hash_find(ht, "features", sizeof("features"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG) {
+ service->features = Z_LVAL_PP(tmp);
+ }
+
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode.");
}
@@ -1358,6 +1367,7 @@
int arg_len;
xmlCharEncodingHandlerPtr old_encoding;
HashTable *old_class_map;
+ int old_features;
SOAP_SERVER_BEGIN_CODE();
@@ -1503,6 +1513,8 @@
SOAP_GLOBAL(encoding) = service->encoding;
old_class_map = SOAP_GLOBAL(class_map);
SOAP_GLOBAL(class_map) = service->class_map;
+ old_features = SOAP_GLOBAL(features);
+ SOAP_GLOBAL(features) = service->features;
old_soap_version = SOAP_GLOBAL(soap_version);
function = deserialize_function_call(service->sdl, doc_request, service->actor, &function_name, &num_params, ¶ms, &soap_version, &soap_headers TSRMLS_CC);
xmlFreeDoc(doc_request);
@@ -1773,6 +1785,7 @@
SOAP_GLOBAL(encoding) = old_encoding;
SOAP_GLOBAL(sdl) = old_sdl;
SOAP_GLOBAL(class_map) = old_class_map;
+ SOAP_GLOBAL(features) = old_features;
/* Free soap headers */
zval_dtor(&retval);
@@ -2189,6 +2202,11 @@
add_property_zval(this_ptr, "_classmap", class_map);
}
+ if (zend_hash_find(ht, "features", sizeof("features"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG) {
+ add_property_long(this_ptr, "_features", Z_LVAL_PP(tmp));
+ }
+
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));
@@ -2224,13 +2242,13 @@
}
/* }}} */
-static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *action, int version, zval *response TSRMLS_DC)
+static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *action, int version, int one_way, zval *response TSRMLS_DC)
{
int ret = TRUE;
char *buf;
int buf_size;
- zval func, param0, param1, param2, param3;
- zval *params[4];
+ zval func, param0, param1, param2, param3, param4;
+ zval *params[5];
zval **trace;
zval **fault;
@@ -2270,7 +2288,11 @@
params[3] = ¶m3;
ZVAL_LONG(params[3], version);
- if (call_user_function(NULL, &this_ptr, &func, response, 4, params TSRMLS_CC) != SUCCESS) {
+ INIT_ZVAL(param4);
+ params[4] = ¶m4;
+ ZVAL_LONG(params[4], one_way);
+
+ if (call_user_function(NULL, &this_ptr, &func, response, 5, params TSRMLS_CC) != SUCCESS) {
add_soap_fault(this_ptr, "Client", "SoapSlient::__doRequest() failed", NULL, NULL TSRMLS_CC);
ret = FALSE;
} else if (Z_TYPE_P(response) != IS_STRING) {
@@ -2313,6 +2335,7 @@
zval response;
xmlCharEncodingHandlerPtr old_encoding;
HashTable *old_class_map;
+ int old_features;
SOAP_CLIENT_BEGIN_CODE();
@@ -2358,21 +2381,36 @@
} else {
SOAP_GLOBAL(class_map) = NULL;
}
+ old_features = SOAP_GLOBAL(features);
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features"), (void **) &tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_LONG) {
+ SOAP_GLOBAL(features) = Z_LVAL_PP(tmp);
+ } else {
+ SOAP_GLOBAL(features) = 0;
+ }
if (sdl != NULL) {
fn = get_function(sdl, function);
if (fn != NULL) {
sdlBindingPtr binding = fn->binding;
+ int one_way = 0;
+
+ if (fn->responseName == NULL &&
+ fn->responseParameters == NULL &&
+ soap_headers == NULL) {
+ one_way = 1;
+ }
+
if (location == NULL) {
location = binding->location;
}
if (binding->bindingType == BINDING_SOAP) {
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
request = serialize_function_call(this_ptr, fn, NULL, fnb->input.ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC);
- ret = do_request(this_ptr, request, location, fnb->soapAction, soap_version, &response TSRMLS_CC);
+ ret = do_request(this_ptr, request, location, fnb->soapAction, soap_version, one_way, &response TSRMLS_CC);
} else {
request = serialize_function_call(this_ptr, fn, NULL, sdl->target_ns, real_args, arg_count, soap_version, soap_headers TSRMLS_CC);
- ret = do_request(this_ptr, request, location, NULL, soap_version, &response TSRMLS_CC);
+ ret = do_request(this_ptr, request, location, NULL, soap_version, one_way, &response TSRMLS_CC);
}
xmlFreeDoc(request);
@@ -2415,7 +2453,7 @@
}
smart_str_0(&action);
- ret = do_request(this_ptr, request, location, action.c, soap_version, &response TSRMLS_CC);
+ ret = do_request(this_ptr, request, location, action.c, soap_version, 0, &response TSRMLS_CC);
smart_str_free(&action);
xmlFreeDoc(request);
@@ -2458,10 +2496,11 @@
zend_throw_exception_object(exception TSRMLS_CC);
}
#endif
- if (SOAP_GLOBAL(encoding) != NULL) {
+ if (SOAP_GLOBAL(encoding) != NULL) {
xmlCharEncCloseFunc(SOAP_GLOBAL(encoding));
- }
- SOAP_GLOBAL(class_map) = old_class_map;
+ }
+ SOAP_GLOBAL(features) = old_features;
+ SOAP_GLOBAL(class_map) = old_class_map;
SOAP_GLOBAL(encoding) = old_encoding;
SOAP_GLOBAL(sdl) = old_sdl;
SOAP_CLIENT_END_CODE();
@@ -2497,7 +2536,7 @@
zval **param;
int arg_count;
zval **tmp;
- zend_bool free_soap_headers;
+ zend_bool free_soap_headers = 0;
HashPosition pos;
@@ -2711,15 +2750,21 @@
char *buf, *location, *action;
int buf_size, location_size, action_size;
long version;
+ long one_way = 0;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sssl|l",
&buf, &buf_size,
&location, &location_size,
&action, &action_size,
- &version) == FAILURE) {
+ &version, &one_way) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
- if (make_http_soap_request(this_ptr, buf, buf_size, location, action, version,
+ if (SOAP_GLOBAL(features) & SOAP_WAIT_ONE_WAY_CALLS) {
+ one_way = 0;
+ }
+ if (one_way && make_http_soap_request(this_ptr, buf, buf_size, location, action, version, NULL, NULL TSRMLS_CC)) {
+ RETURN_EMPTY_STRING();
+ } else if (make_http_soap_request(this_ptr, buf, buf_size, location, action, version,
&Z_STRVAL_P(return_value), &Z_STRLEN_P(return_value) TSRMLS_CC)) {
return_value->type = IS_STRING;
return;
--- ext/soap/php_http.c 2006/01/01 12:50:13 1.77.2.6
+++ ext/soap/php_http.c 2006/02/07 12:57:28 1.77.2.9
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_http.c,v 1.77.2.6 2006/01/01 12:50:13 sniper Exp $ */
+/* $Id: php_http.c,v 1.77.2.9 2006/02/07 12:57:28 dmitry Exp $ */
#include "php_soap.h"
#include "ext/standard/base64.h"
@@ -223,6 +223,7 @@
{
char *request;
smart_str soap_headers = {0};
+ smart_str soap_headers_z = {0};
int request_size, err;
php_url *phpurl = NULL;
php_stream *stream;
@@ -249,8 +250,10 @@
int level = Z_LVAL_PP(tmp) & 0x0f;
int kind = Z_LVAL_PP(tmp) & SOAP_COMPRESSION_DEFLATE;
+ if (level > 9) {level = 9;}
+
if ((Z_LVAL_PP(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) {
- smart_str_append_const(&soap_headers,"Accept-Encoding: gzip, deflate\r\n");
+ smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n");
}
if (level > 0) {
zval func;
@@ -270,11 +273,11 @@
if (kind == SOAP_COMPRESSION_DEFLATE) {
n = 2;
ZVAL_STRING(&func, "gzcompress", 0);
- smart_str_append_const(&soap_headers,"Content-Encoding: deflate\r\n");
+ smart_str_append_const(&soap_headers_z,"Content-Encoding: deflate\r\n");
} else {
n = 3;
ZVAL_STRING(&func, "gzencode", 0);
- smart_str_append_const(&soap_headers,"Content-Encoding: gzip\r\n");
+ smart_str_append_const(&soap_headers_z,"Content-Encoding: gzip\r\n");
ZVAL_LONG(params[2], 1);
}
if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS &&
@@ -413,13 +416,17 @@
smart_str_appendc(&soap_headers, ':');
smart_str_append_unsigned(&soap_headers, phpurl->port);
}
- smart_str_append_const(&soap_headers, "\r\n"
+ smart_str_append_const(&soap_headers, "\r\n"
"Connection: Keep-Alive\r\n"
/*
"Connection: close\r\n"
"Accept: text/html; text/xml; text/plain\r\n"
*/
"User-Agent: PHP SOAP 0.1\r\n");
+
+ smart_str_append(&soap_headers, &soap_headers_z);
+ smart_str_free(&soap_headers_z);
+
if (soap_version == SOAP_1_2) {
smart_str_append_const(&soap_headers,"Content-Type: application/soap+xml; charset=utf-8");
if (soapaction) {
@@ -672,6 +679,13 @@
} else {
add_soap_fault(this_ptr, "HTTP", "Failed to create stream??", NULL, NULL TSRMLS_CC);
return FALSE;
+ }
+
+ if (!buffer) {
+ php_stream_close(stream);
+ zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
+ zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
+ return TRUE;
}
do {
--- ext/soap/php_soap.h 2006/01/01 12:50:13 1.38.2.1
+++ ext/soap/php_soap.h 2006/02/07 12:49:09 1.38.2.3
@@ -17,7 +17,7 @@
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
-/* $Id: php_soap.h,v 1.38.2.1 2006/01/01 12:50:13 sniper Exp $ */
+/* $Id: php_soap.h,v 1.38.2.3 2006/02/07 12:49:09 dmitry Exp $ */
#ifndef PHP_SOAP_H
#define PHP_SOAP_H
@@ -119,6 +119,7 @@
char *uri;
xmlCharEncodingHandlerPtr encoding;
HashTable *class_map;
+ int features;
};
#define SOAP_CLASS 1
@@ -151,6 +152,9 @@
#define SOAP_AUTHENTICATION_BASIC 0
#define SOAP_AUTHENTICATION_DIGEST 1
+#define SOAP_SINGLE_ELEMENT_ARRAYS (1<<0)
+#define SOAP_WAIT_ONE_WAY_CALLS (2<<0)
+
ZEND_BEGIN_MODULE_GLOBALS(soap)
HashTable defEncNs; /* mapping of default namespaces to prefixes */
HashTable defEnc;
@@ -167,6 +171,7 @@
long cache_ttl;
xmlCharEncodingHandlerPtr encoding;
HashTable *class_map;
+ int features;
ZEND_END_MODULE_GLOBALS(soap)
#ifdef PHP_WIN32