Репозиторий Sisyphus
Последнее обновление: 1 октября 2023 | Пакетов: 18631 | Посещений: 37886628
en ru br
Репозитории ALT
5.1: 5.2.14.20100721-alt0.M51.1
4.1: 5.2.5-alt1.M41.3
4.0: 5.2.2-alt1
3.0: 5.0.5-alt0.cvs20050729
www.altlinux.org/Changes

Группа :: Разработка/Прочее
Пакет: php5

 Главная   Изменения   Спек   Патчи   Sources   Загрузить   Gear   Bugs and FR  Repocop 

Патч: php5-apache2-filters.patch
Скачать


 Description: Enables mod_php to manually add apache output filters
 Author: Paul Querna
 URL: http://www.outoforder.cc/projects/apache/mod_transform/patches/php5-apache2-filters.patch
      http://www.outoforder.cc/presentations/apachecon2004/mod_transform/tu19_mod_transform_slides.pdf
 
--- sapi/apache2handler/php_functions.c	2005-08-03 16:08:48.000000000 +0200
+++ sapi/apache2handler/php_functions.c.oden	2005-12-26 10:18:18.000000000 +0100
@@ -213,6 +213,65 @@
 }
 /* }}} */
 
+/* {{{ proto array apache_get_output_filters()
+   Get All Active Output filters */
+PHP_FUNCTION(apache_get_output_filters)
+{
+       ap_filter_t* ff;
+       php_struct *ctx;
+
+       if (ZEND_NUM_ARGS() != 0) {
+               WRONG_PARAM_COUNT;
+       }
+
+       if(array_init(return_value) != SUCCESS)
+       {
+               RETURN_NULL();
+       }
+
+       ctx = SG(server_context);
+
+       ff = ctx->r->output_filters;
+
+       do {
+               add_next_index_string(return_value, ff->frec->name, 1);
+               ff = ff->next ;
+       } while (ff);
+
+}
+/* }}} */
+
+/* {{{ proto bool apache_add_output_filter(string filter_name)
+   Add an output filter to this request */
+PHP_FUNCTION(apache_add_output_filter)
+{
+       php_struct *ctx;
+       int arg_count = ZEND_NUM_ARGS();
+       zval **filter_name;
+       ap_filter_rec_t* ap_filter;
+
+       if (arg_count != 1 ||
+               zend_get_parameters_ex(arg_count, &filter_name) == FAILURE) {
+               WRONG_PARAM_COUNT;
+       }
+
+       ctx = SG(server_context);
+
+       convert_to_string_ex(filter_name);
+
+        ap_filter = ap_get_output_filter_handle(Z_STRVAL_PP(filter_name));
+
+        /* requested output filter was not found */
+       if(ap_filter == NULL) {
+               RETURN_FALSE;
+       }
+       else {
+               ap_add_output_filter_handle(ap_filter, NULL, ctx->r, ctx->r->connection);
+               RETURN_TRUE;
+       }
+}
+/* }}} */
+
 /* {{{ proto string apache_note(string note_name [, string note_value])
    Get and set Apache request notes */
 PHP_FUNCTION(apache_note)
@@ -465,6 +524,8 @@
 static function_entry apache_functions[] = {
 	PHP_FE(apache_lookup_uri, NULL)
 	PHP_FE(virtual, NULL) 
+	PHP_FE(apache_get_output_filters, NULL)
+	PHP_FE(apache_add_output_filter, NULL)
 	PHP_FE(apache_request_headers, NULL)
 	PHP_FE(apache_response_headers, NULL)
 	PHP_FE(apache_setenv, NULL)
 
дизайн и разработка: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
текущий майнтейнер: Michael Shigorin