1
0
mirror of https://github.com/mrclay/minify.git synced 2025-01-17 13:18:13 +01:00

use block comment for better (future) git annotate

This commit is contained in:
Elan Ruusamäe 2015-11-22 22:06:33 +02:00
parent 8d1f4ad765
commit fe359bbf8a

View File

@ -63,86 +63,88 @@ assertTrue(
); );
// TODO: rework this // TODO: rework this
//function _test_environment_getHello($url) /*
//{ function _test_environment_getHello($url)
// $fp = fopen($url, 'r', false, stream_context_create(array( {
// 'http' => array( $fp = fopen($url, 'r', false, stream_context_create(array(
// 'method' => "GET", 'http' => array(
// 'timeout' => '10', 'method' => "GET",
// 'header' => "Accept-Encoding: deflate, gzip\r\n", 'timeout' => '10',
// ) 'header' => "Accept-Encoding: deflate, gzip\r\n",
// ))); )
// $meta = stream_get_meta_data($fp); )));
// $encoding = ''; $meta = stream_get_meta_data($fp);
// $length = 0; $encoding = '';
// foreach ($meta['wrapper_data'] as $i => $header) { $length = 0;
// if (preg_match('@^Content-Length:\\s*(\\d+)$@i', $header, $m)) { foreach ($meta['wrapper_data'] as $i => $header) {
// $length = $m[1]; if (preg_match('@^Content-Length:\\s*(\\d+)$@i', $header, $m)) {
// } elseif (preg_match('@^Content-Encoding:\\s*(\\S+)$@i', $header, $m)) { $length = $m[1];
// if ($m[1] !== 'identity') { } elseif (preg_match('@^Content-Encoding:\\s*(\\S+)$@i', $header, $m)) {
// $encoding = $m[1]; if ($m[1] !== 'identity') {
// } $encoding = $m[1];
// } }
// } }
// $streamContents = stream_get_contents($fp); }
// fclose($fp); $streamContents = stream_get_contents($fp);
// fclose($fp);
// if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
// if ($length != 6) { if (__FILE__ === realpath($_SERVER['SCRIPT_FILENAME'])) {
// echo "\nReturned content should be 6 bytes and not HTTP encoded.\n" if ($length != 6) {
// . "Headers returned by: {$url}\n\n"; echo "\nReturned content should be 6 bytes and not HTTP encoded.\n"
// var_export($meta['wrapper_data']); . "Headers returned by: {$url}\n\n";
// echo "\n\n"; var_export($meta['wrapper_data']);
// } echo "\n\n";
// } }
// }
// return array(
// 'length' => $length return array(
// ,'encoding' => $encoding 'length' => $length
// ,'bytes' => $streamContents ,'encoding' => $encoding
// ); ,'bytes' => $streamContents
//} );
// }
//$thisUrl = 'http://'
// . $_SERVER['HTTP_HOST'] // avoid redirects when SERVER_NAME doesn't match $thisUrl = 'http://'
// . ('80' === $_SERVER['SERVER_PORT'] ? '' : ":{$_SERVER['SERVER_PORT']}") . $_SERVER['HTTP_HOST'] // avoid redirects when SERVER_NAME doesn't match
// . dirname($_SERVER['REQUEST_URI']) . ('80' === $_SERVER['SERVER_PORT'] ? '' : ":{$_SERVER['SERVER_PORT']}")
// . '/test_environment.php'; . dirname($_SERVER['REQUEST_URI'])
// . '/test_environment.php';
//$oc = @file_get_contents($thisUrl . '?getOutputCompression=1');
// $oc = @file_get_contents($thisUrl . '?getOutputCompression=1');
//if (false === $oc || ! preg_match('/^[01]$/', $oc)) {
// echo "!---: environment : Local HTTP request failed. Testing cannot continue.\n"; if (false === $oc || ! preg_match('/^[01]$/', $oc)) {
// return; echo "!---: environment : Local HTTP request failed. Testing cannot continue.\n";
//} return;
//if ('1' === $oc) { }
// echo "!---: environment : zlib.output_compression is enabled in php.ini" if ('1' === $oc) {
// . " or .htaccess.\n"; echo "!---: environment : zlib.output_compression is enabled in php.ini"
//} . " or .htaccess.\n";
// }
//$testJs = _test_environment_getHello($thisUrl . '?hello=js');
//$passed = assertTrue( $testJs = _test_environment_getHello($thisUrl . '?hello=js');
// $testJs['length'] == 6 $passed = assertTrue(
// ,'environment : PHP/server should not auto-encode application/x-javascript output' $testJs['length'] == 6
//); ,'environment : PHP/server should not auto-encode application/x-javascript output'
// );
//$testCss = _test_environment_getHello($thisUrl . '?hello=css');
//$passed = $passed && assertTrue( $testCss = _test_environment_getHello($thisUrl . '?hello=css');
// $testCss['length'] == 6 $passed = $passed && assertTrue(
// ,'environment : PHP/server should not auto-encode text/css output' $testCss['length'] == 6
// ); ,'environment : PHP/server should not auto-encode text/css output'
// );
//$testHtml = _test_environment_getHello($thisUrl . '?hello=html');
//$passed = $passed && assertTrue( $testHtml = _test_environment_getHello($thisUrl . '?hello=html');
// $testHtml['length'] == 6 $passed = $passed && assertTrue(
// ,'environment : PHP/server should not auto-encode text/html output' $testHtml['length'] == 6
// ); ,'environment : PHP/server should not auto-encode text/html output'
// );
//if (! $passed) {
// $testFake = _test_environment_getHello($thisUrl . '?hello=faketype'); if (! $passed) {
// if ($testFake['length'] == 6) { $testFake = _test_environment_getHello($thisUrl . '?hello=faketype');
// echo " environment : Server does not auto-encode arbitrary types. This\n" if ($testFake['length'] == 6) {
// . " may indicate that the auto-encoding is caused by Apache's\n" echo " environment : Server does not auto-encode arbitrary types. This\n"
// . " AddOutputFilterByType."; . " may indicate that the auto-encoding is caused by Apache's\n"
// } . " AddOutputFilterByType.";
//} }
}
*/