1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
--TEST--
Test curl_setopt() with CURLOPT_ACCEPT_ENCODING
--EXTENSIONS--
curl
--FILE--
<?php
include 'server.inc';
$host = curl_cli_server_start();
$ch = curl_init();
$url = "{$host}/get.inc?test=";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, "gzip");
curl_setopt($ch, CURLINFO_HEADER_OUT, 1);
// First execution, with gzip accept
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HEADER_OUT);
// Second execution, with the encoding accept disabled
curl_setopt($ch, CURLOPT_ACCEPT_ENCODING, NULL);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_HEADER_OUT);
curl_close($ch);
?>
--EXPECTF--
GET /get.inc?test= HTTP/1.1
Host: %s
Accept: */*
Accept-Encoding: gzip
GET /get.inc?test= HTTP/1.1
Host: %s
Accept: */*
|