ID:               36283
 Updated by:       [EMAIL PROTECTED]
 Reported By:      adam at trachtenberg dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         SOAP related
 Operating System: Mac OS X / Linux
 PHP Version:      5CVS-2006-02-04 (CVS)
 Assigned To:      dmitry


Previous Comments:
------------------------------------------------------------------------

[2006-02-06 18:14:02] adam at trachtenberg dot com

Thanks for merging the patch and for clarifying that you need to pass
the compression level.

If this is the case, I have another patch. It changes the bitmask from
0x0f to 0x09 because gzip only supports compression levels from [1-9].

http://www.trachtenberg.com/patches/soap_compression_level_patch.txt

Right now, you will get an gzip error if you pass in [10-15].

------------------------------------------------------------------------

[2006-02-06 11:13:13] [EMAIL PROTECTED]

Thank you for patch. The bug is fixed in CVS HEAD and PHP_5_1.

To compress outgoing requests just add compression level.

client = new SoapClient("some.wsdl",
  array('compression' => SOAP_COMPRESSION_ACCEPT |
SOAP_COMPRESSION_GZIP | 9));


------------------------------------------------------------------------

[2006-02-04 12:46:43] [EMAIL PROTECTED]

Assigned to the maintainer.

------------------------------------------------------------------------

[2006-02-04 12:03:25] adam at trachtenberg dot com

Description:
------------
SOAPClient compression seems broken. I see two problems.

First, the code places the Accept-Encoding and Content-Encoding HTTP
headers before the POST /path HTTP/1.1 line, which is invalid HTTP.
This causes 400 errors.

I fixed this by moving the logic for this section further down in the
function. See this patch for more details:

http://www.trachtenberg.com/patches/soap_compression_patch.txt 

It works for me, but I did not verify this is a perfect fix.

Second, it seems impossible (or just not as documented) to trigger
compression of out-going requests. I don't understand how "level" can
evaluate to > 0 given the SOAP_COMPRESSION_* constants.

Do you need to also pass a gzip compression level (0-9) as part of the
compression bit field? This is not part of the online documentation,
which says you can do this:

$client = new SoapClient("some.wsdl",
  array('compression' => SOAP_COMPRESSION_ACCEPT |
SOAP_COMPRESSION_GZIP));

This evaluates to 0x20. Inside php_http.c in the make_http_soap_request
function, it then does:

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;

  ...

  if (level > 0) {

0x20 & 0x0f evaluates to 0, so you never execute the last branch, and
no compression is used.

Furthermore, since level seems to be passed into the compression
functions as the gzip level, I don't know how that relates to the bit
field.

I tries to verify this using the unit tests, but there are none for
SOAPClient and compression.



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=36283&edit=1

Reply via email to