php_stream *log = php_stream_open_wrapper(file, "ab", REPORT_ERRORS|ENFORCE_SAFE_MODE, NULL); \
\
if (log) { \
- php_stream_printf(log TSRMLS_CC, "%s [%12s] %32s <%s>%s", datetime, type, msg, SG(request_info).request_uri, PHP_EOL); \
+ php_stream_printf(log TSRMLS_CC, "%s\t[%s]\t%s\t<%s>%s", datetime, type, msg, SG(request_info).request_uri, PHP_EOL); \
php_stream_close(log); \
} \
\
?>
--FILE--
<?php
+include 'log.inc';
+log_prepare(_AMETH_LOG);
ini_set('http.allowed_methods', 'POST');
echo "Done\n";
?>
--- /dev/null
+--TEST--
+logging allowed methods
+--SKIPIF--
+include 'skip.inc';
+checkcgi();
+--ENV--
+HTTP_HOST=example.com
+--FILE--
+<?php
+echo "-TEST\n";
+include 'log.inc';
+log_content(_AMETH_LOG);
+echo "Done";
+?>
+--EXPECTF--
+%sTEST
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [405-ALLOWED] Allow: POST <%s>
+Done
?>
--FILE--
<?php
+include 'log.inc';
+log_prepare(_REDIR_LOG);
http_redirect('redirect', array('a' => 1, 'b' => 2));
?>
--EXPECTF--
--- /dev/null
+--TEST--
+logging redirects
+--SKIPIF--
+include 'skip.inc';
+checkcgi();
+--ENV--
+HTTP_HOST=example.com
+--FILE--
+<?php
+echo "-TEST\n";
+include 'log.inc';
+log_content(_REDIR_LOG);
+echo "Done";
+?>
+--EXPECTF--
+%sTEST
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s>
+Done
?>
--FILE--
<?php
+include 'log.inc';
+log_prepare(_REDIR_LOG);
session_start();
http_redirect('redirect', array('a' => 1), true);
?>
--- /dev/null
+--TEST--
+logging redirects
+--SKIPIF--
+include 'skip.inc';
+checkcgi();
+--ENV--
+HTTP_HOST=example.com
+--FILE--
+<?php
+echo "-TEST\n";
+include 'log.inc';
+log_content(_REDIR_LOG);
+echo "Done";
+?>
+--EXPECTF--
+%sTEST
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [302-REDIRECT] Location: http%s <%s>
+Done
?>
--FILE--
<?php
+include 'log.inc';
+log_prepare(_REDIR_LOG);
http_redirect('redirect', null, false, true);
?>
--EXPECTF--
--- /dev/null
+--TEST--
+logging redirects
+--SKIPIF--
+include 'skip.inc';
+checkcgi();
+--ENV--
+HTTP_HOST=example.com
+--FILE--
+<?php
+echo "-TEST\n";
+include 'log.inc';
+log_content(_REDIR_LOG);
+echo "Done";
+?>
+--EXPECTF--
+%sTEST
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [301-REDIRECT] Location: http%s <%s>
+Done
HTTP_IF_NONE_MATCH="0bee89b07a248e27c83fc3d5951213c1"
--FILE--
<?php
+include 'log.inc';
+log_prepare(_CACHE_LOG);
http_cache_etag();
http_send_data("abc\n");
?>
--- /dev/null
+--TEST--
+logging caching
+--SKIPIF--
+include 'skip.inc';
+checkcgi();
+--ENV--
+HTTP_HOST=example.com
+--FILE--
+<?php
+echo "-TEST\n";
+include 'log.inc';
+log_content(_CACHE_LOG);
+echo "Done";
+?>
+--EXPECTF--
+%sTEST
+%d%d%d%d-%d%d-%d%d %d%d:%d%d:%d%d [304-CACHE] ETag: "%s" <%s>
+Done