From:             Julian_bond at voidstar dot com
Operating system: Redhat 7.3 and MS Win
PHP version:      4.3.2
PHP Bug Type:     cURL related
Bug description:  cURL CURLOPT_ENCODING does not appear to work

Description:
------------
Redhat/7.3 php/4.3.2 libcurl/7.10.5 OpenSSL/0.9.6b zlib/1.1.4
MS Win php/4.3.2 libcurl/7.10.5 OpenSSL/0.9.7b
MS Win php/4.3.3RC1 libcurl/7.10.5 OpenSSL/0.9.7b

See also:
http://bugs.php.net/bug.php?id=23048
http://bugs.php.net/bug.php?id=21995
http://bugs.php.net/bug.php?id=23702

According to the libcurl docuentation, 
  curl_setopt ($ch, CURLOPT_ENCODING,"");
should generate a header 
  HTTP_ACCEPT_ENCODING: gzip,deflate 
And then autodecode the returned data if the remote server supports
compression. However in the above three PHP releases it never does.
Reading the three bug reports above, it appears that support for this
option call may have been added to php 4.3.2 and so the problem is
currently viewed as a documentation problem. However after repeated tests,
it still appears to be missing from either php and/or libcurl and hence
this bug report. The libcurl crew deny responsibility(!) and point at the
php implementation. Using curl from the command line with the --compressed
option I can see the header and auto-decoding working but I don't have the
facilities to check the libcurl library except from inside php.

The libcurl readme
http://cvs.php.net/co.php/curl/lib/README.encoding?r=1.3
says that "The library zlib is required for this feature." but as can be
seen above from the version report, php_curl.dll for windows does not
appear to bind the zlib library, so even if the parameter option is being
passed to libcurl, it probably wouldn't work anyway.

Reproduce code:
---------------
  $ch = curl_init("http://www.voidstar.com/temp/accept.php";);
  curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt ($ch, CURLOPT_ENCODING,"");
  curl_setopt ($ch, CURLOPT_HEADER, 1);

  $data = curl_exec($ch);

  curl_close ($ch);

  print "<pre>" . htmlentities($data) . "</pre>";


Expected result:
----------------
http://www.voidstar.com/temp/accept.php prints the headers it receives.
It's running on a server with zlib support compiled into php and
zlib.output_compression = on This can be seen by using a browser that
supports gzip to navigate to the url above. In this case the header can be
seen.

The reproduce code above should generate the accept_encoding header which
should then result in it being mirrored back to curl which then displays
it.

 HTTP_ACCEPT_ENCODING: gzip,deflate

Actual result:
--------------
Missing header
 HTTP_ACCEPT_ENCODING: gzip,deflate

-- 
Edit bug report at http://bugs.php.net/?id=24725&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=24725&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=24725&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=24725&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=24725&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=24725&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=24725&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=24725&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=24725&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=24725&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=24725&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=24725&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24725&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=24725&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=24725&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=24725&r=gnused

Reply via email to