mirror of
https://github.com/php/php-src.git
synced 2026-03-31 04:32:19 +02:00
Merge branch 'phpng' of git.php.net:php-src into phpng
# By Dmitry Stogov # Via Dmitry Stogov * 'phpng' of git.php.net:php-src: ext/soap support for phpng (incomplete - just compilable)
This commit is contained in:
@@ -1757,6 +1757,20 @@ ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, do
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int add_property_str_ex(zval *arg, const char *key, uint key_len, zend_string *str TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval tmp;
|
||||
zval z_key;
|
||||
|
||||
ZVAL_STR(&tmp, str);
|
||||
ZVAL_STRINGL(&z_key, key, key_len);
|
||||
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, &tmp, -1 TSRMLS_CC);
|
||||
//??? zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
|
||||
zval_ptr_dtor(&z_key);
|
||||
return SUCCESS;
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC) /* {{{ */
|
||||
{
|
||||
zval tmp;
|
||||
|
||||
@@ -440,6 +440,7 @@ ZEND_API int add_property_null_ex(zval *arg, const char *key, uint key_len TSRML
|
||||
ZEND_API int add_property_bool_ex(zval *arg, const char *key, uint key_len, int b TSRMLS_DC);
|
||||
ZEND_API int add_property_resource_ex(zval *arg, const char *key, uint key_len, zend_resource *r TSRMLS_DC);
|
||||
ZEND_API int add_property_double_ex(zval *arg, const char *key, uint key_len, double d TSRMLS_DC);
|
||||
ZEND_API int add_property_str_ex(zval *arg, const char *key, uint key_len, zend_string *str TSRMLS_DC);
|
||||
ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str TSRMLS_DC);
|
||||
ZEND_API int add_property_stringl_ex(zval *arg, const char *key, uint key_len, const char *str, uint length TSRMLS_DC);
|
||||
ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval *value TSRMLS_DC);
|
||||
@@ -449,6 +450,7 @@ ZEND_API int add_property_zval_ex(zval *arg, const char *key, uint key_len, zval
|
||||
#define add_property_bool(__arg, __key, __b) add_property_bool_ex(__arg, __key, strlen(__key), __b TSRMLS_CC)
|
||||
#define add_property_resource(__arg, __key, __r) add_property_resource_ex(__arg, __key, strlen(__key), __r TSRMLS_CC)
|
||||
#define add_property_double(__arg, __key, __d) add_property_double_ex(__arg, __key, strlen(__key), __d TSRMLS_CC)
|
||||
#define add_property_str(__arg, __key, __str) add_property_str_ex(__arg, __key, strlen(__key), __str TSRMLS_CC)
|
||||
#define add_property_string(__arg, __key, __str) add_property_string_ex(__arg, __key, strlen(__key), __str TSRMLS_CC)
|
||||
#define add_property_stringl(__arg, __key, __str, __length) add_property_stringl_ex(__arg, __key, strlen(__key), __str, __length TSRMLS_CC)
|
||||
#define add_property_zval(__arg, __key, __value) add_property_zval_ex(__arg, __key, strlen(__key), __value TSRMLS_CC)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -183,23 +183,23 @@ struct _encodeType {
|
||||
|
||||
struct _encode {
|
||||
encodeType details;
|
||||
zval *(*to_zval)(encodeTypePtr type, xmlNodePtr data TSRMLS_DC);
|
||||
zval *(*to_zval)(zval *ret, encodeTypePtr type, xmlNodePtr data TSRMLS_DC);
|
||||
xmlNodePtr (*to_xml)(encodeTypePtr type, zval *data, int style, xmlNodePtr parent TSRMLS_DC);
|
||||
};
|
||||
|
||||
/* Master functions all encode/decode should be called thur these functions */
|
||||
xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr parent TSRMLS_DC);
|
||||
zval *master_to_zval(encodePtr encode, xmlNodePtr data TSRMLS_DC);
|
||||
zval *master_to_zval(zval *ret, encodePtr encode, xmlNodePtr data TSRMLS_DC);
|
||||
|
||||
/* user defined mapping */
|
||||
xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr parent TSRMLS_DC);
|
||||
zval *to_zval_user(encodeTypePtr type, xmlNodePtr node TSRMLS_DC);
|
||||
zval *to_zval_user(zval *ret, encodeTypePtr type, xmlNodePtr node TSRMLS_DC);
|
||||
|
||||
void whiteSpace_replace(xmlChar* str);
|
||||
void whiteSpace_collapse(xmlChar* str);
|
||||
|
||||
xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval* data, int style, xmlNodePtr parent TSRMLS_DC);
|
||||
zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data TSRMLS_DC);
|
||||
zval *sdl_guess_convert_zval(zval *ret, encodeTypePtr enc, xmlNodePtr data TSRMLS_DC);
|
||||
|
||||
void encode_finish();
|
||||
void encode_reset_ns();
|
||||
@@ -207,8 +207,8 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns);
|
||||
|
||||
encodePtr get_conversion(int encode);
|
||||
|
||||
void delete_encoder(void *handle);
|
||||
void delete_encoder_persistent(void *handle);
|
||||
void delete_encoder(zval *zv);
|
||||
void delete_encoder_persistent(zval *zv);
|
||||
|
||||
extern encode defaultEncoding[];
|
||||
extern int numDefaultEncodings;
|
||||
|
||||
@@ -34,24 +34,23 @@ static int get_http_headers(php_stream *socketd,char **response, int *out_size T
|
||||
/* Proxy HTTP Authentication */
|
||||
int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
|
||||
{
|
||||
zval **login, **password;
|
||||
zval *login, *password;
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login"), (void **)&login) == SUCCESS) {
|
||||
unsigned char* buf;
|
||||
int len;
|
||||
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login")-1)) != NULL) {
|
||||
zend_string *buf;
|
||||
smart_str auth = {0};
|
||||
|
||||
smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
|
||||
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
|
||||
smart_str_appendc(&auth, ':');
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password"), (void **)&password) == SUCCESS) {
|
||||
smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
|
||||
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL) {
|
||||
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
|
||||
}
|
||||
smart_str_0(&auth);
|
||||
buf = php_base64_encode((unsigned char*)auth.c, auth.len, &len);
|
||||
buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
|
||||
smart_str_append_const(soap_headers, "Proxy-Authorization: Basic ");
|
||||
smart_str_appendl(soap_headers, (char*)buf, len);
|
||||
smart_str_appendl(soap_headers, (char*)buf->val, buf->len);
|
||||
smart_str_append_const(soap_headers, "\r\n");
|
||||
efree(buf);
|
||||
STR_RELEASE(buf);
|
||||
smart_str_free(&auth);
|
||||
return 1;
|
||||
}
|
||||
@@ -61,25 +60,24 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
|
||||
/* HTTP Authentication */
|
||||
int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
|
||||
{
|
||||
zval **login, **password;
|
||||
zval *login, *password;
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS &&
|
||||
!zend_hash_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"))) {
|
||||
unsigned char* buf;
|
||||
int len;
|
||||
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
|
||||
!zend_hash_str_exists(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) {
|
||||
zend_string* buf;
|
||||
smart_str auth = {0};
|
||||
|
||||
smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
|
||||
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
|
||||
smart_str_appendc(&auth, ':');
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS) {
|
||||
smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
|
||||
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL) {
|
||||
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
|
||||
}
|
||||
smart_str_0(&auth);
|
||||
buf = php_base64_encode((unsigned char*)auth.c, auth.len, &len);
|
||||
buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
|
||||
smart_str_append_const(soap_headers, "Authorization: Basic ");
|
||||
smart_str_appendl(soap_headers, (char*)buf, len);
|
||||
smart_str_appendl(soap_headers, (char*)buf->val, buf->len);
|
||||
smart_str_append_const(soap_headers, "\r\n");
|
||||
efree(buf);
|
||||
STR_RELEASE(buf);
|
||||
smart_str_free(&auth);
|
||||
return 1;
|
||||
}
|
||||
@@ -93,12 +91,12 @@ void http_context_headers(php_stream_context* context,
|
||||
zend_bool has_cookies,
|
||||
smart_str* soap_headers TSRMLS_DC)
|
||||
{
|
||||
zval **tmp;
|
||||
zval *tmp;
|
||||
|
||||
if (context &&
|
||||
php_stream_context_get_option(context, "http", "header", &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp)) {
|
||||
char *s = Z_STRVAL_PP(tmp);
|
||||
(tmp = php_stream_context_get_option(context, "http", "header")) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp)) {
|
||||
char *s = Z_STRVAL_P(tmp);
|
||||
char *p;
|
||||
int name_len;
|
||||
|
||||
@@ -159,7 +157,7 @@ void http_context_headers(php_stream_context* context,
|
||||
static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, php_stream_context *context, int *use_proxy TSRMLS_DC)
|
||||
{
|
||||
php_stream *stream;
|
||||
zval **proxy_host, **proxy_port, **tmp;
|
||||
zval *proxy_host, *proxy_port, *tmp;
|
||||
char *host;
|
||||
char *name;
|
||||
char *protocol;
|
||||
@@ -169,20 +167,20 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
|
||||
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 &&
|
||||
zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port"), (void **) &proxy_port) == SUCCESS &&
|
||||
Z_TYPE_PP(proxy_port) == IS_LONG) {
|
||||
host = Z_STRVAL_PP(proxy_host);
|
||||
port = Z_LVAL_PP(proxy_port);
|
||||
if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL &&
|
||||
Z_TYPE_P(proxy_host) == IS_STRING &&
|
||||
(proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
|
||||
Z_TYPE_P(proxy_port) == IS_LONG) {
|
||||
host = Z_STRVAL_P(proxy_host);
|
||||
port = Z_LVAL_P(proxy_port);
|
||||
*use_proxy = 1;
|
||||
} else {
|
||||
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);
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) {
|
||||
tv.tv_sec = Z_LVAL_P(tmp);
|
||||
tv.tv_usec = 0;
|
||||
timeout = &tv;
|
||||
}
|
||||
@@ -192,10 +190,10 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
|
||||
|
||||
/* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */
|
||||
if (use_ssl && !*use_proxy) {
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method"), (void **) &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_LONG) {
|
||||
/* uses constants declared in soap.c to determine ssl uri protocol */
|
||||
switch (Z_LVAL_PP(tmp)) {
|
||||
switch (Z_LVAL_P(tmp)) {
|
||||
case SOAP_SSL_METHOD_TLS:
|
||||
protocol = "tls";
|
||||
break;
|
||||
@@ -255,7 +253,7 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
proxy_authentication(this_ptr, &soap_headers TSRMLS_CC);
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
if (php_stream_write(stream, soap_headers.c, soap_headers.len) != soap_headers.len) {
|
||||
if (php_stream_write(stream, soap_headers.s->val, soap_headers.s->len) != soap_headers.s->len) {
|
||||
php_stream_close(stream);
|
||||
stream = NULL;
|
||||
}
|
||||
@@ -275,9 +273,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
|
||||
/* if a stream is created without encryption, check to see if SSL method parameter is specified and use
|
||||
proper encrypyion method based on constants defined in soap.c */
|
||||
int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method"), (void **) &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
switch (Z_LVAL_PP(tmp)) {
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_LONG) {
|
||||
switch (Z_LVAL_P(tmp)) {
|
||||
case SOAP_SSL_METHOD_TLS:
|
||||
crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
|
||||
break;
|
||||
@@ -332,8 +330,7 @@ int make_http_soap_request(zval *this_ptr,
|
||||
char *location,
|
||||
char *soapaction,
|
||||
int soap_version,
|
||||
char **buffer,
|
||||
int *buffer_len TSRMLS_DC)
|
||||
zval *return_value TSRMLS_DC)
|
||||
{
|
||||
char *request;
|
||||
smart_str soap_headers = {0};
|
||||
@@ -341,7 +338,7 @@ int make_http_soap_request(zval *this_ptr,
|
||||
int request_size, err;
|
||||
php_url *phpurl = NULL;
|
||||
php_stream *stream;
|
||||
zval **trace, **tmp;
|
||||
zval *trace, *tmp;
|
||||
int use_proxy = 0;
|
||||
int use_ssl;
|
||||
char *http_headers, *http_body, *content_type, *http_version, *cookie_itt;
|
||||
@@ -366,41 +363,37 @@ int make_http_soap_request(zval *this_ptr,
|
||||
request = buf;
|
||||
request_size = buf_size;
|
||||
/* Compress request */
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression"), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
int level = Z_LVAL_PP(tmp) & 0x0f;
|
||||
int kind = Z_LVAL_PP(tmp) & SOAP_COMPRESSION_DEFLATE;
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "compression", sizeof("compression")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) {
|
||||
int level = Z_LVAL_P(tmp) & 0x0f;
|
||||
int kind = Z_LVAL_P(tmp) & SOAP_COMPRESSION_DEFLATE;
|
||||
|
||||
if (level > 9) {level = 9;}
|
||||
|
||||
if ((Z_LVAL_PP(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) {
|
||||
if ((Z_LVAL_P(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) {
|
||||
smart_str_append_const(&soap_headers_z,"Accept-Encoding: gzip, deflate\r\n");
|
||||
}
|
||||
if (level > 0) {
|
||||
zval func;
|
||||
zval retval;
|
||||
zval param1, param2, param3;
|
||||
zval *params[3];
|
||||
zval params[3];
|
||||
int n;
|
||||
|
||||
params[0] = ¶m1;
|
||||
INIT_PZVAL(params[0]);
|
||||
params[1] = ¶m2;
|
||||
INIT_PZVAL(params[1]);
|
||||
params[2] = ¶m3;
|
||||
INIT_PZVAL(params[2]);
|
||||
ZVAL_STRINGL(params[0], buf, buf_size, 0);
|
||||
ZVAL_LONG(params[1], level);
|
||||
//???ZVAL_STRINGL(params[0], buf, buf_size, 0);
|
||||
ZVAL_STRINGL(¶ms[0], buf, buf_size);
|
||||
ZVAL_LONG(¶ms[1], level);
|
||||
if (kind == SOAP_COMPRESSION_DEFLATE) {
|
||||
n = 2;
|
||||
ZVAL_STRING(&func, "gzcompress", 0);
|
||||
//???ZVAL_STRING(&func, "gzcompress", 0);
|
||||
ZVAL_STRING(&func, "gzcompress");
|
||||
smart_str_append_const(&soap_headers_z,"Content-Encoding: deflate\r\n");
|
||||
} else {
|
||||
n = 3;
|
||||
ZVAL_STRING(&func, "gzencode", 0);
|
||||
//???ZVAL_STRING(&func, "gzencode", 0);
|
||||
ZVAL_STRING(&func, "gzencode");
|
||||
smart_str_append_const(&soap_headers_z,"Content-Encoding: gzip\r\n");
|
||||
ZVAL_LONG(params[2], 0x1f);
|
||||
ZVAL_LONG(¶ms[2], 0x1f);
|
||||
}
|
||||
if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS &&
|
||||
if (call_user_function(CG(function_table), (zval*)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS &&
|
||||
Z_TYPE(retval) == IS_STRING) {
|
||||
request = Z_STRVAL(retval);
|
||||
request_size = Z_STRLEN(retval);
|
||||
@@ -412,10 +405,10 @@ int make_http_soap_request(zval *this_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"), (void **)&tmp) == SUCCESS) {
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1)) != NULL) {
|
||||
php_stream_from_zval_no_verify(stream,tmp);
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"), (void **)&tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
use_proxy = Z_LVAL_PP(tmp);
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) {
|
||||
use_proxy = Z_LVAL_P(tmp);
|
||||
}
|
||||
} else {
|
||||
stream = NULL;
|
||||
@@ -425,16 +418,16 @@ int make_http_soap_request(zval *this_ptr,
|
||||
phpurl = php_url_parse(location);
|
||||
}
|
||||
|
||||
if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
|
||||
"_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
|
||||
context = php_stream_context_from_zval(*tmp, 0);
|
||||
if (NULL != (tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr),
|
||||
"_stream_context", sizeof("_stream_context")-1))) {
|
||||
context = php_stream_context_from_zval(tmp, 0);
|
||||
}
|
||||
|
||||
if (context &&
|
||||
php_stream_context_get_option(context, "http", "max_redirects", &tmp) == SUCCESS) {
|
||||
if (Z_TYPE_PP(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &redirect_max, NULL, 1)) {
|
||||
if (Z_TYPE_PP(tmp) == IS_LONG)
|
||||
redirect_max = Z_LVAL_PP(tmp);
|
||||
(tmp = php_stream_context_get_option(context, "http", "max_redirects")) != NULL) {
|
||||
if (Z_TYPE_P(tmp) != IS_STRING || !is_numeric_string(Z_STRVAL_P(tmp), Z_STRLEN_P(tmp), &redirect_max, NULL, 1)) {
|
||||
if (Z_TYPE_P(tmp) == IS_LONG)
|
||||
redirect_max = Z_LVAL_P(tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -476,7 +469,7 @@ try_again:
|
||||
/* Check if request to the same host */
|
||||
if (stream != NULL) {
|
||||
php_url *orig;
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl"), (void **)&tmp) == SUCCESS &&
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1)) != NULL &&
|
||||
(orig = (php_url *) zend_fetch_resource(tmp TSRMLS_CC, -1, "httpurl", NULL, 1, le_url)) != NULL &&
|
||||
((use_proxy && !use_ssl) ||
|
||||
(((use_ssl && orig->scheme != NULL && strcmp(orig->scheme, "https") == 0) ||
|
||||
@@ -486,9 +479,9 @@ try_again:
|
||||
orig->port == phpurl->port))) {
|
||||
} else {
|
||||
php_stream_close(stream);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
stream = NULL;
|
||||
use_proxy = 0;
|
||||
}
|
||||
@@ -497,9 +490,9 @@ try_again:
|
||||
/* Check if keep-alive connection is still opened */
|
||||
if (stream != NULL && php_stream_eof(stream)) {
|
||||
php_stream_close(stream);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
stream = NULL;
|
||||
use_proxy = 0;
|
||||
}
|
||||
@@ -508,7 +501,7 @@ try_again:
|
||||
stream = http_connect(this_ptr, phpurl, use_ssl, context, &use_proxy TSRMLS_CC);
|
||||
if (stream) {
|
||||
php_stream_auto_cleanup(stream);
|
||||
add_property_resource(this_ptr, "httpsocket", php_stream_get_resource_id(stream));
|
||||
add_property_resource(this_ptr, "httpsocket", stream->res);
|
||||
add_property_long(this_ptr, "_use_proxy", use_proxy);
|
||||
} else {
|
||||
php_url_free(phpurl);
|
||||
@@ -522,16 +515,16 @@ try_again:
|
||||
PG(allow_url_fopen) = old_allow_url_fopen;
|
||||
|
||||
if (stream) {
|
||||
zval **cookies, **login, **password;
|
||||
int ret = zend_list_insert(phpurl, le_url TSRMLS_CC);
|
||||
zval *cookies, *login, *password;
|
||||
zend_resource *ret = zend_register_resource(NULL, phpurl, le_url TSRMLS_CC);
|
||||
|
||||
add_property_resource(this_ptr, "httpurl", ret);
|
||||
/*zend_list_addref(ret);*/
|
||||
|
||||
if (context &&
|
||||
php_stream_context_get_option(context, "http", "protocol_version", &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_DOUBLE &&
|
||||
Z_DVAL_PP(tmp) == 1.0) {
|
||||
(tmp = php_stream_context_get_option(context, "http", "protocol_version")) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_DOUBLE &&
|
||||
Z_DVAL_P(tmp) == 1.0) {
|
||||
http_1_1 = 0;
|
||||
} else {
|
||||
http_1_1 = 1;
|
||||
@@ -570,27 +563,27 @@ try_again:
|
||||
smart_str_append_unsigned(&soap_headers, phpurl->port);
|
||||
}
|
||||
if (!http_1_1 ||
|
||||
(zend_hash_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive"), (void **)&tmp) == SUCCESS &&
|
||||
Z_LVAL_PP(tmp) == 0)) {
|
||||
((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL &&
|
||||
Z_LVAL_P(tmp) == 0)) {
|
||||
smart_str_append_const(&soap_headers, "\r\n"
|
||||
"Connection: close\r\n");
|
||||
} else {
|
||||
smart_str_append_const(&soap_headers, "\r\n"
|
||||
"Connection: Keep-Alive\r\n");
|
||||
}
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if (Z_STRLEN_PP(tmp) > 0) {
|
||||
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
if (Z_STRLEN_P(tmp) > 0) {
|
||||
smart_str_append_const(&soap_headers, "User-Agent: ");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
}
|
||||
} else if (context &&
|
||||
php_stream_context_get_option(context, "http", "user_agent", &tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if (Z_STRLEN_PP(tmp) > 0) {
|
||||
(tmp = php_stream_context_get_option(context, "http", "user_agent")) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
if (Z_STRLEN_P(tmp) > 0) {
|
||||
smart_str_append_const(&soap_headers, "User-Agent: ");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
}
|
||||
} else if (FG(user_agent)) {
|
||||
@@ -624,13 +617,13 @@ try_again:
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
|
||||
/* HTTP Authentication */
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS &&
|
||||
Z_TYPE_PP(login) == IS_STRING) {
|
||||
zval **digest;
|
||||
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
|
||||
Z_TYPE_P(login) == IS_STRING) {
|
||||
zval *digest;
|
||||
|
||||
has_authorization = 1;
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"), (void **)&digest) == SUCCESS) {
|
||||
if (Z_TYPE_PP(digest) == IS_ARRAY) {
|
||||
if ((digest = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) != NULL) {
|
||||
if (Z_TYPE_P(digest) == IS_ARRAY) {
|
||||
char HA1[33], HA2[33], response[33], cnonce[33], nc[9];
|
||||
PHP_MD5_CTX md5ctx;
|
||||
unsigned char hash[16];
|
||||
@@ -641,39 +634,39 @@ try_again:
|
||||
PHP_MD5Final(hash, &md5ctx);
|
||||
make_digest(cnonce, hash);
|
||||
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "nc", sizeof("nc"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_LONG) {
|
||||
Z_LVAL_PP(tmp)++;
|
||||
snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_PP(tmp));
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_LONG) {
|
||||
Z_LVAL_P(tmp)++;
|
||||
snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_P(tmp));
|
||||
} else {
|
||||
add_assoc_long(*digest, "nc", 1);
|
||||
add_assoc_long(digest, "nc", 1);
|
||||
strcpy(nc, "00000001");
|
||||
}
|
||||
|
||||
PHP_MD5Init(&md5ctx);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(login), Z_STRLEN_PP(login));
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(login), Z_STRLEN_P(login));
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "realm", sizeof("realm"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS &&
|
||||
Z_TYPE_PP(password) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(password), Z_STRLEN_PP(password));
|
||||
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
|
||||
Z_TYPE_P(password) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRLEN_P(password));
|
||||
}
|
||||
PHP_MD5Final(hash, &md5ctx);
|
||||
make_digest(HA1, hash);
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "algorithm", sizeof("algorithm"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING &&
|
||||
Z_STRLEN_PP(tmp) == sizeof("md5-sess")-1 &&
|
||||
stricmp(Z_STRVAL_PP(tmp), "md5-sess") == 0) {
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING &&
|
||||
Z_STRLEN_P(tmp) == sizeof("md5-sess")-1 &&
|
||||
stricmp(Z_STRVAL_P(tmp), "md5-sess") == 0) {
|
||||
PHP_MD5Init(&md5ctx);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "nonce", sizeof("nonce"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8);
|
||||
@@ -709,13 +702,13 @@ try_again:
|
||||
PHP_MD5Init(&md5ctx);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)HA1, 32);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "nonce", sizeof("nonce"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)nc, 8);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
|
||||
PHP_MD5Update(&md5ctx, (unsigned char*)cnonce, 8);
|
||||
@@ -729,16 +722,16 @@ try_again:
|
||||
make_digest(response, hash);
|
||||
|
||||
smart_str_append_const(&soap_headers, "Authorization: Digest username=\"");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "realm", sizeof("realm"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(login), Z_STRLEN_P(login));
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "realm", sizeof("realm")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
smart_str_append_const(&soap_headers, "\", realm=\"");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "nonce", sizeof("nonce"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nonce", sizeof("nonce")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
smart_str_append_const(&soap_headers, "\", nonce=\"");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
smart_str_append_const(&soap_headers, "\", uri=\"");
|
||||
if (phpurl->path) {
|
||||
@@ -754,8 +747,8 @@ try_again:
|
||||
smart_str_appendc(&soap_headers, '#');
|
||||
smart_str_appends(&soap_headers, phpurl->fragment);
|
||||
}
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "qop", sizeof("qop"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "qop", sizeof("qop")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
/* TODO: Support for qop="auth-int" */
|
||||
smart_str_append_const(&soap_headers, "\", qop=\"auth");
|
||||
smart_str_append_const(&soap_headers, "\", nc=\"");
|
||||
@@ -765,35 +758,34 @@ try_again:
|
||||
}
|
||||
smart_str_append_const(&soap_headers, "\", response=\"");
|
||||
smart_str_appendl(&soap_headers, response, 32);
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "opaque", sizeof("opaque"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "opaque", sizeof("opaque")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
smart_str_append_const(&soap_headers, "\", opaque=\"");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
if (zend_hash_find(Z_ARRVAL_PP(digest), "algorithm", sizeof("algorithm"), (void **)&tmp) == SUCCESS &&
|
||||
Z_TYPE_PP(tmp) == IS_STRING) {
|
||||
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "algorithm", sizeof("algorithm")-1)) != NULL &&
|
||||
Z_TYPE_P(tmp) == IS_STRING) {
|
||||
smart_str_append_const(&soap_headers, "\", algorithm=\"");
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
|
||||
}
|
||||
smart_str_append_const(&soap_headers, "\"\r\n");
|
||||
}
|
||||
} else {
|
||||
unsigned char* buf;
|
||||
int len;
|
||||
zend_string *buf;
|
||||
|
||||
smart_str auth = {0};
|
||||
smart_str_appendl(&auth, Z_STRVAL_PP(login), Z_STRLEN_PP(login));
|
||||
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
|
||||
smart_str_appendc(&auth, ':');
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS &&
|
||||
Z_TYPE_PP(password) == IS_STRING) {
|
||||
smart_str_appendl(&auth, Z_STRVAL_PP(password), Z_STRLEN_PP(password));
|
||||
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
|
||||
Z_TYPE_P(password) == IS_STRING) {
|
||||
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
|
||||
}
|
||||
smart_str_0(&auth);
|
||||
buf = php_base64_encode((unsigned char*)auth.c, auth.len, &len);
|
||||
buf = php_base64_encode((unsigned char*)auth.s->val, auth.s->len);
|
||||
smart_str_append_const(&soap_headers, "Authorization: Basic ");
|
||||
smart_str_appendl(&soap_headers, (char*)buf, len);
|
||||
smart_str_appendl(&soap_headers, (char*)buf->val, buf->len);
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
efree(buf);
|
||||
STR_RELEASE(buf);
|
||||
smart_str_free(&auth);
|
||||
}
|
||||
}
|
||||
@@ -804,40 +796,39 @@ try_again:
|
||||
}
|
||||
|
||||
/* Send cookies along with request */
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS) {
|
||||
zval **data;
|
||||
char *key;
|
||||
uint key_len;
|
||||
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL) {
|
||||
zval *data;
|
||||
zend_string *key;
|
||||
int i, n;
|
||||
|
||||
has_cookies = 1;
|
||||
n = zend_hash_num_elements(Z_ARRVAL_PP(cookies));
|
||||
n = zend_hash_num_elements(Z_ARRVAL_P(cookies));
|
||||
if (n > 0) {
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_PP(cookies));
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(cookies));
|
||||
smart_str_append_const(&soap_headers, "Cookie: ");
|
||||
for (i = 0; i < n; i++) {
|
||||
zend_hash_get_current_data(Z_ARRVAL_PP(cookies), (void **)&data);
|
||||
zend_hash_get_current_key_ex(Z_ARRVAL_PP(cookies), &key, &key_len, NULL, 0, NULL);
|
||||
data = zend_hash_get_current_data(Z_ARRVAL_P(cookies));
|
||||
zend_hash_get_current_key_ex(Z_ARRVAL_P(cookies), &key, NULL, 0, NULL);
|
||||
|
||||
if (Z_TYPE_PP(data) == IS_ARRAY) {
|
||||
zval** value;
|
||||
if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
zval *value;
|
||||
|
||||
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) == 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, key_len);
|
||||
if ((value = zend_hash_index_find(Z_ARRVAL_P(data), 0)) != NULL &&
|
||||
Z_TYPE_P(value) == IS_STRING) {
|
||||
zval *tmp;
|
||||
if (((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 1)) == NULL ||
|
||||
strncmp(phpurl->path?phpurl->path:"/",Z_STRVAL_P(tmp),Z_STRLEN_P(tmp)) == 0) &&
|
||||
((tmp = zend_hash_index_find(Z_ARRVAL_P(data), 2)) == NULL ||
|
||||
in_domain(phpurl->host,Z_STRVAL_P(tmp))) &&
|
||||
(use_ssl || (tmp = zend_hash_index_find(Z_ARRVAL_P(data), 3)) == NULL)) {
|
||||
smart_str_appendl(&soap_headers, key->val, key->len);
|
||||
smart_str_appendc(&soap_headers, '=');
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_PP(value), Z_STRLEN_PP(value));
|
||||
smart_str_appendl(&soap_headers, Z_STRVAL_P(value), Z_STRLEN_P(value));
|
||||
smart_str_appendc(&soap_headers, ';');
|
||||
}
|
||||
}
|
||||
}
|
||||
zend_hash_move_forward(Z_ARRVAL_PP(cookies));
|
||||
zend_hash_move_forward(Z_ARRVAL_P(cookies));
|
||||
}
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
}
|
||||
@@ -847,20 +838,20 @@ try_again:
|
||||
|
||||
smart_str_append_const(&soap_headers, "\r\n");
|
||||
smart_str_0(&soap_headers);
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
||||
Z_LVAL_PP(trace) > 0) {
|
||||
add_property_stringl(this_ptr, "__last_request_headers", soap_headers.c, soap_headers.len);
|
||||
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
|
||||
Z_LVAL_P(trace) > 0) {
|
||||
add_property_stringl(this_ptr, "__last_request_headers", soap_headers.s->val, soap_headers.s->len);
|
||||
}
|
||||
smart_str_appendl(&soap_headers, request, request_size);
|
||||
smart_str_0(&soap_headers);
|
||||
|
||||
err = php_stream_write(stream, soap_headers.c, soap_headers.len);
|
||||
if (err != soap_headers.len) {
|
||||
err = php_stream_write(stream, soap_headers.s->val, soap_headers.s->len);
|
||||
if (err != soap_headers.s->len) {
|
||||
if (request != buf) {efree(request);}
|
||||
php_stream_close(stream);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL TSRMLS_CC);
|
||||
smart_str_free(&soap_headers_z);
|
||||
return FALSE;
|
||||
@@ -872,10 +863,10 @@ try_again:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!buffer) {
|
||||
if (!return_value) {
|
||||
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"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
smart_str_free(&soap_headers_z);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -885,15 +876,15 @@ try_again:
|
||||
if (http_headers) {efree(http_headers);}
|
||||
if (request != buf) {efree(request);}
|
||||
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"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL TSRMLS_CC);
|
||||
smart_str_free(&soap_headers_z);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
|
||||
Z_LVAL_PP(trace) > 0) {
|
||||
if ((trace = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace")-1)) != NULL &&
|
||||
Z_LVAL_P(trace) > 0) {
|
||||
add_property_stringl(this_ptr, "__last_response_headers", http_headers, http_header_size);
|
||||
}
|
||||
|
||||
@@ -940,13 +931,12 @@ try_again:
|
||||
while (cookie_itt) {
|
||||
char *end_pos, *cookie;
|
||||
char *eqpos, *sempos;
|
||||
zval **cookies;
|
||||
zval *cookies;
|
||||
|
||||
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);
|
||||
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL) {
|
||||
zval tmp_cookies;
|
||||
array_init(&tmp_cookies);
|
||||
cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies);
|
||||
}
|
||||
|
||||
end_pos = strstr(cookie_itt,"\r\n");
|
||||
@@ -957,7 +947,7 @@ try_again:
|
||||
if (eqpos != NULL && (sempos == NULL || sempos > eqpos)) {
|
||||
smart_str name = {0};
|
||||
int cookie_len;
|
||||
zval *zcookie;
|
||||
zval zcookie;
|
||||
|
||||
if (sempos != NULL) {
|
||||
cookie_len = sempos-(eqpos+1);
|
||||
@@ -968,9 +958,8 @@ try_again:
|
||||
smart_str_appendl(&name, cookie, eqpos - cookie);
|
||||
smart_str_0(&name);
|
||||
|
||||
ALLOC_INIT_ZVAL(zcookie);
|
||||
array_init(zcookie);
|
||||
add_index_stringl(zcookie, 0, eqpos + 1, cookie_len);
|
||||
array_init(&zcookie);
|
||||
add_index_stringl(&zcookie, 0, eqpos + 1, cookie_len);
|
||||
|
||||
if (sempos != NULL) {
|
||||
char *options = cookie + cookie_len+1;
|
||||
@@ -979,12 +968,12 @@ try_again:
|
||||
sempos = strstr(options, ";");
|
||||
if (strstr(options,"path=") == options) {
|
||||
eqpos = options + sizeof("path=")-1;
|
||||
add_index_stringl(zcookie, 1, eqpos, sempos?(sempos-eqpos):strlen(eqpos));
|
||||
add_index_stringl(&zcookie, 1, eqpos, sempos?(sempos-eqpos):strlen(eqpos));
|
||||
} else if (strstr(options,"domain=") == options) {
|
||||
eqpos = options + sizeof("domain=")-1;
|
||||
add_index_stringl(zcookie, 2, eqpos, sempos?(sempos-eqpos):strlen(eqpos));
|
||||
add_index_stringl(&zcookie, 2, eqpos, sempos?(sempos-eqpos):strlen(eqpos));
|
||||
} else if (strstr(options,"secure") == options) {
|
||||
add_index_bool(zcookie, 3, 1);
|
||||
add_index_bool(&zcookie, 3, 1);
|
||||
}
|
||||
if (sempos != NULL) {
|
||||
options = sempos+1;
|
||||
@@ -993,18 +982,19 @@ try_again:
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!zend_hash_index_exists(Z_ARRVAL_P(zcookie), 1)) {
|
||||
if (!zend_hash_index_exists(Z_ARRVAL(zcookie), 1)) {
|
||||
char *t = phpurl->path?phpurl->path:"/";
|
||||
char *c = strrchr(t, '/');
|
||||
if (c) {
|
||||
add_index_stringl(zcookie, 1, t, c-t);
|
||||
add_index_stringl(&zcookie, 1, t, c-t);
|
||||
}
|
||||
}
|
||||
if (!zend_hash_index_exists(Z_ARRVAL_P(zcookie), 2)) {
|
||||
add_index_string(zcookie, 2, phpurl->host);
|
||||
if (!zend_hash_index_exists(Z_ARRVAL(zcookie), 2)) {
|
||||
add_index_string(&zcookie, 2, phpurl->host);
|
||||
}
|
||||
|
||||
add_assoc_zval_ex(*cookies, name.c, name.len+1, zcookie);
|
||||
// TODO: avoid reallocation ???
|
||||
add_assoc_zval_ex(cookies, name.s->val, name.s->len, &zcookie);
|
||||
smart_str_free(&name);
|
||||
}
|
||||
|
||||
@@ -1059,8 +1049,8 @@ try_again:
|
||||
if (request != buf) {efree(request);}
|
||||
php_stream_close(stream);
|
||||
efree(http_headers);
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length, connection closed or chunked data", NULL, NULL TSRMLS_CC);
|
||||
if (http_msg) {
|
||||
efree(http_msg);
|
||||
@@ -1073,8 +1063,8 @@ try_again:
|
||||
|
||||
if (http_close) {
|
||||
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"));
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket")-1);
|
||||
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
|
||||
stream = NULL;
|
||||
}
|
||||
|
||||
@@ -1127,20 +1117,21 @@ try_again:
|
||||
}
|
||||
} else if (http_status == 401) {
|
||||
/* Digest authentication */
|
||||
zval **digest, **login, **password;
|
||||
zval *digest, *login, *password;
|
||||
char *auth = get_http_header_value(http_headers, "WWW-Authenticate: ");
|
||||
|
||||
if (auth &&
|
||||
strstr(auth, "Digest") == auth &&
|
||||
(zend_hash_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest"), (void **)&digest) == FAILURE ||
|
||||
Z_TYPE_PP(digest) != IS_ARRAY) &&
|
||||
zend_hash_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login"), (void **)&login) == SUCCESS &&
|
||||
Z_TYPE_PP(login) == IS_STRING &&
|
||||
zend_hash_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password"), (void **)&password) == SUCCESS &&
|
||||
Z_TYPE_PP(password) == IS_STRING) {
|
||||
((digest = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) == NULL ||
|
||||
Z_TYPE_P(digest) != IS_ARRAY) &&
|
||||
(login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
|
||||
Z_TYPE_P(login) == IS_STRING &&
|
||||
(password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
|
||||
Z_TYPE_P(password) == IS_STRING) {
|
||||
char *s;
|
||||
zval *digest = NULL;
|
||||
zval digest;
|
||||
|
||||
ZVAL_UNDEF(&digest);
|
||||
s = auth + sizeof("Digest")-1;
|
||||
while (*s != '\0') {
|
||||
char *name, *val;
|
||||
@@ -1169,19 +1160,18 @@ try_again:
|
||||
++s;
|
||||
}
|
||||
}
|
||||
if (digest == NULL) {
|
||||
ALLOC_INIT_ZVAL(digest);
|
||||
array_init(digest);
|
||||
if (Z_TYPE(digest) == IS_UNDEF) {
|
||||
array_init(&digest);
|
||||
}
|
||||
add_assoc_string(digest, name, val);
|
||||
add_assoc_string(&digest, name, val);
|
||||
}
|
||||
}
|
||||
|
||||
if (digest != NULL) {
|
||||
if (Z_TYPE(digest) != IS_UNDEF) {
|
||||
php_url *new_url = emalloc(sizeof(php_url));
|
||||
|
||||
Z_DELREF_P(digest);
|
||||
add_property_zval_ex(this_ptr, "_digest", sizeof("_digest"), digest TSRMLS_CC);
|
||||
Z_DELREF(digest);
|
||||
add_property_zval_ex(this_ptr, "_digest", sizeof("_digest")-1, &digest TSRMLS_CC);
|
||||
|
||||
*new_url = *phpurl;
|
||||
if (phpurl->scheme) phpurl->scheme = estrdup(phpurl->scheme);
|
||||
@@ -1239,22 +1229,21 @@ try_again:
|
||||
if (content_encoding) {
|
||||
zval func;
|
||||
zval retval;
|
||||
zval param;
|
||||
zval *params[1];
|
||||
zval params[1];
|
||||
|
||||
if ((strcmp(content_encoding,"gzip") == 0 ||
|
||||
strcmp(content_encoding,"x-gzip") == 0) &&
|
||||
zend_hash_exists(EG(function_table), "gzinflate", sizeof("gzinflate"))) {
|
||||
ZVAL_STRING(&func, "gzinflate", 0);
|
||||
params[0] = ¶m;
|
||||
ZVAL_STRINGL(params[0], http_body+10, http_body_size-10, 0);
|
||||
INIT_PZVAL(params[0]);
|
||||
zend_hash_str_exists(EG(function_table), "gzinflate", sizeof("gzinflate")-1)) {
|
||||
//???ZVAL_STRING(&func, "gzinflate", 0);
|
||||
//???ZVAL_STRINGL(params[0], http_body+10, http_body_size-10, 0);
|
||||
ZVAL_STRING(&func, "gzinflate");
|
||||
ZVAL_STRINGL(¶ms[0], http_body+10, http_body_size-10);
|
||||
} else if (strcmp(content_encoding,"deflate") == 0 &&
|
||||
zend_hash_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress"))) {
|
||||
ZVAL_STRING(&func, "gzuncompress", 0);
|
||||
params[0] = ¶m;
|
||||
ZVAL_STRINGL(params[0], http_body, http_body_size, 0);
|
||||
INIT_PZVAL(params[0]);
|
||||
zend_hash_str_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress")-1)) {
|
||||
//???ZVAL_STRING(&func, "gzuncompress", 0);
|
||||
//???ZVAL_STRINGL(params[0], http_body, http_body_size, 0);
|
||||
ZVAL_STRING(&func, "gzuncompress");
|
||||
ZVAL_STRINGL(¶ms[0], http_body, http_body_size);
|
||||
} else {
|
||||
efree(content_encoding);
|
||||
efree(http_headers);
|
||||
@@ -1265,11 +1254,10 @@ try_again:
|
||||
add_soap_fault(this_ptr, "HTTP", "Unknown Content-Encoding", NULL, NULL TSRMLS_CC);
|
||||
return FALSE;
|
||||
}
|
||||
if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, 1, params TSRMLS_CC) == SUCCESS &&
|
||||
if (call_user_function(CG(function_table), (zval*)NULL, &func, &retval, 1, params TSRMLS_CC) == SUCCESS &&
|
||||
Z_TYPE(retval) == IS_STRING) {
|
||||
efree(http_body);
|
||||
*buffer = Z_STRVAL(retval);
|
||||
*buffer_len = Z_STRLEN(retval);
|
||||
ZVAL_COPY_VALUE(return_value, &retval);
|
||||
} else {
|
||||
efree(content_encoding);
|
||||
efree(http_headers);
|
||||
@@ -1282,8 +1270,11 @@ try_again:
|
||||
}
|
||||
efree(content_encoding);
|
||||
} else {
|
||||
*buffer = http_body;
|
||||
*buffer_len = http_body_size;
|
||||
// TODO: avoid reallocation ???
|
||||
//???*buffer = http_body;
|
||||
//???*buffer_len = http_body_size;
|
||||
ZVAL_STRINGL(return_value, http_body, http_body_size);
|
||||
efree(http_body);
|
||||
}
|
||||
|
||||
efree(http_headers);
|
||||
@@ -1291,11 +1282,11 @@ try_again:
|
||||
if (http_status >= 400) {
|
||||
int error = 0;
|
||||
|
||||
if (*buffer_len == 0) {
|
||||
if (Z_STRLEN_P(return_value) == 0) {
|
||||
error = 1;
|
||||
} else if (*buffer_len > 0) {
|
||||
} else if (Z_STRLEN_P(return_value) > 0) {
|
||||
if (!content_type_xml) {
|
||||
char *s = *buffer;
|
||||
char *s = Z_STRVAL_P(return_value);
|
||||
|
||||
while (*s != '\0' && *s < ' ') {
|
||||
s++;
|
||||
@@ -1307,7 +1298,8 @@ try_again:
|
||||
}
|
||||
|
||||
if (error) {
|
||||
efree(*buffer);
|
||||
zval_ptr_dtor(return_value);
|
||||
ZVAL_UNDEF(return_value);
|
||||
add_soap_fault(this_ptr, "HTTP", http_msg, NULL, NULL TSRMLS_CC);
|
||||
efree(http_msg);
|
||||
return FALSE;
|
||||
@@ -1515,8 +1507,8 @@ static int get_http_headers(php_stream *stream, char **response, int *out_size T
|
||||
smart_str_appends(&tmp_response, headerbuf);
|
||||
}
|
||||
smart_str_0(&tmp_response);
|
||||
(*response) = tmp_response.c;
|
||||
(*out_size) = tmp_response.len;
|
||||
(*response) = tmp_response.s->val;
|
||||
(*out_size) = tmp_response.s->len;
|
||||
return done;
|
||||
}
|
||||
/*
|
||||
|
||||
@@ -28,8 +28,7 @@ int make_http_soap_request(zval *this_ptr,
|
||||
char *location,
|
||||
char *soapaction,
|
||||
int soap_version,
|
||||
char **response,
|
||||
int *response_len TSRMLS_DC);
|
||||
zval *response TSRMLS_DC);
|
||||
|
||||
int proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC);
|
||||
int basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC);
|
||||
|
||||
@@ -179,10 +179,12 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
/* Check if <Body> contains <Fault> element */
|
||||
fault = get_node_ex(body->children,"Fault",envelope_ns);
|
||||
if (fault != NULL) {
|
||||
char *faultcode = NULL, *faultstring = NULL, *faultactor = NULL;
|
||||
zval *details = NULL;
|
||||
char *faultcode = NULL;
|
||||
zend_string *faultstring = NULL, *faultactor = NULL;
|
||||
zval details;
|
||||
xmlNodePtr tmp;
|
||||
|
||||
ZVAL_UNDEF(&details);
|
||||
if (soap_version == SOAP_1_1) {
|
||||
tmp = get_node(fault->children, "faultcode");
|
||||
if (tmp != NULL && tmp->children != NULL) {
|
||||
@@ -191,21 +193,21 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
|
||||
tmp = get_node(fault->children, "faultstring");
|
||||
if (tmp != NULL && tmp->children != NULL) {
|
||||
zval *zv = master_to_zval(get_conversion(IS_STRING), tmp TSRMLS_CC);
|
||||
faultstring = Z_STRVAL_P(zv);
|
||||
FREE_ZVAL(zv);
|
||||
zval zv;
|
||||
master_to_zval(&zv, get_conversion(IS_STRING), tmp TSRMLS_CC);
|
||||
faultstring = Z_STR(zv);
|
||||
}
|
||||
|
||||
tmp = get_node(fault->children, "faultactor");
|
||||
if (tmp != NULL && tmp->children != NULL) {
|
||||
zval *zv = master_to_zval(get_conversion(IS_STRING), tmp TSRMLS_CC);
|
||||
faultactor = Z_STRVAL_P(zv);
|
||||
FREE_ZVAL(zv);
|
||||
zval zv;
|
||||
master_to_zval(&zv, get_conversion(IS_STRING), tmp TSRMLS_CC);
|
||||
faultactor = Z_STR(zv);
|
||||
}
|
||||
|
||||
tmp = get_node(fault->children, "detail");
|
||||
if (tmp != NULL) {
|
||||
details = master_to_zval(NULL, tmp TSRMLS_CC);
|
||||
master_to_zval(&details, NULL, tmp TSRMLS_CC);
|
||||
}
|
||||
} else {
|
||||
tmp = get_node(fault->children, "Code");
|
||||
@@ -221,26 +223,26 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
/* TODO: lang attribute */
|
||||
tmp = get_node(tmp->children,"Text");
|
||||
if (tmp != NULL && tmp->children != NULL) {
|
||||
zval *zv = master_to_zval(get_conversion(IS_STRING), tmp TSRMLS_CC);
|
||||
faultstring = Z_STRVAL_P(zv);
|
||||
FREE_ZVAL(zv);
|
||||
zval zv;
|
||||
master_to_zval(&zv, get_conversion(IS_STRING), tmp TSRMLS_CC);
|
||||
faultstring = Z_STR(zv);
|
||||
}
|
||||
}
|
||||
|
||||
tmp = get_node(fault->children,"Detail");
|
||||
if (tmp != NULL) {
|
||||
details = master_to_zval(NULL, tmp TSRMLS_CC);
|
||||
master_to_zval(&details, NULL, tmp TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC);
|
||||
add_soap_fault(this_ptr, faultcode, faultstring->val, faultactor->val, &details TSRMLS_CC);
|
||||
if (faultstring) {
|
||||
efree(faultstring);
|
||||
STR_RELEASE(faultstring);
|
||||
}
|
||||
if (faultactor) {
|
||||
efree(faultactor);
|
||||
STR_RELEASE(faultactor);
|
||||
}
|
||||
if (details) {
|
||||
Z_DELREF_P(details);
|
||||
if (Z_REFCOUNTED(details)) {
|
||||
Z_DELREF(details);
|
||||
}
|
||||
xmlFreeDoc(response);
|
||||
return FALSE;
|
||||
@@ -255,20 +257,18 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
if (resp != NULL) {
|
||||
if (fn != NULL && fn->binding && fn->binding->bindingType == BINDING_SOAP) {
|
||||
/* Function has WSDL description */
|
||||
sdlParamPtr *h_param, param = NULL;
|
||||
sdlParamPtr param = NULL;
|
||||
xmlNodePtr val = NULL;
|
||||
char *name, *ns = NULL;
|
||||
zval* tmp;
|
||||
zval tmp;
|
||||
sdlSoapBindingFunctionPtr fnb = (sdlSoapBindingFunctionPtr)fn->bindingAttributes;
|
||||
int res_count;
|
||||
|
||||
hdrs = fnb->output.headers;
|
||||
|
||||
if (fn->responseParameters) {
|
||||
res_count = zend_hash_num_elements(fn->responseParameters);
|
||||
zend_hash_internal_pointer_reset(fn->responseParameters);
|
||||
while (zend_hash_get_current_data(fn->responseParameters, (void **)&h_param) == SUCCESS) {
|
||||
param = (*h_param);
|
||||
res_count = zend_hash_num_elements(fn->responseParameters);
|
||||
ZEND_HASH_FOREACH_PTR(fn->responseParameters, param) {
|
||||
if (fnb->style == SOAP_DOCUMENT) {
|
||||
if (param->element) {
|
||||
name = param->element->name;
|
||||
@@ -315,8 +315,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
|
||||
if (!val) {
|
||||
/* TODO: may be "nil" is not OK? */
|
||||
MAKE_STD_ZVAL(tmp);
|
||||
ZVAL_NULL(tmp);
|
||||
ZVAL_NULL(&tmp);
|
||||
/*
|
||||
add_soap_fault(this_ptr, "Client", "Can't find response data", NULL, NULL TSRMLS_CC);
|
||||
xmlFreeDoc(response);
|
||||
@@ -325,17 +324,15 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
} else {
|
||||
/* Decoding value of parameter */
|
||||
if (param != NULL) {
|
||||
tmp = master_to_zval(param->encode, val TSRMLS_CC);
|
||||
master_to_zval(&tmp, param->encode, val TSRMLS_CC);
|
||||
} else {
|
||||
tmp = master_to_zval(NULL, val TSRMLS_CC);
|
||||
master_to_zval(&tmp, NULL, val TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
add_assoc_zval(return_value, param->paramName, tmp);
|
||||
add_assoc_zval(return_value, param->paramName, &tmp);
|
||||
|
||||
param_count++;
|
||||
|
||||
zend_hash_move_forward(fn->responseParameters);
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
} else {
|
||||
/* Function has no WSDL description */
|
||||
@@ -347,25 +344,24 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
}
|
||||
if (val != NULL) {
|
||||
if (!node_is_equal_ex(val,"result",RPC_SOAP12_NAMESPACE)) {
|
||||
zval *tmp;
|
||||
zval **arr;
|
||||
zval tmp;
|
||||
zval *arr;
|
||||
|
||||
tmp = master_to_zval(NULL, val TSRMLS_CC);
|
||||
master_to_zval(&tmp, NULL, val TSRMLS_CC);
|
||||
if (val->name) {
|
||||
if (zend_hash_find(Z_ARRVAL_P(return_value), (char*)val->name, strlen((char*)val->name)+1, (void**)&arr) == SUCCESS) {
|
||||
add_next_index_zval(*arr, tmp);
|
||||
if ((arr = zend_hash_str_find(Z_ARRVAL_P(return_value), (char*)val->name, strlen((char*)val->name))) != NULL) {
|
||||
add_next_index_zval(arr, &tmp);
|
||||
} else if (val->next && get_node(val->next, (char*)val->name)) {
|
||||
zval *arr;
|
||||
zval arr;
|
||||
|
||||
MAKE_STD_ZVAL(arr);
|
||||
array_init(arr);
|
||||
add_next_index_zval(arr, tmp);
|
||||
add_assoc_zval(return_value, (char*)val->name, arr);
|
||||
array_init(&arr);
|
||||
add_next_index_zval(&arr, &tmp);
|
||||
add_assoc_zval(return_value, (char*)val->name, &arr);
|
||||
} else {
|
||||
add_assoc_zval(return_value, (char*)val->name, tmp);
|
||||
add_assoc_zval(return_value, (char*)val->name, &tmp);
|
||||
}
|
||||
} else {
|
||||
add_next_index_zval(return_value, tmp);
|
||||
add_next_index_zval(return_value, &tmp);
|
||||
}
|
||||
++param_count;
|
||||
}
|
||||
@@ -383,12 +379,10 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
zval *tmp;
|
||||
|
||||
zend_hash_internal_pointer_reset(Z_ARRVAL_P(return_value));
|
||||
zend_hash_get_current_data(Z_ARRVAL_P(return_value), (void**)&tmp);
|
||||
tmp = *(zval**)tmp;
|
||||
Z_ADDREF_P(tmp);
|
||||
tmp = zend_hash_get_current_data(Z_ARRVAL_P(return_value));
|
||||
if (Z_REFCOUNTED_P(tmp)) Z_ADDREF_P(tmp);
|
||||
zval_dtor(return_value);
|
||||
*return_value = *tmp;
|
||||
FREE_ZVAL(tmp);
|
||||
ZVAL_COPY_VALUE(return_value, tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -397,11 +391,11 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
while (trav != NULL) {
|
||||
if (trav->type == XML_ELEMENT_NODE) {
|
||||
encodePtr enc = NULL;
|
||||
zval* val;
|
||||
zval val;
|
||||
|
||||
if (hdrs) {
|
||||
smart_str key = {0};
|
||||
sdlSoapBindingFunctionHeaderPtr *hdr;
|
||||
sdlSoapBindingFunctionHeaderPtr hdr;
|
||||
|
||||
if (trav->ns) {
|
||||
smart_str_appends(&key, (char*)trav->ns->href);
|
||||
@@ -409,13 +403,13 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||
}
|
||||
smart_str_appends(&key, (char*)trav->name);
|
||||
smart_str_0(&key);
|
||||
if (zend_hash_find(hdrs, key.c, key.len+1, (void**)&hdr) == SUCCESS) {
|
||||
enc = (*hdr)->encode;
|
||||
if ((hdr = zend_hash_find_ptr(hdrs, key.s)) != NULL) {
|
||||
enc = hdr->encode;
|
||||
}
|
||||
smart_str_free(&key);
|
||||
}
|
||||
val = master_to_zval(enc, trav TSRMLS_CC);
|
||||
add_assoc_zval(soap_headers, (char*)trav->name, val);
|
||||
master_to_zval(&val, enc, trav TSRMLS_CC);
|
||||
add_assoc_zval(soap_headers, (char*)trav->name, &val);
|
||||
}
|
||||
trav = trav->next;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type);
|
||||
static encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const xmlChar *ns, const xmlChar *type)
|
||||
{
|
||||
smart_str nscat = {0};
|
||||
encodePtr enc, *enc_ptr;
|
||||
encodePtr enc, enc_ptr;
|
||||
|
||||
if (sdl->encoders == NULL) {
|
||||
sdl->encoders = emalloc(sizeof(HashTable));
|
||||
@@ -59,8 +59,8 @@ static encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const xmlChar *
|
||||
smart_str_appendc(&nscat, ':');
|
||||
smart_str_appends(&nscat, (char*)type);
|
||||
smart_str_0(&nscat);
|
||||
if (zend_hash_find(sdl->encoders, nscat.c, nscat.len + 1, (void**)&enc_ptr) == SUCCESS) {
|
||||
enc = *enc_ptr;
|
||||
if ((enc_ptr = zend_hash_find_ptr(sdl->encoders, nscat.s)) != NULL) {
|
||||
enc = enc_ptr;
|
||||
if (enc->details.ns) {
|
||||
efree(enc->details.ns);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ static encodePtr create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const xmlChar *
|
||||
enc->to_zval = sdl_guess_convert_zval;
|
||||
|
||||
if (enc_ptr == NULL) {
|
||||
zend_hash_update(sdl->encoders, nscat.c, nscat.len + 1, &enc, sizeof(encodePtr), NULL);
|
||||
zend_hash_update_ptr(sdl->encoders, nscat.s, enc);
|
||||
}
|
||||
smart_str_free(&nscat);
|
||||
return enc;
|
||||
@@ -97,7 +97,7 @@ static encodePtr get_create_encoder(sdlPtr sdl, sdlTypePtr cur_type, const xmlCh
|
||||
|
||||
static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlAttrPtr tns, int import TSRMLS_DC) {
|
||||
if (location != NULL &&
|
||||
!zend_hash_exists(&ctx->docs, (char*)location, xmlStrlen(location)+1)) {
|
||||
!zend_hash_str_exists(&ctx->docs, (char*)location, xmlStrlen(location))) {
|
||||
xmlDocPtr doc;
|
||||
xmlNodePtr schema;
|
||||
xmlAttrPtr new_tns;
|
||||
@@ -135,7 +135,7 @@ static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlA
|
||||
soap_error1(E_ERROR, "Parsing Schema: can't include schema from '%s', different 'targetNamespace'", location);
|
||||
}
|
||||
}
|
||||
zend_hash_add(&ctx->docs, (char*)location, xmlStrlen(location)+1, (void**)&doc, sizeof(xmlDocPtr), NULL);
|
||||
zend_hash_str_add_ptr(&ctx->docs, (char*)location, xmlStrlen(location), doc);
|
||||
load_schema(ctx, schema TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
@@ -315,7 +315,7 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType,
|
||||
name = get_attribute(simpleType->properties, "name");
|
||||
if (cur_type != NULL) {
|
||||
/* Anonymous type inside <element> or <restriction> */
|
||||
sdlTypePtr newType, *ptr;
|
||||
sdlTypePtr newType, ptr;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -328,7 +328,7 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType,
|
||||
newType->namens = estrdup(cur_type->namens);
|
||||
}
|
||||
|
||||
zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
|
||||
ptr = zend_hash_next_index_insert_ptr(sdl->types, newType);
|
||||
|
||||
if (sdl->encoders == NULL) {
|
||||
sdl->encoders = emalloc(sizeof(HashTable));
|
||||
@@ -338,15 +338,15 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType,
|
||||
memset(cur_type->encode, 0, sizeof(encode));
|
||||
cur_type->encode->details.ns = estrdup(newType->namens);
|
||||
cur_type->encode->details.type_str = estrdup(newType->name);
|
||||
cur_type->encode->details.sdl_type = *ptr;
|
||||
cur_type->encode->details.sdl_type = ptr;
|
||||
cur_type->encode->to_xml = sdl_guess_convert_xml;
|
||||
cur_type->encode->to_zval = sdl_guess_convert_zval;
|
||||
zend_hash_next_index_insert(sdl->encoders, &cur_type->encode, sizeof(encodePtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(sdl->encoders, cur_type->encode);
|
||||
|
||||
cur_type =*ptr;
|
||||
cur_type =ptr;
|
||||
|
||||
} else if (name != NULL) {
|
||||
sdlTypePtr newType, *ptr;
|
||||
sdlTypePtr newType, ptr;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -355,15 +355,15 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType,
|
||||
newType->namens = estrdup((char*)ns->children->content);
|
||||
|
||||
if (cur_type == NULL) {
|
||||
zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
|
||||
ptr = zend_hash_next_index_insert_ptr(sdl->types, newType);
|
||||
} else {
|
||||
if (cur_type->elements == NULL) {
|
||||
cur_type->elements = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0);
|
||||
}
|
||||
zend_hash_update(cur_type->elements, newType->name, strlen(newType->name)+1, &newType, sizeof(sdlTypePtr), (void **)&ptr);
|
||||
ptr = zend_hash_str_update_ptr(cur_type->elements, newType->name, strlen(newType->name), newType);
|
||||
}
|
||||
cur_type = (*ptr);
|
||||
cur_type = ptr;
|
||||
|
||||
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
|
||||
} else {
|
||||
@@ -421,7 +421,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
|
||||
parse_namespace(itemType->children->content, &type, &ns);
|
||||
nsptr = xmlSearchNs(listType->doc, listType, BAD_CAST(ns));
|
||||
if (nsptr != NULL) {
|
||||
sdlTypePtr newType, *tmp;
|
||||
sdlTypePtr newType;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -435,7 +435,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
|
||||
cur_type->elements = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0);
|
||||
}
|
||||
zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
|
||||
zend_hash_next_index_insert_ptr(cur_type->elements, newType);
|
||||
}
|
||||
if (type) {efree(type);}
|
||||
if (ns) {efree(ns);}
|
||||
@@ -447,7 +447,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
|
||||
trav = trav->next;
|
||||
}
|
||||
if (trav != NULL && node_is_equal(trav,"simpleType")) {
|
||||
sdlTypePtr newType, *tmp;
|
||||
sdlTypePtr newType;
|
||||
|
||||
if (itemType != NULL) {
|
||||
soap_error0(E_ERROR, "Parsing Schema: element has both 'itemType' attribute and subtype");
|
||||
@@ -462,7 +462,9 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
|
||||
smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
|
||||
smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
|
||||
smart_str_0(&anonymous);
|
||||
newType->name = anonymous.c;
|
||||
// TODO: avoid reallocation ???
|
||||
newType->name = estrndup(anonymous.s->val, anonymous.s->len);
|
||||
smart_str_free(&anonymous);
|
||||
}
|
||||
newType->namens = estrdup((char*)tns->children->content);
|
||||
|
||||
@@ -470,7 +472,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP
|
||||
cur_type->elements = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0);
|
||||
}
|
||||
zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
|
||||
zend_hash_next_index_insert_ptr(cur_type->elements, newType);
|
||||
|
||||
schema_simpleType(sdl, tns, trav, newType);
|
||||
|
||||
@@ -516,7 +518,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
|
||||
parse_namespace(BAD_CAST(start), &type, &ns);
|
||||
nsptr = xmlSearchNs(unionType->doc, unionType, BAD_CAST(ns));
|
||||
if (nsptr != NULL) {
|
||||
sdlTypePtr newType, *tmp;
|
||||
sdlTypePtr newType;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -530,7 +532,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
|
||||
cur_type->elements = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0);
|
||||
}
|
||||
zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
|
||||
zend_hash_next_index_insert_ptr(cur_type->elements, newType);
|
||||
}
|
||||
if (type) {efree(type);}
|
||||
if (ns) {efree(ns);}
|
||||
@@ -547,7 +549,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
|
||||
}
|
||||
while (trav != NULL) {
|
||||
if (node_is_equal(trav,"simpleType")) {
|
||||
sdlTypePtr newType, *tmp;
|
||||
sdlTypePtr newType;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -558,7 +560,9 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
|
||||
smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
|
||||
smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
|
||||
smart_str_0(&anonymous);
|
||||
newType->name = anonymous.c;
|
||||
// TODO: avoid reallocation ???
|
||||
newType->name = estrndup(anonymous.s->val, anonymous.s->len);
|
||||
smart_str_free(&anonymous);
|
||||
}
|
||||
newType->namens = estrdup((char*)tns->children->content);
|
||||
|
||||
@@ -566,7 +570,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp
|
||||
cur_type->elements = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(cur_type->elements, 0, NULL, delete_type, 0);
|
||||
}
|
||||
zend_hash_next_index_insert(cur_type->elements, &newType, sizeof(sdlTypePtr), (void **)&tmp);
|
||||
zend_hash_next_index_insert_ptr(cur_type->elements, newType);
|
||||
|
||||
schema_simpleType(sdl, tns, trav, newType);
|
||||
|
||||
@@ -699,8 +703,8 @@ static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodeP
|
||||
cur_type->restrictions->enumeration = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(cur_type->restrictions->enumeration, 0, NULL, delete_restriction_var_char, 0);
|
||||
}
|
||||
if (zend_hash_add(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value)+1, &enumval, sizeof(sdlRestrictionCharPtr), NULL) == FAILURE) {
|
||||
delete_restriction_var_char(&enumval);
|
||||
if (zend_hash_str_add_ptr(cur_type->restrictions->enumeration, enumval->value, strlen(enumval->value), enumval) == NULL) {
|
||||
delete_restriction_var_char_int(enumval);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
@@ -1022,7 +1026,7 @@ static int schema_all(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr all, sdlTypePtr cur
|
||||
if (model == NULL) {
|
||||
cur_type->model = newModel;
|
||||
} else {
|
||||
zend_hash_next_index_insert(model->u.content,&newModel,sizeof(sdlContentModelPtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(model->u.content, newModel);
|
||||
}
|
||||
|
||||
schema_min_max(all, newModel);
|
||||
@@ -1096,7 +1100,7 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp
|
||||
|
||||
newModel = emalloc(sizeof(sdlContentModel));
|
||||
newModel->kind = XSD_CONTENT_GROUP_REF;
|
||||
newModel->u.group_ref = estrdup(key.c);
|
||||
newModel->u.group_ref = estrndup(key.s->val, key.s->len);
|
||||
|
||||
if (type) {efree(type);}
|
||||
if (ns) {efree(ns);}
|
||||
@@ -1122,8 +1126,8 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp
|
||||
sdl->groups = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(sdl->groups, 0, NULL, delete_type, 0);
|
||||
}
|
||||
if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: group '%s' already defined", key.c);
|
||||
if (zend_hash_add_ptr(sdl->groups, key.s, newType) == NULL) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: group '%s' already defined", key.s->val);
|
||||
}
|
||||
|
||||
cur_type = newType;
|
||||
@@ -1133,7 +1137,7 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp
|
||||
if (model == NULL) {
|
||||
cur_type->model = newModel;
|
||||
} else {
|
||||
zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(model->u.content, newModel);
|
||||
}
|
||||
} else {
|
||||
soap_error0(E_ERROR, "Parsing Schema: group has no 'name' nor 'ref' attributes");
|
||||
@@ -1198,7 +1202,7 @@ static int schema_choice(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr choiceType, sdlT
|
||||
if (model == NULL) {
|
||||
cur_type->model = newModel;
|
||||
} else {
|
||||
zend_hash_next_index_insert(model->u.content,&newModel,sizeof(sdlContentModelPtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(model->u.content, newModel);
|
||||
}
|
||||
|
||||
schema_min_max(choiceType, newModel);
|
||||
@@ -1248,7 +1252,7 @@ static int schema_sequence(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr seqType, sdlTy
|
||||
if (model == NULL) {
|
||||
cur_type->model = newModel;
|
||||
} else {
|
||||
zend_hash_next_index_insert(model->u.content,&newModel,sizeof(sdlContentModelPtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(model->u.content, newModel);
|
||||
}
|
||||
|
||||
schema_min_max(seqType, newModel);
|
||||
@@ -1298,7 +1302,7 @@ static int schema_any(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr anyType, sdlTypePtr
|
||||
|
||||
schema_min_max(anyType, newModel);
|
||||
|
||||
zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(model->u.content, newModel);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1368,7 +1372,7 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, s
|
||||
name = get_attribute(attrs, "name");
|
||||
if (cur_type != NULL) {
|
||||
/* Anonymous type inside <element> */
|
||||
sdlTypePtr newType, *ptr;
|
||||
sdlTypePtr newType, ptr;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -1381,7 +1385,7 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, s
|
||||
newType->namens = estrdup(cur_type->namens);
|
||||
}
|
||||
|
||||
zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
|
||||
ptr = zend_hash_next_index_insert_ptr(sdl->types, newType);
|
||||
|
||||
if (sdl->encoders == NULL) {
|
||||
sdl->encoders = emalloc(sizeof(HashTable));
|
||||
@@ -1391,15 +1395,15 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, s
|
||||
memset(cur_type->encode, 0, sizeof(encode));
|
||||
cur_type->encode->details.ns = estrdup(newType->namens);
|
||||
cur_type->encode->details.type_str = estrdup(newType->name);
|
||||
cur_type->encode->details.sdl_type = *ptr;
|
||||
cur_type->encode->details.sdl_type = ptr;
|
||||
cur_type->encode->to_xml = sdl_guess_convert_xml;
|
||||
cur_type->encode->to_zval = sdl_guess_convert_zval;
|
||||
zend_hash_next_index_insert(sdl->encoders, &cur_type->encode, sizeof(encodePtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(sdl->encoders, cur_type->encode);
|
||||
|
||||
cur_type =*ptr;
|
||||
cur_type = ptr;
|
||||
|
||||
} else if (name) {
|
||||
sdlTypePtr newType, *ptr;
|
||||
sdlTypePtr newType, ptr;
|
||||
|
||||
newType = emalloc(sizeof(sdlType));
|
||||
memset(newType, 0, sizeof(sdlType));
|
||||
@@ -1407,9 +1411,9 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, s
|
||||
newType->name = estrdup((char*)name->children->content);
|
||||
newType->namens = estrdup((char*)ns->children->content);
|
||||
|
||||
zend_hash_next_index_insert(sdl->types, &newType, sizeof(sdlTypePtr), (void **)&ptr);
|
||||
ptr = zend_hash_next_index_insert_ptr(sdl->types, newType);
|
||||
|
||||
cur_type = (*ptr);
|
||||
cur_type = ptr;
|
||||
create_encoder(sdl, cur_type, ns->children->content, name->children->content);
|
||||
} else {
|
||||
soap_error0(E_ERROR, "Parsing Schema: complexType has no 'name' attribute");
|
||||
@@ -1532,7 +1536,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp
|
||||
smart_str_0(&nscat);
|
||||
if (type) {efree(type);}
|
||||
if (ns) {efree(ns);}
|
||||
newType->ref = estrdup(nscat.c);
|
||||
newType->ref = estrndup(nscat.s->val, nscat.s->len);
|
||||
smart_str_free(&nscat);
|
||||
} else {
|
||||
newType->name = estrdup((char*)name->children->content);
|
||||
@@ -1560,11 +1564,11 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp
|
||||
}
|
||||
|
||||
smart_str_0(&key);
|
||||
if (zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
||||
if (zend_hash_add_ptr(addHash, key.s, newType) == NULL) {
|
||||
if (cur_type == NULL) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: element '%s' already defined", key.c);
|
||||
soap_error1(E_ERROR, "Parsing Schema: element '%s' already defined", key.s->val);
|
||||
} else {
|
||||
zend_hash_next_index_insert(addHash, &newType, sizeof(sdlTypePtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(addHash, newType);
|
||||
}
|
||||
}
|
||||
smart_str_free(&key);
|
||||
@@ -1578,7 +1582,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp
|
||||
schema_min_max(element, newModel);
|
||||
|
||||
|
||||
zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(model->u.content, newModel);
|
||||
}
|
||||
cur_type = newType;
|
||||
} else {
|
||||
@@ -1763,7 +1767,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
|
||||
smart_str_appendc(&key, ':');
|
||||
smart_str_appends(&key, attr_name);
|
||||
smart_str_0(&key);
|
||||
newAttr->ref = estrdup(key.c);
|
||||
newAttr->ref = estrndup(key.s->val, key.s->len);
|
||||
if (attr_name) {efree(attr_name);}
|
||||
if (ns) {efree(ns);}
|
||||
} else {
|
||||
@@ -1792,8 +1796,8 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
|
||||
addHash = cur_type->attributes;
|
||||
}
|
||||
|
||||
if (zend_hash_add(addHash, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL) != SUCCESS) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: attribute '%s' already defined", key.c);
|
||||
if (zend_hash_add_ptr(addHash, key.s, newAttr) == NULL) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: attribute '%s' already defined", key.s->val);
|
||||
}
|
||||
smart_str_free(&key);
|
||||
} else{
|
||||
@@ -1881,7 +1885,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
|
||||
smart_str_appendc(&key2, ':');
|
||||
smart_str_appends(&key2, (char*)attr->name);
|
||||
smart_str_0(&key2);
|
||||
zend_hash_add(newAttr->extraAttributes, key2.c, key2.len + 1, &ext, sizeof(sdlExtraAttributePtr), NULL);
|
||||
zend_hash_add_ptr(newAttr->extraAttributes, key2.s, ext);
|
||||
smart_str_free(&key2);
|
||||
}
|
||||
}
|
||||
@@ -1914,6 +1918,8 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
|
||||
if (trav != NULL) {
|
||||
if (node_is_equal(trav,"simpleType")) {
|
||||
sdlTypePtr dummy_type;
|
||||
zval zv;
|
||||
|
||||
if (ref != NULL) {
|
||||
soap_error0(E_ERROR, "Parsing Schema: attribute has both 'ref' attribute and subtype");
|
||||
} else if (type != NULL) {
|
||||
@@ -1927,12 +1933,15 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl
|
||||
smart_str_appendl(&anonymous, "anonymous", sizeof("anonymous")-1);
|
||||
smart_str_append_long(&anonymous, zend_hash_num_elements(sdl->types));
|
||||
smart_str_0(&anonymous);
|
||||
dummy_type->name = anonymous.c;
|
||||
// TODO: avoid reallocation ???
|
||||
dummy_type->name = estrndup(anonymous.s->val, anonymous.s->len);
|
||||
smart_str_free(&anonymous);
|
||||
}
|
||||
dummy_type->namens = estrdup((char*)tns->children->content);
|
||||
schema_simpleType(sdl, tns, trav, dummy_type);
|
||||
newAttr->encode = dummy_type->encode;
|
||||
delete_type(&dummy_type);
|
||||
ZVAL_PTR(&zv, dummy_type);
|
||||
delete_type(&zv);
|
||||
trav = trav->next;
|
||||
}
|
||||
}
|
||||
@@ -1972,8 +1981,8 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrGrou
|
||||
smart_str_appends(&key, newType->name);
|
||||
smart_str_0(&key);
|
||||
|
||||
if (zend_hash_add(ctx->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: attributeGroup '%s' already defined", key.c);
|
||||
if (zend_hash_add_ptr(ctx->attributeGroups, key.s, newType) == NULL) {
|
||||
soap_error1(E_ERROR, "Parsing Schema: attributeGroup '%s' already defined", key.s->val);
|
||||
}
|
||||
cur_type = newType;
|
||||
smart_str_free(&key);
|
||||
@@ -1998,12 +2007,12 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrGrou
|
||||
smart_str_appendc(&key, ':');
|
||||
smart_str_appends(&key, group_name);
|
||||
smart_str_0(&key);
|
||||
newAttr->ref = estrdup(key.c);
|
||||
newAttr->ref = estrndup(key.s->val, key.s->len);
|
||||
if (group_name) {efree(group_name);}
|
||||
if (ns) {efree(ns);}
|
||||
smart_str_free(&key);
|
||||
|
||||
zend_hash_next_index_insert(cur_type->attributes, &newAttr, sizeof(sdlAttributePtr), NULL);
|
||||
zend_hash_next_index_insert_ptr(cur_type->attributes, newAttr);
|
||||
cur_type = NULL;
|
||||
}
|
||||
} else{
|
||||
@@ -2044,14 +2053,13 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrGrou
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void copy_extra_attribute(void *attribute)
|
||||
static void copy_extra_attribute(zval *zv)
|
||||
{
|
||||
sdlExtraAttributePtr *attr = (sdlExtraAttributePtr*)attribute;
|
||||
sdlExtraAttributePtr new_attr;
|
||||
|
||||
new_attr = emalloc(sizeof(sdlExtraAttribute));
|
||||
memcpy(new_attr, *attr, sizeof(sdlExtraAttribute));
|
||||
*attr = new_attr;
|
||||
memcpy(new_attr, Z_PTR_P(zv), sizeof(sdlExtraAttribute));
|
||||
Z_PTR_P(zv) = new_attr;
|
||||
if (new_attr->ns) {
|
||||
new_attr->ns = estrdup(new_attr->ns);
|
||||
}
|
||||
@@ -2062,14 +2070,14 @@ static void copy_extra_attribute(void *attribute)
|
||||
|
||||
static void* schema_find_by_ref(HashTable *ht, char *ref)
|
||||
{
|
||||
void **tmp;
|
||||
void *tmp;
|
||||
|
||||
if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
if ((tmp = zend_hash_str_find_ptr(ht, ref, strlen(ref))) != NULL) {
|
||||
return tmp;
|
||||
} else {
|
||||
ref = strrchr(ref, ':');
|
||||
if (ref) {
|
||||
if (zend_hash_find(ht, ref, strlen(ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
if ((tmp = zend_hash_str_find_ptr(ht, ref, strlen(ref))) != NULL) {
|
||||
return tmp;
|
||||
}
|
||||
}
|
||||
@@ -2079,39 +2087,37 @@ static void* schema_find_by_ref(HashTable *ht, char *ref)
|
||||
|
||||
static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
|
||||
{
|
||||
sdlAttributePtr *tmp;
|
||||
sdlAttributePtr tmp;
|
||||
|
||||
if (attr->ref != NULL) {
|
||||
if (ctx->attributes != NULL) {
|
||||
tmp = (sdlAttributePtr*)schema_find_by_ref(ctx->attributes, attr->ref);
|
||||
tmp = (sdlAttributePtr)schema_find_by_ref(ctx->attributes, attr->ref);
|
||||
if (tmp) {
|
||||
schema_attribute_fixup(ctx, *tmp);
|
||||
if ((*tmp)->name != NULL && attr->name == NULL) {
|
||||
attr->name = estrdup((*tmp)->name);
|
||||
schema_attribute_fixup(ctx, tmp);
|
||||
if (tmp->name != NULL && attr->name == NULL) {
|
||||
attr->name = estrdup(tmp->name);
|
||||
}
|
||||
if ((*tmp)->namens != NULL && attr->namens == NULL) {
|
||||
attr->namens = estrdup((*tmp)->namens);
|
||||
if (tmp->namens != NULL && attr->namens == NULL) {
|
||||
attr->namens = estrdup(tmp->namens);
|
||||
}
|
||||
if ((*tmp)->def != NULL && attr->def == NULL) {
|
||||
attr->def = estrdup((*tmp)->def);
|
||||
if (tmp->def != NULL && attr->def == NULL) {
|
||||
attr->def = estrdup(tmp->def);
|
||||
}
|
||||
if ((*tmp)->fixed != NULL && attr->fixed == NULL) {
|
||||
attr->fixed = estrdup((*tmp)->fixed);
|
||||
if (tmp->fixed != NULL && attr->fixed == NULL) {
|
||||
attr->fixed = estrdup(tmp->fixed);
|
||||
}
|
||||
if (attr->form == XSD_FORM_DEFAULT) {
|
||||
attr->form = (*tmp)->form;
|
||||
attr->form = tmp->form;
|
||||
}
|
||||
if (attr->use == XSD_USE_DEFAULT) {
|
||||
attr->use = (*tmp)->use;
|
||||
attr->use = tmp->use;
|
||||
}
|
||||
if ((*tmp)->extraAttributes != NULL) {
|
||||
xmlNodePtr node;
|
||||
|
||||
if (tmp->extraAttributes != NULL) {
|
||||
attr->extraAttributes = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(attr->extraAttributes, zend_hash_num_elements((*tmp)->extraAttributes), NULL, delete_extra_attribute, 0);
|
||||
zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr));
|
||||
zend_hash_init(attr->extraAttributes, zend_hash_num_elements(tmp->extraAttributes), NULL, delete_extra_attribute, 0);
|
||||
zend_hash_copy(attr->extraAttributes, tmp->extraAttributes, copy_extra_attribute);
|
||||
}
|
||||
attr->encode = (*tmp)->encode;
|
||||
attr->encode = tmp->encode;
|
||||
}
|
||||
}
|
||||
if (attr->name == NULL && attr->ref != NULL) {
|
||||
@@ -2129,47 +2135,45 @@ static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
|
||||
|
||||
static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashTable *ht)
|
||||
{
|
||||
sdlTypePtr *tmp;
|
||||
sdlAttributePtr *tmp_attr;
|
||||
sdlTypePtr tmp;
|
||||
sdlAttributePtr tmp_attr;
|
||||
|
||||
if (attr->ref != NULL) {
|
||||
if (ctx->attributeGroups != NULL) {
|
||||
tmp = (sdlTypePtr*)schema_find_by_ref(ctx->attributeGroups, attr->ref);
|
||||
tmp = (sdlTypePtr)schema_find_by_ref(ctx->attributeGroups, attr->ref);
|
||||
if (tmp) {
|
||||
if ((*tmp)->attributes) {
|
||||
zend_hash_internal_pointer_reset((*tmp)->attributes);
|
||||
while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) {
|
||||
if (zend_hash_get_current_key_type((*tmp)->attributes) == HASH_KEY_IS_STRING) {
|
||||
char* key;
|
||||
uint key_len;
|
||||
if (tmp->attributes) {
|
||||
zend_hash_internal_pointer_reset(tmp->attributes);
|
||||
while ((tmp_attr = zend_hash_get_current_data_ptr(tmp->attributes)) != NULL) {
|
||||
if (zend_hash_get_current_key_type(tmp->attributes) == HASH_KEY_IS_STRING) {
|
||||
zend_string* _key;
|
||||
sdlAttributePtr newAttr;
|
||||
|
||||
schema_attribute_fixup(ctx,*tmp_attr);
|
||||
schema_attribute_fixup(ctx, tmp_attr);
|
||||
|
||||
newAttr = emalloc(sizeof(sdlAttribute));
|
||||
memcpy(newAttr, *tmp_attr, sizeof(sdlAttribute));
|
||||
memcpy(newAttr, tmp_attr, sizeof(sdlAttribute));
|
||||
if (newAttr->def) {newAttr->def = estrdup(newAttr->def);}
|
||||
if (newAttr->fixed) {newAttr->fixed = estrdup(newAttr->fixed);}
|
||||
if (newAttr->namens) {newAttr->namens = estrdup(newAttr->namens);}
|
||||
if (newAttr->name) {newAttr->name = estrdup(newAttr->name);}
|
||||
if (newAttr->extraAttributes) {
|
||||
xmlNodePtr node;
|
||||
HashTable *ht = emalloc(sizeof(HashTable));
|
||||
zend_hash_init(ht, zend_hash_num_elements(newAttr->extraAttributes), NULL, delete_extra_attribute, 0);
|
||||
zend_hash_copy(ht, newAttr->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr));
|
||||
zend_hash_copy(ht, newAttr->extraAttributes, copy_extra_attribute);
|
||||
newAttr->extraAttributes = ht;
|
||||
}
|
||||
|
||||
zend_hash_get_current_key_ex((*tmp)->attributes, &key, &key_len, NULL, 0, NULL);
|
||||
zend_hash_add(ht, key, key_len, &newAttr, sizeof(sdlAttributePtr), NULL);
|
||||
zend_hash_get_current_key_ex(tmp->attributes, &_key, NULL, 0, &tmp->attributes->nInternalPointer);
|
||||
zend_hash_add_ptr(ht, _key, &newAttr);
|
||||
|
||||
zend_hash_move_forward((*tmp)->attributes);
|
||||
zend_hash_move_forward(tmp->attributes);
|
||||
} else {
|
||||
ulong index;
|
||||
|
||||
schema_attributegroup_fixup(ctx,*tmp_attr, ht);
|
||||
zend_hash_get_current_key((*tmp)->attributes, NULL, &index, 0);
|
||||
zend_hash_index_del((*tmp)->attributes, index);
|
||||
schema_attributegroup_fixup(ctx, tmp_attr, ht);
|
||||
zend_hash_get_current_key(tmp->attributes, NULL, &index, 0);
|
||||
zend_hash_index_del(tmp->attributes, index);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2184,13 +2188,13 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
|
||||
{
|
||||
switch (model->kind) {
|
||||
case XSD_CONTENT_GROUP_REF: {
|
||||
sdlTypePtr *tmp;
|
||||
sdlTypePtr tmp;
|
||||
|
||||
if (ctx->sdl->groups && zend_hash_find(ctx->sdl->groups, model->u.group_ref, strlen(model->u.group_ref)+1, (void**)&tmp) == SUCCESS) {
|
||||
schema_type_fixup(ctx,*tmp);
|
||||
if (ctx->sdl->groups && (tmp = zend_hash_str_find_ptr(ctx->sdl->groups, model->u.group_ref, strlen(model->u.group_ref))) != NULL) {
|
||||
schema_type_fixup(ctx, tmp);
|
||||
efree(model->u.group_ref);
|
||||
model->kind = XSD_CONTENT_GROUP;
|
||||
model->u.group = (*tmp);
|
||||
model->u.group = tmp;
|
||||
} else {
|
||||
soap_error1(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute '%s'", model->u.group_ref);
|
||||
}
|
||||
@@ -2198,15 +2202,12 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
|
||||
}
|
||||
case XSD_CONTENT_CHOICE: {
|
||||
if (model->max_occurs != 1) {
|
||||
HashPosition pos;
|
||||
sdlContentModelPtr *tmp;
|
||||
sdlContentModelPtr tmp;
|
||||
|
||||
zend_hash_internal_pointer_reset_ex(model->u.content, &pos);
|
||||
while (zend_hash_get_current_data_ex(model->u.content, (void**)&tmp, &pos) == SUCCESS) {
|
||||
(*tmp)->min_occurs = 0;
|
||||
(*tmp)->max_occurs = model->max_occurs;
|
||||
zend_hash_move_forward_ex(model->u.content, &pos);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(model->u.content, tmp) {
|
||||
tmp->min_occurs = 0;
|
||||
tmp->max_occurs = model->max_occurs;
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
model->kind = XSD_CONTENT_ALL;
|
||||
model->min_occurs = 1;
|
||||
@@ -2215,13 +2216,11 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
|
||||
}
|
||||
case XSD_CONTENT_SEQUENCE:
|
||||
case XSD_CONTENT_ALL: {
|
||||
sdlContentModelPtr *tmp;
|
||||
sdlContentModelPtr tmp;
|
||||
|
||||
zend_hash_internal_pointer_reset(model->u.content);
|
||||
while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
|
||||
schema_content_model_fixup(ctx, *tmp);
|
||||
zend_hash_move_forward(model->u.content);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(model->u.content, tmp) {
|
||||
schema_content_model_fixup(ctx, tmp);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -2231,25 +2230,25 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
|
||||
|
||||
static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
|
||||
{
|
||||
sdlTypePtr *tmp;
|
||||
sdlAttributePtr *attr;
|
||||
sdlTypePtr tmp;
|
||||
sdlAttributePtr attr;
|
||||
|
||||
if (type->ref != NULL) {
|
||||
if (ctx->sdl->elements != NULL) {
|
||||
tmp = (sdlTypePtr*)schema_find_by_ref(ctx->sdl->elements, type->ref);
|
||||
tmp = (sdlTypePtr)schema_find_by_ref(ctx->sdl->elements, type->ref);
|
||||
if (tmp) {
|
||||
type->kind = (*tmp)->kind;
|
||||
type->encode = (*tmp)->encode;
|
||||
if ((*tmp)->nillable) {
|
||||
type->kind = tmp->kind;
|
||||
type->encode = tmp->encode;
|
||||
if (tmp->nillable) {
|
||||
type->nillable = 1;
|
||||
}
|
||||
if ((*tmp)->fixed) {
|
||||
type->fixed = estrdup((*tmp)->fixed);
|
||||
if (tmp->fixed) {
|
||||
type->fixed = estrdup(tmp->fixed);
|
||||
}
|
||||
if ((*tmp)->def) {
|
||||
type->def = estrdup((*tmp)->def);
|
||||
if (tmp->def) {
|
||||
type->def = estrdup(tmp->def);
|
||||
}
|
||||
type->form = (*tmp)->form;
|
||||
type->form = tmp->form;
|
||||
} else if (strcmp(type->ref, SCHEMA_NAMESPACE ":schema") == 0) {
|
||||
type->encode = get_conversion(XSD_ANYXML);
|
||||
} else {
|
||||
@@ -2260,72 +2259,59 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
|
||||
type->ref = NULL;
|
||||
}
|
||||
if (type->elements) {
|
||||
zend_hash_internal_pointer_reset(type->elements);
|
||||
while (zend_hash_get_current_data(type->elements,(void**)&tmp) == SUCCESS) {
|
||||
schema_type_fixup(ctx,*tmp);
|
||||
zend_hash_move_forward(type->elements);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(type->elements, tmp) {
|
||||
schema_type_fixup(ctx, tmp);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
if (type->model) {
|
||||
schema_content_model_fixup(ctx, type->model);
|
||||
}
|
||||
if (type->attributes) {
|
||||
zend_hash_internal_pointer_reset(type->attributes);
|
||||
while (zend_hash_get_current_data(type->attributes,(void**)&attr) == SUCCESS) {
|
||||
if (zend_hash_get_current_key_type(type->attributes) == HASH_KEY_IS_STRING) {
|
||||
schema_attribute_fixup(ctx,*attr);
|
||||
zend_string *str_key;
|
||||
ulong index;
|
||||
|
||||
ZEND_HASH_FOREACH_KEY_PTR(type->attributes, index, str_key, attr) {
|
||||
if (str_key) {
|
||||
schema_attribute_fixup(ctx, attr);
|
||||
zend_hash_move_forward(type->attributes);
|
||||
} else {
|
||||
ulong index;
|
||||
|
||||
schema_attributegroup_fixup(ctx,*attr,type->attributes);
|
||||
zend_hash_get_current_key(type->attributes, NULL, &index, 0);
|
||||
schema_attributegroup_fixup(ctx, attr, type->attributes);
|
||||
zend_hash_index_del(type->attributes, index);
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
}
|
||||
|
||||
void schema_pass2(sdlCtx *ctx)
|
||||
{
|
||||
sdlPtr sdl = ctx->sdl;
|
||||
sdlAttributePtr *attr;
|
||||
sdlTypePtr *type;
|
||||
sdlAttributePtr attr;
|
||||
sdlTypePtr type;
|
||||
|
||||
if (ctx->attributes) {
|
||||
zend_hash_internal_pointer_reset(ctx->attributes);
|
||||
while (zend_hash_get_current_data(ctx->attributes,(void**)&attr) == SUCCESS) {
|
||||
schema_attribute_fixup(ctx,*attr);
|
||||
zend_hash_move_forward(ctx->attributes);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(ctx->attributes, attr) {
|
||||
schema_attribute_fixup(ctx, attr);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
if (ctx->attributeGroups) {
|
||||
zend_hash_internal_pointer_reset(ctx->attributeGroups);
|
||||
while (zend_hash_get_current_data(ctx->attributeGroups,(void**)&type) == SUCCESS) {
|
||||
schema_type_fixup(ctx,*type);
|
||||
zend_hash_move_forward(ctx->attributeGroups);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(ctx->attributeGroups, type) {
|
||||
schema_type_fixup(ctx, type);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
if (sdl->elements) {
|
||||
zend_hash_internal_pointer_reset(sdl->elements);
|
||||
while (zend_hash_get_current_data(sdl->elements,(void**)&type) == SUCCESS) {
|
||||
schema_type_fixup(ctx,*type);
|
||||
zend_hash_move_forward(sdl->elements);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(sdl->elements, type) {
|
||||
schema_type_fixup(ctx, type);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
if (sdl->groups) {
|
||||
zend_hash_internal_pointer_reset(sdl->groups);
|
||||
while (zend_hash_get_current_data(sdl->groups,(void**)&type) == SUCCESS) {
|
||||
schema_type_fixup(ctx,*type);
|
||||
zend_hash_move_forward(sdl->groups);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(sdl->groups, type) {
|
||||
schema_type_fixup(ctx, type);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
if (sdl->types) {
|
||||
zend_hash_internal_pointer_reset(sdl->types);
|
||||
while (zend_hash_get_current_data(sdl->types,(void**)&type) == SUCCESS) {
|
||||
schema_type_fixup(ctx,*type);
|
||||
zend_hash_move_forward(sdl->types);
|
||||
}
|
||||
ZEND_HASH_FOREACH_PTR(sdl->types, type) {
|
||||
schema_type_fixup(ctx, type);
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
if (ctx->attributes) {
|
||||
zend_hash_destroy(ctx->attributes);
|
||||
@@ -2337,9 +2323,9 @@ void schema_pass2(sdlCtx *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
void delete_model(void *handle)
|
||||
void delete_model(zval *zv)
|
||||
{
|
||||
sdlContentModelPtr tmp = *((sdlContentModelPtr*)handle);
|
||||
sdlContentModelPtr tmp = Z_PTR_P(zv);
|
||||
switch (tmp->kind) {
|
||||
case XSD_CONTENT_ELEMENT:
|
||||
case XSD_CONTENT_GROUP:
|
||||
@@ -2359,9 +2345,8 @@ void delete_model(void *handle)
|
||||
efree(tmp);
|
||||
}
|
||||
|
||||
void delete_model_persistent(void *handle)
|
||||
static void delete_model_persistent_int(sdlContentModelPtr tmp)
|
||||
{
|
||||
sdlContentModelPtr tmp = *((sdlContentModelPtr*)handle);
|
||||
switch (tmp->kind) {
|
||||
case XSD_CONTENT_ELEMENT:
|
||||
case XSD_CONTENT_GROUP:
|
||||
@@ -2381,9 +2366,14 @@ void delete_model_persistent(void *handle)
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
void delete_type(void *data)
|
||||
void delete_model_persistent(zval *zv)
|
||||
{
|
||||
sdlTypePtr type = *((sdlTypePtr*)data);
|
||||
delete_model_persistent_int(Z_PTR_P(zv));
|
||||
}
|
||||
|
||||
void delete_type(zval *zv)
|
||||
{
|
||||
sdlTypePtr type = Z_PTR_P(zv);
|
||||
|
||||
if (type->name) {
|
||||
efree(type->name);
|
||||
@@ -2406,20 +2396,22 @@ void delete_type(void *data)
|
||||
efree(type->attributes);
|
||||
}
|
||||
if (type->model) {
|
||||
delete_model((void**)&type->model);
|
||||
zval zv;
|
||||
ZVAL_PTR(&zv, type->model);
|
||||
delete_model(&zv);
|
||||
}
|
||||
if (type->restrictions) {
|
||||
delete_restriction_var_int(&type->restrictions->minExclusive);
|
||||
delete_restriction_var_int(&type->restrictions->minInclusive);
|
||||
delete_restriction_var_int(&type->restrictions->maxExclusive);
|
||||
delete_restriction_var_int(&type->restrictions->maxInclusive);
|
||||
delete_restriction_var_int(&type->restrictions->totalDigits);
|
||||
delete_restriction_var_int(&type->restrictions->fractionDigits);
|
||||
delete_restriction_var_int(&type->restrictions->length);
|
||||
delete_restriction_var_int(&type->restrictions->minLength);
|
||||
delete_restriction_var_int(&type->restrictions->maxLength);
|
||||
delete_restriction_var_char(&type->restrictions->whiteSpace);
|
||||
delete_restriction_var_char(&type->restrictions->pattern);
|
||||
delete_restriction_var_int(type->restrictions->minExclusive);
|
||||
delete_restriction_var_int(type->restrictions->minInclusive);
|
||||
delete_restriction_var_int(type->restrictions->maxExclusive);
|
||||
delete_restriction_var_int(type->restrictions->maxInclusive);
|
||||
delete_restriction_var_int(type->restrictions->totalDigits);
|
||||
delete_restriction_var_int(type->restrictions->fractionDigits);
|
||||
delete_restriction_var_int(type->restrictions->length);
|
||||
delete_restriction_var_int(type->restrictions->minLength);
|
||||
delete_restriction_var_int(type->restrictions->maxLength);
|
||||
delete_restriction_var_char_int(type->restrictions->whiteSpace);
|
||||
delete_restriction_var_char_int(type->restrictions->pattern);
|
||||
if (type->restrictions->enumeration) {
|
||||
zend_hash_destroy(type->restrictions->enumeration);
|
||||
efree(type->restrictions->enumeration);
|
||||
@@ -2429,9 +2421,9 @@ void delete_type(void *data)
|
||||
efree(type);
|
||||
}
|
||||
|
||||
void delete_type_persistent(void *data)
|
||||
void delete_type_persistent(zval *zv)
|
||||
{
|
||||
sdlTypePtr type = *((sdlTypePtr*)data);
|
||||
sdlTypePtr type = Z_PTR_P(zv);
|
||||
if (type->name) {
|
||||
free(type->name);
|
||||
}
|
||||
@@ -2453,20 +2445,20 @@ void delete_type_persistent(void *data)
|
||||
free(type->attributes);
|
||||
}
|
||||
if (type->model) {
|
||||
delete_model_persistent((void**)&type->model);
|
||||
delete_model_persistent_int(type->model);
|
||||
}
|
||||
if (type->restrictions) {
|
||||
delete_restriction_var_int_persistent(&type->restrictions->minExclusive);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->minInclusive);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->maxExclusive);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->maxInclusive);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->totalDigits);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->fractionDigits);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->length);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->minLength);
|
||||
delete_restriction_var_int_persistent(&type->restrictions->maxLength);
|
||||
delete_restriction_var_char_persistent(&type->restrictions->whiteSpace);
|
||||
delete_restriction_var_char_persistent(&type->restrictions->pattern);
|
||||
delete_restriction_var_int_persistent(type->restrictions->minExclusive);
|
||||
delete_restriction_var_int_persistent(type->restrictions->minInclusive);
|
||||
delete_restriction_var_int_persistent(type->restrictions->maxExclusive);
|
||||
delete_restriction_var_int_persistent(type->restrictions->maxInclusive);
|
||||
delete_restriction_var_int_persistent(type->restrictions->totalDigits);
|
||||
delete_restriction_var_int_persistent(type->restrictions->fractionDigits);
|
||||
delete_restriction_var_int_persistent(type->restrictions->length);
|
||||
delete_restriction_var_int_persistent(type->restrictions->minLength);
|
||||
delete_restriction_var_int_persistent(type->restrictions->maxLength);
|
||||
delete_restriction_var_char_persistent_int(type->restrictions->whiteSpace);
|
||||
delete_restriction_var_char_persistent_int(type->restrictions->pattern);
|
||||
if (type->restrictions->enumeration) {
|
||||
zend_hash_destroy(type->restrictions->enumeration);
|
||||
free(type->restrictions->enumeration);
|
||||
@@ -2476,9 +2468,9 @@ void delete_type_persistent(void *data)
|
||||
free(type);
|
||||
}
|
||||
|
||||
void delete_extra_attribute(void *attribute)
|
||||
void delete_extra_attribute(zval *zv)
|
||||
{
|
||||
sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
|
||||
sdlExtraAttributePtr attr = Z_PTR_P(zv);
|
||||
|
||||
if (attr->ns) {
|
||||
efree(attr->ns);
|
||||
@@ -2489,9 +2481,9 @@ void delete_extra_attribute(void *attribute)
|
||||
efree(attr);
|
||||
}
|
||||
|
||||
void delete_extra_attribute_persistent(void *attribute)
|
||||
void delete_extra_attribute_persistent(zval *zv)
|
||||
{
|
||||
sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
|
||||
sdlExtraAttributePtr attr = Z_PTR_P(zv);
|
||||
|
||||
if (attr->ns) {
|
||||
free(attr->ns);
|
||||
@@ -2502,9 +2494,9 @@ void delete_extra_attribute_persistent(void *attribute)
|
||||
free(attr);
|
||||
}
|
||||
|
||||
void delete_attribute(void *attribute)
|
||||
void delete_attribute(zval *zv)
|
||||
{
|
||||
sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
|
||||
sdlAttributePtr attr = Z_PTR_P(zv);
|
||||
|
||||
if (attr->def) {
|
||||
efree(attr->def);
|
||||
@@ -2528,9 +2520,9 @@ void delete_attribute(void *attribute)
|
||||
efree(attr);
|
||||
}
|
||||
|
||||
void delete_attribute_persistent(void *attribute)
|
||||
void delete_attribute_persistent(zval *zv)
|
||||
{
|
||||
sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
|
||||
sdlAttributePtr attr = Z_PTR_P(zv);
|
||||
|
||||
if (attr->def) {
|
||||
free(attr->def);
|
||||
@@ -2554,25 +2546,22 @@ void delete_attribute_persistent(void *attribute)
|
||||
free(attr);
|
||||
}
|
||||
|
||||
void delete_restriction_var_int(void *rvi)
|
||||
void delete_restriction_var_int(sdlRestrictionIntPtr ptr)
|
||||
{
|
||||
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
|
||||
if (ptr) {
|
||||
efree(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_restriction_var_int_persistent(void *rvi)
|
||||
void delete_restriction_var_int_persistent(sdlRestrictionIntPtr ptr)
|
||||
{
|
||||
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
|
||||
if (ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_restriction_var_char(void *srvc)
|
||||
void delete_restriction_var_char_int(sdlRestrictionCharPtr ptr)
|
||||
{
|
||||
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
|
||||
if (ptr) {
|
||||
if (ptr->value) {
|
||||
efree(ptr->value);
|
||||
@@ -2581,9 +2570,13 @@ void delete_restriction_var_char(void *srvc)
|
||||
}
|
||||
}
|
||||
|
||||
void delete_restriction_var_char_persistent(void *srvc)
|
||||
void delete_restriction_var_char(zval *zv)
|
||||
{
|
||||
delete_restriction_var_char_int(Z_PTR_P(zv));
|
||||
}
|
||||
|
||||
void delete_restriction_var_char_persistent_int(sdlRestrictionCharPtr ptr)
|
||||
{
|
||||
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
|
||||
if (ptr) {
|
||||
if (ptr->value) {
|
||||
free(ptr->value);
|
||||
@@ -2591,3 +2584,8 @@ void delete_restriction_var_char_persistent(void *srvc)
|
||||
free(ptr);
|
||||
}
|
||||
}
|
||||
|
||||
void delete_restriction_var_char_persistent(zval *zv)
|
||||
{
|
||||
delete_restriction_var_char_persistent_int(Z_PTR_P(zv));
|
||||
}
|
||||
|
||||
@@ -25,16 +25,18 @@
|
||||
int load_schema(sdlCtx *ctx, xmlNodePtr schema TSRMLS_DC);
|
||||
void schema_pass2(sdlCtx *ctx);
|
||||
|
||||
void delete_model(void *handle);
|
||||
void delete_model_persistent(void *handle);
|
||||
void delete_type(void *data);
|
||||
void delete_type_persistent(void *data);
|
||||
void delete_extra_attribute(void *attribute);
|
||||
void delete_extra_attribute_persistent(void *attribute);
|
||||
void delete_attribute(void *attribute);
|
||||
void delete_attribute_persistent(void *attribute);
|
||||
void delete_restriction_var_int(void *rvi);
|
||||
void delete_restriction_var_int_persistent(void *rvi);
|
||||
void delete_restriction_var_char(void *srvc);
|
||||
void delete_restriction_var_char_persistent(void *srvc);
|
||||
void delete_model(zval *zv);
|
||||
void delete_model_persistent(zval *zv);
|
||||
void delete_type(zval *zv);
|
||||
void delete_type_persistent(zval *zv);
|
||||
void delete_extra_attribute(zval *zv);
|
||||
void delete_extra_attribute_persistent(zval *zv);
|
||||
void delete_attribute(zval *zv);
|
||||
void delete_attribute_persistent(zval *zv);
|
||||
void delete_restriction_var_int(sdlRestrictionIntPtr ptr);
|
||||
void delete_restriction_var_int_persistent(sdlRestrictionIntPtr ptr);
|
||||
void delete_restriction_var_char(zval *zv);
|
||||
void delete_restriction_var_char_int(sdlRestrictionCharPtr ptr);
|
||||
void delete_restriction_var_char_persistent(zval *zv);
|
||||
void delete_restriction_var_char_persistent_int(sdlRestrictionCharPtr ptr);
|
||||
#endif
|
||||
|
||||
1091
ext/soap/php_sdl.c
1091
ext/soap/php_sdl.c
File diff suppressed because it is too large
Load Diff
@@ -77,7 +77,7 @@ typedef struct sdlCtx {
|
||||
HashTable *attributes; /* array of sdlAttributePtr */
|
||||
HashTable *attributeGroups; /* array of sdlTypesPtr */
|
||||
php_stream_context *context;
|
||||
zval *old_header;
|
||||
zval old_header;
|
||||
} sdlCtx;
|
||||
|
||||
struct _sdlBinding {
|
||||
|
||||
@@ -74,8 +74,8 @@ typedef struct _soapService soapService, *soapServicePtr;
|
||||
#include "php_packet_soap.h"
|
||||
|
||||
struct _soapMapping {
|
||||
zval *to_xml;
|
||||
zval *to_zval;
|
||||
zval to_xml;
|
||||
zval to_zval;
|
||||
};
|
||||
|
||||
struct _soapHeader;
|
||||
@@ -90,12 +90,12 @@ struct _soapService {
|
||||
|
||||
struct _soap_class {
|
||||
zend_class_entry *ce;
|
||||
zval **argv;
|
||||
zval *argv;
|
||||
int argc;
|
||||
int persistance;
|
||||
} soap_class;
|
||||
|
||||
zval *soap_object;
|
||||
zval soap_object;
|
||||
|
||||
HashTable *typemap;
|
||||
int version;
|
||||
|
||||
1703
ext/soap/soap.c
1703
ext/soap/soap.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user