Index: php_http.c =================================================================== RCS file: /repository/php-src/ext/soap/php_http.c,v retrieving revision 1.77.2.6 diff -u -r1.77.2.6 php_http.c --- php_http.c 1 Jan 2006 12:50:13 -0000 1.77.2.6 +++ php_http.c 4 Feb 2006 10:44:08 -0000 @@ -17,7 +17,7 @@ | Dmitry Stogov | +----------------------------------------------------------------------+ */ -/* $Id: php_http.c,v 1.77.2.6 2006/01/01 12:50:13 sniper Exp $ */ +/* $Id: php_http.c,v 1.83 2006/01/01 13:09:53 sniper Exp $ */ #include "php_soap.h" #include "ext/standard/base64.h" @@ -244,49 +244,6 @@ 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 ((Z_LVAL_PP(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { - smart_str_append_const(&soap_headers,"Accept-Encoding: gzip, deflate\r\n"); - } - if (level > 0) { - zval func; - zval retval; - zval param1, param2, param3; - 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); - if (kind == SOAP_COMPRESSION_DEFLATE) { - n = 2; - ZVAL_STRING(&func, "gzcompress", 0); - smart_str_append_const(&soap_headers,"Content-Encoding: deflate\r\n"); - } else { - n = 3; - ZVAL_STRING(&func, "gzencode", 0); - smart_str_append_const(&soap_headers,"Content-Encoding: gzip\r\n"); - ZVAL_LONG(params[2], 1); - } - if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS && - Z_TYPE(retval) == IS_STRING) { - request = Z_STRVAL(retval); - request_size = Z_STRLEN(retval); - } else { - if (request != buf) {efree(request);} - return FALSE; - } - } - } if (zend_hash_find(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"), (void **)&tmp) == SUCCESS) { php_stream_from_zval_no_verify(stream,tmp); @@ -436,6 +393,51 @@ smart_str_append_const(&soap_headers, "\"\r\n"); } } + + /* 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 ((Z_LVAL_PP(tmp) & SOAP_COMPRESSION_ACCEPT) != 0) { + smart_str_append_const(&soap_headers,"Accept-Encoding: gzip, deflate\r\n"); + } + if (level > 0) { + zval func; + zval retval; + zval param1, param2, param3; + 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); + if (kind == SOAP_COMPRESSION_DEFLATE) { + n = 2; + ZVAL_STRING(&func, "gzcompress", 0); + smart_str_append_const(&soap_headers,"Content-Encoding: deflate\r\n"); + } else { + n = 3; + ZVAL_STRING(&func, "gzencode", 0); + smart_str_append_const(&soap_headers,"Content-Encoding: gzip\r\n"); + ZVAL_LONG(params[2], 1); + } + if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, n, params TSRMLS_CC) == SUCCESS && + Z_TYPE(retval) == IS_STRING) { + request = Z_STRVAL(retval); + request_size = Z_STRLEN(retval); + } else { + if (request != buf) {efree(request);} + return FALSE; + } + } + } + smart_str_append_const(&soap_headers,"Content-Length: "); smart_str_append_long(&soap_headers, request_size); smart_str_append_const(&soap_headers, "\r\n");