pollita Wed Nov 19 16:10:34 2003 EDT
Modified files:
/php-src/ext/standard head.c head.h basic_functions.c
/php-src NEWS
Log:
New function: headers_list(). Ennumerate headers sent to SAPI engine
Index: php-src/ext/standard/head.c
diff -u php-src/ext/standard/head.c:1.71 php-src/ext/standard/head.c:1.72
--- php-src/ext/standard/head.c:1.71 Wed Aug 20 16:51:10 2003
+++ php-src/ext/standard/head.c Wed Nov 19 16:10:29 2003
@@ -15,7 +15,7 @@
| Author: Rasmus Lerdorf <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: head.c,v 1.71 2003/08/20 20:51:10 bfrance Exp $ */
+/* $Id: head.c,v 1.72 2003/11/19 21:10:29 pollita Exp $ */
#include <stdio.h>
@@ -223,6 +223,33 @@
}
/* }}} */
+/* {{{ php_head_apply_header_list_to_hash
+ Turn an llist of sapi_header_struct headers into a numerically indexed zval hash */
+static void php_head_apply_header_list_to_hash(void *data, void *arg TSRMLS_DC)
+{
+ sapi_header_struct *sapi_header = (sapi_header_struct *)data;
+
+ if (arg && sapi_header) {
+ add_next_index_string((zval *)arg, (char *)(sapi_header->header), 1);
+ }
+}
+
+/* {{{ proto string headers_list(void)
+ Return list of headers to be sent / already sent */
+PHP_FUNCTION(headers_list)
+{
+ if (ZEND_NUM_ARGS() > 0) {
+ WRONG_PARAM_COUNT;
+ }
+
+ if (!&SG(sapi_headers).headers) {
+ RETURN_FALSE;
+ }
+ array_init(return_value);
+ zend_llist_apply_with_argument(&SG(sapi_headers).headers,
php_head_apply_header_list_to_hash, return_value);
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
Index: php-src/ext/standard/head.h
diff -u php-src/ext/standard/head.h:1.25 php-src/ext/standard/head.h:1.26
--- php-src/ext/standard/head.h:1.25 Wed Aug 20 16:51:10 2003
+++ php-src/ext/standard/head.h Wed Nov 19 16:10:29 2003
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: head.h,v 1.25 2003/08/20 20:51:10 bfrance Exp $ */
+/* $Id: head.h,v 1.26 2003/11/19 21:10:29 pollita Exp $ */
#ifndef HEAD_H
#define HEAD_H
@@ -26,6 +26,7 @@
PHP_FUNCTION(setcookie);
PHP_FUNCTION(setrawcookie);
PHP_FUNCTION(headers_sent);
+PHP_FUNCTION(headers_list);
PHPAPI int php_header(TSRMLS_D);
PHPAPI int php_setcookie(char *name, int name_len, char *value, int value_len, time_t
expires, char *path, int path_len, char *domain, int domain_len, int secure, int
url_encode TSRMLS_DC);
Index: php-src/ext/standard/basic_functions.c
diff -u php-src/ext/standard/basic_functions.c:1.641
php-src/ext/standard/basic_functions.c:1.642
--- php-src/ext/standard/basic_functions.c:1.641 Fri Nov 14 17:55:54 2003
+++ php-src/ext/standard/basic_functions.c Wed Nov 19 16:10:29 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: basic_functions.c,v 1.641 2003/11/14 22:55:54 iliaa Exp $ */
+/* $Id: basic_functions.c,v 1.642 2003/11/19 21:10:29 pollita Exp $ */
#include "php.h"
#include "php_streams.h"
@@ -620,6 +620,7 @@
PHP_FE(setrawcookie,
NULL)
PHP_FE(header,
NULL)
PHP_FE(headers_sent, first_and_second__args_force_ref)
+ PHP_FE(headers_list,
NULL)
PHP_FE(connection_aborted,
NULL)
PHP_FE(connection_status,
NULL)
Index: php-src/NEWS
diff -u php-src/NEWS:1.1499 php-src/NEWS:1.1500
--- php-src/NEWS:1.1499 Fri Nov 14 17:55:53 2003
+++ php-src/NEWS Wed Nov 19 16:10:33 2003
@@ -4,6 +4,7 @@
- Added new functions:
. dba_key_split() to split inifile keys in an array. (Marcus)
. time_nanosleep() signal safe sleep (Magnus, Ilia)
+ . headers_list(). (Sara)
- Fixed bug #26072 (--disable-libxml does not work). (Jani)
- Fixed bug #26083 (Non-working write support in ext/dom). (Ilia)
- Fixed bug #24394 (Serializing cross-referenced objects causes segfault).
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php