From bc12f5ca71a53c836bec24b94d929487b18f938d Mon Sep 17 00:00:00 2001 From: Eric Covener Date: Mon, 2 Sep 2013 17:06:16 +0000 Subject: [PATCH] register LuaOutputFilters with AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1519476 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 5 +++++ modules/lua/mod_lua.c | 8 ++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/CHANGES b/CHANGES index a7a5d58141..5864a31af2 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,11 @@ -*- coding: utf-8 -*- Changes with Apache 2.5.0 + *) mod_lua: Register LuaOutputFilter scripts as changing the content and + content-length by default, when run my mod_filter. Previously, + growing or shrinking a response that started with Content-Length set + would require mod_filter and FilterProtocol change=yes. + *) mod_filter: Add "change=no" as a proto-flag to FilterProtocol to remove a providers initial flags set at registration time. [Eric Covener] diff --git a/modules/lua/mod_lua.c b/modules/lua/mod_lua.c index 4d5d762427..4efe0e6dba 100644 --- a/modules/lua/mod_lua.c +++ b/modules/lua/mod_lua.c @@ -318,7 +318,10 @@ static apr_status_t lua_setup_filter_ctx(ap_filter_t* f, request_rec* r, lua_fil ctx = apr_pcalloc(r->pool, sizeof(lua_filter_ctx)); ctx->broken = 0; *c = ctx; - /* Find the filter that was called */ + /* Find the filter that was called. + * XXX: If we were wired with mod_filter, the filter (mod_filters name) + * and the provider (our underlying filters name) need to have matched. + */ for (n = 0; n < cfg->mapped_filters->nelts; n++) { ap_lua_filter_handler_spec *hook_spec = ((ap_lua_filter_handler_spec **) cfg->mapped_filters->elts)[n]; @@ -1083,7 +1086,8 @@ static const char *register_filter_function_hook(const char *filter, /* TODO: Make it work on other types than just AP_FTYPE_RESOURCE? */ if (direction == AP_LUA_FILTER_OUTPUT) { spec->direction = AP_LUA_FILTER_OUTPUT; - ap_register_output_filter(filter, lua_output_filter_handle, NULL, AP_FTYPE_RESOURCE); + ap_register_output_filter_protocol(filter, lua_output_filter_handle, NULL, AP_FTYPE_RESOURCE, + AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH); } else { spec->direction = AP_LUA_FILTER_INPUT;