summaryrefslogtreecommitdiff
path: root/ext/soap/soap.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/soap/soap.c')
-rw-r--r--ext/soap/soap.c59
1 files changed, 28 insertions, 31 deletions
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 00e80efbcb..d10c17e218 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -1560,48 +1560,45 @@ PHP_METHOD(SoapServer, handle)
}
if (ZEND_NUM_ARGS() == 0) {
- if (SG(request_info).raw_post_data) {
- char *post_data = SG(request_info).raw_post_data;
- int post_data_length = SG(request_info).raw_post_data_length;
+ if (SG(request_info).request_body && 0 == php_stream_rewind(SG(request_info).request_body)) {
zval **server_vars, **encoding;
+ php_stream_filter *zf = NULL;
zend_is_auto_global("_SERVER", sizeof("_SERVER")-1 TSRMLS_CC);
if (zend_hash_find(&EG(symbol_table), "_SERVER", sizeof("_SERVER"), (void **) &server_vars) == SUCCESS &&
Z_TYPE_PP(server_vars) == IS_ARRAY &&
zend_hash_find(Z_ARRVAL_PP(server_vars), "HTTP_CONTENT_ENCODING", sizeof("HTTP_CONTENT_ENCODING"), (void **) &encoding)==SUCCESS &&
Z_TYPE_PP(encoding) == IS_STRING) {
- zval func;
- zval retval;
- zval param;
- zval *params[1];
-
- if ((strcmp(Z_STRVAL_PP(encoding),"gzip") == 0 ||
- strcmp(Z_STRVAL_PP(encoding),"x-gzip") == 0) &&
- zend_hash_exists(EG(function_table), "gzinflate", sizeof("gzinflate"))) {
- ZVAL_STRING(&func, "gzinflate", 0);
- params[0] = &param;
- ZVAL_STRINGL(params[0], post_data+10, post_data_length-10, 0);
- INIT_PZVAL(params[0]);
- } else if (strcmp(Z_STRVAL_PP(encoding),"deflate") == 0 &&
- zend_hash_exists(EG(function_table), "gzuncompress", sizeof("gzuncompress"))) {
- ZVAL_STRING(&func, "gzuncompress", 0);
- params[0] = &param;
- ZVAL_STRINGL(params[0], post_data, post_data_length, 0);
- INIT_PZVAL(params[0]);
+
+ if (strcmp(Z_STRVAL_PP(encoding),"gzip") == 0
+ || strcmp(Z_STRVAL_PP(encoding),"x-gzip") == 0
+ || strcmp(Z_STRVAL_PP(encoding),"deflate") == 0
+ ) {
+ zval filter_params;
+
+ INIT_PZVAL(&filter_params);
+ array_init_size(&filter_params, 1);
+ add_assoc_long_ex(&filter_params, ZEND_STRS("window"), 0x2f); /* ANY WBITS */
+
+ zf = php_stream_filter_create("zlib.inflate", &filter_params, 0);
+ zval_dtor(&filter_params);
+
+ if (zf) {
+ php_stream_filter_append(&SG(request_info).request_body->readfilters, zf);
+ } else {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request");
+ return;
+ }
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_PP(encoding));
return;
}
- if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, 1, params TSRMLS_CC) == SUCCESS &&
- Z_TYPE(retval) == IS_STRING) {
- doc_request = soap_xmlParseMemory(Z_STRVAL(retval),Z_STRLEN(retval));
- zval_dtor(&retval);
- } else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request");
- return;
- }
- } else {
- doc_request = soap_xmlParseMemory(post_data, post_data_length);
+ }
+
+ doc_request = soap_xmlParseFile("php://input");
+
+ if (zf) {
+ php_stream_filter_remove(zf, 1);
}
} else {
zval_ptr_dtor(&retval);