From 28eb53292115a77aa9dba1aa67b69a0bd3343181 Mon Sep 17 00:00:00 2001 From: Marcus Clyne Date: Sat, 9 Oct 2010 17:45:08 +0100 Subject: [PATCH] Change patches to optional, include latest Auto Lib Core --- README | 2 +- auto/build | 3 + auto/data/module_dependencies | 2 + config | 61 +++++++- ngx_auto_lib_core | 106 +++++++------- notes/VERSION | 2 +- patches/rewrite_functions | 269 ---------------------------------- patches/rewrite_phase_handler | 43 +++--- src/ndk.h | 7 +- src/ndk_conf_file.c | 2 +- 10 files changed, 139 insertions(+), 358 deletions(-) delete mode 100644 patches/rewrite_functions diff --git a/README b/README index 5a4ae64..c09b071 100644 --- a/README +++ b/README @@ -4,7 +4,7 @@ Version - 0.2.9 + 0.2.10 Synopsis diff --git a/auto/build b/auto/build index 8929e51..18c8263 100755 --- a/auto/build +++ b/auto/build @@ -33,6 +33,7 @@ srcs_dir=src include_prefix= file_prefix=ndk_ auto_file_name=config +auto_includes_name=includes conf_merge_filename=conf_merge.h conf_cmd_basic_filename=conf_cmd_basic.h @@ -565,6 +566,8 @@ function generate_all_h_files { generate_include_all_includes $out generate_dependent_includes $out + out=$output_dir/${file_prefix}$auto_includes_name.h + generate_optional_h_includes $out generate_non_optional_h_includes $out generate_auto_generated_h_includes $out $list diff --git a/auto/data/module_dependencies b/auto/data/module_dependencies index 01253bb..fd30f87 100644 --- a/auto/data/module_dependencies +++ b/auto/data/module_dependencies @@ -1,2 +1,4 @@ complex_path complex_value path +conf_file string core log +set_var expose_rewrite_functions diff --git a/config b/config index 2a1c811..74d9e7a 100644 --- a/config +++ b/config @@ -1,10 +1,27 @@ -ngx_addon_name=ngx_devel_kit -HTTP_MODULES="$HTTP_MODULES ngx_http_devel_kit_module" -HTTP_INCS="$HTTP_INCS $ngx_addon_dir/src $NGX_OBJS/addon/ndk" -NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ndk.c" -have=NDK . auto/have -. $ngx_addon_dir/ngx_auto_lib_core +################### +## NGINX VERSION ## +################### + +get_nginx_version() { + # We get the Nginx version number from the string form rather than + # nginx_version because it is available in more (every?) version + + cat src/core/nginx.h | + grep '#define NGINX_VERSION' | + sed -r \ + -e 's/[^0-9.]*([0-9.]+).*/\1/' \ + -e 's/([0-9]+\.[0-9]+\.)([0-9]{1})$/\100\2/' \ + -e 's/([0-9]+\.[0-9]+\.)([0-9]{2})$/\10\2/' \ + -e 's/\.//g' \ + -e 's/^0+(.*)/\1/' +} + +NGINX_VERSION=`get_nginx_version` + +######################## +## MACROS & FUNCTIONS ## +######################## echo "building Nginx Development Kit utility functions and macros ..." @@ -12,7 +29,35 @@ autobuild="$ngx_addon_dir/auto/build" chmod +x $autobuild $autobuild `pwd` $NGX_OBJS/addon/ndk || exit 1 +############# +## PATCHES ## +############# + echo "applying Nginx Development Kit source patches ..." -patch -Np1 < $ngx_addon_dir/patches/rewrite_functions -patch -Np1 < $ngx_addon_dir/patches/rewrite_phase_handler +patch -Np1 < $ngx_addon_dir/patches/auto_config +patch -Np1 < $ngx_addon_dir/patches/expose_rewrite_functions + +if [ $NGINX_VERSION -ge 8042 ]; then + patch -Np1 < $ngx_addon_dir/patches/rewrite_phase_handler +fi + +##################### +## CONFIG SETTINGS ## +##################### + +ngx_addon_name=ngx_devel_kit +ngx_objs_dir=$NGX_OBJS/addon/ndk + +CORE_INCS="$CORE_INCS $ngx_objs_dir" +HTTP_INCS="$HTTP_INCS $ngx_addon_dir/src $ngx_objs_dir" +HTTP_MODULES="$HTTP_MODULES ngx_http_devel_kit_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/src/ndk.c" + +have=NDK . auto/have + +############## +## INCLUDES ## +############## + +. $ngx_addon_dir/ngx_auto_lib_core \ No newline at end of file diff --git a/ngx_auto_lib_core b/ngx_auto_lib_core index de44201..d5441fb 100644 --- a/ngx_auto_lib_core +++ b/ngx_auto_lib_core @@ -20,16 +20,16 @@ ## VERSION ## ############# -ngx_auto_lib_version='0100' +ngx_auto_lib_version=1001 -if [ -z "$ngx_auto_lib_file_version" ] || [[ "$ngx_auto_lib_file_version" < "$ngx_auto_lib_version" ]]; then +if [ ! $ngx_auto_lib_file_version ] || [ $ngx_auto_lib_file_version -lt $ngx_auto_lib_version ]; then - if [ -z "$ngx_addon_dir" ]; then + if [ ! $ngx_addon_dir ]; then ngx_addon_dir=`cd $(dirname $0); pwd` fi - ngx_auto_lib_file=$ngx_addon_dir/ngx_auto_lib_core - ngx_auto_lib_file_version=$ngx_auto_lib_version + ngx_auto_lib_file="$ngx_addon_dir/ngx_auto_lib_core" + ngx_auto_lib_file_version="$ngx_auto_lib_version" fi ############### @@ -66,8 +66,8 @@ ev="$ev shared" ev="$ev test_libs" ev="$ev variables" -ngx_feature_vars=$v -ngx_feature_extra_vars=$ev +ngx_feature_vars="$v" +ngx_feature_extra_vars="$ev" ngx_feature_all_vars="$v $ev" NGX_AUTO_LIB_DEFAULT_SYSTEM_DIRS='/usr/local /usr /opt/local /opt /usr/pkg' @@ -143,12 +143,12 @@ ngx_auto_lib_get_variables() { eval NGX_AUTO_LIB_SYSTEM_DIRS=\"\$${PFX}_SYSTEM_DIR\" eval USE_NGX_AUTO_LIB=\"\$USE_${LIB}\" - if [ -z "$NGX_AUTO_LIB_DIR" ]; then + if [ ! "$NGX_AUTO_LIB_DIR" ]; then NGX_AUTO_LIB_DIR=NONE fi - if [ -z "$USE_NGX_AUTO_LIB" ]; then - if [ ! -z "$ngx_feature_check_macros_defined" -o ! -z "$ngx_feature_check_macros_non_zero" ]; then + if [ ! "$USE_NGX_AUTO_LIB" ]; then + if [ $ngx_feature_check_macros_defined -o $ngx_feature_check_macros_non_zero ]; then USE_NGX_AUTO_LIB=MAYBE elif [ "$ngx_feature_required" = no ]; then USE_NGX_AUTO_LIB=MAYBE @@ -157,13 +157,13 @@ ngx_auto_lib_get_variables() { fi fi - if [ -z "$NGX_AUTO_LIB_SYSTEM_DIRS" ]; then + if [ ! "$NGX_AUTO_LIB_SYSTEM_DIRS" ]; then NGX_AUTO_LIB_SYSTEM_DIRS=$NGX_AUTO_LIB_DEFAULT_SYSTEM_DIRS fi # TODO : add _STATIC, and do searches for both static and shared libs - if [ -z "$NGX_AUTO_LIB_SHARED" ]; then + if [ ! "$NGX_AUTO_LIB_SHARED" ]; then if [ "$ngx_feature_shared" = no ]; then NGX_AUTO_LIB_SHARED=NO else @@ -171,7 +171,6 @@ ngx_auto_lib_get_variables() { fi fi - NGX_AUTO_LIB_SEARCH_DEP=NO # set default search methods @@ -179,17 +178,17 @@ ngx_auto_lib_get_variables() { local auto=y - if [ ! -z "$NGX_AUTO_LIB_INC" ] || [ ! -z "$NGX_AUTO_LIB_LIB" ]; then + if [ "$NGX_AUTO_LIB_INC" ] || [ "$NGX_AUTO_LIB_LIB" ]; then ngx_auto_lib_search LIB_INC YES auto=n fi - if [ $NGX_AUTO_LIB_DIR != NONE ]; then + if [ "$NGX_AUTO_LIB_DIR" != NONE ]; then ngx_auto_lib_search DIR YES auto=n fi - if [ ! -z "$NGX_AUTO_LIB_BASE" ]; then + if [ "$NGX_AUTO_LIB_BASE" ]; then ngx_auto_lib_search BASE YES auto=n fi @@ -205,16 +204,15 @@ ngx_auto_lib_get_variables() { ngx_auto_lib_search PARENT NO ngx_auto_lib_search SYSTEM NO - - if [ -z "$ngx_feature_lib_names" ]; then + if [ ! "$ngx_feature_lib_names" ]; then ngx_feature_lib_names=$pfx fi - if [ -z "$ngx_feature_inc_names" ]; then + if [ ! "$ngx_feature_inc_names" ]; then ngx_feature_inc_names=$ngx_feature_lib_names fi - if [ -z "$ngx_feature_exit_if_not_found" ]; then + if [ ! "$ngx_feature_exit_if_not_found" ]; then ngx_feature_exit_if_not_found=yes fi } @@ -224,16 +222,20 @@ ngx_auto_lib_get_variables() { ####################### ngx_auto_lib_set_default() { + local suffix= if [ $1 ]; then suffix="_$1" fi + local def=$2 local var="NGX_AUTO_LIB$suffix" - if [ -z ${!var} ]; then + val= + if [ ! `eval echo '$'$var` ]; then eval $var=\"$def\" fi + #eval echo "$var = \$$var" } @@ -312,20 +314,24 @@ ngx_auto_lib_check_auto_config() { } ngx_auto_lib_check_macro_defined() { - NL=$'\n' for m in $@; do - ngx_auto_lib_check_auto_config "$m" "#ifndef ${m}${NL} rubbish${NL} #endif${NL}" && return 0 + ngx_auto_lib_check_auto_config "$m" " + #ifndef $m + rubbish + #endif" && return 0 done return 1 } ngx_auto_lib_check_macro_non_zero() { - NL=$'\n' for m in $@; do - ngx_auto_lib_check_auto_config "$m" "#if !(${m})${NL} rubbish${NL} #endif${NL}" && return 0 + ngx_auto_lib_check_auto_config "$m" " + #if !($m) + rubbish + #endif" && return 0 done return 1 @@ -343,7 +349,7 @@ ngx_auto_lib_check_require() { # check if the libraries are required elsewhere for l in $ngx_feature_lib_names; do - [ -n "`echo $CORE_LIBS $ADDON_LIBS | grep -w -- -l$l`" ] && return 0 + [ ! "`echo $CORE_LIBS $ADDON_LIBS | grep -w -- -l$l`" ] && return 0 done @@ -353,7 +359,7 @@ ngx_auto_lib_check_require() { local d=$ngx_feature_check_macros_defined local nz=$ngx_feature_check_macros_non_zero - if [ ! -z "$d" ] || [ ! -z "$nz" ]; then + if [ "$d" ] || [ "$nz" ]; then ngx_auto_lib_check_macro_defined $d && return 0 ngx_auto_lib_check_macro_non_zero $nz && return 0 @@ -392,7 +398,7 @@ ngx_auto_lib_test_setup() { ngx_auto_lib_reset_feature_vars - if [ -z "$ngx_feature_path" ]; then + if [ ! "$ngx_feature_path" ]; then ngx_feature_path="$INC" fi @@ -405,16 +411,17 @@ ngx_auto_lib_test_setup() { local inc= local lib= - local incs=$ngx_feature_inc_names - local libs=$ngx_feature_lib_names - local lib_files=$ngx_feature_lib_files + local incs="$ngx_feature_inc_names" + local libs="$ngx_feature_lib_names" + local lib_files="$ngx_feature_lib_files" for inc in $incs; do - ngx_feature_incs="${ngx_feature_incs}#include <$inc.h>"$'\n' + ngx_feature_incs="$ngx_feature_incs +#include <$inc.h>" done - if [ -z "$ngx_feature_libs" ]; then + if [ ! "$ngx_feature_libs" ]; then if [ $NGX_AUTO_LIB_SHARED = YES ]; then if [ $NGX_RPATH = YES ]; then @@ -461,8 +468,9 @@ ngx_auto_lib_test_setup() { local test=" for l in $libs; do o="'\`ldd '$NGX_AUTOTEST' | grep '$LIB'/lib\$l\\.so\`; - if [ -z \"\$o\" ]; then + if [ ! \"\$o\" ]; then chmod -x $NGX_AUTOTEST; + echo Linker does not link to correct version else chmod +x $NGX_AUTOTEST; fi @@ -568,14 +576,14 @@ ngx_auto_lib_test_install_dirs() { ngx_auto_lib_run_tests() { - local name=$ngx_auto_lib_name - local pfx=$ngx_auto_lib_pfx - local PFX=$NGX_AUTO_LIB_PFX - local INC=$NGX_AUTO_LIB_INC - local LIB=$NGX_AUTO_LIB_LIB - local DIR=$NGX_AUTO_LIB_DIR - local BASE=$NGX_AUTO_LIB_BASE - local MSG=$NGX_AUTO_LIB_MSG + local name="$ngx_auto_lib_name" + local pfx="$ngx_auto_lib_pfx" + local PFX="$NGX_AUTO_LIB_PFX" + local INC="$NGX_AUTO_LIB_INC" + local LIB="$NGX_AUTO_LIB_LIB" + local DIR="$NGX_AUTO_LIB_DIR" + local BASE="$NGX_AUTO_LIB_BASE" + local MSG="$NGX_AUTO_LIB_MSG" ngx_found=no @@ -596,7 +604,7 @@ ngx_auto_lib_run_tests() { fi - # path specified by ${!PFX} (e.g. $OPENSSL, $PCRE) + # path specified by ${PFX} (e.g. $OPENSSL, $PCRE) # Note : these will be set automatically by configure for OpenSSL, PCRE, Zlib etc # TODO : change to searching more than one path @@ -612,9 +620,9 @@ ngx_auto_lib_run_tests() { p=$NGX_AUTO_LIB_SEARCH_BASE_PREFIX if [ "$p" = YES ]; then - p="-name $pfx-*" - elif [ ! -z "$p" ]; then - p="-name $p*" + p="!ame $pfx-*" + elif [ "$p" ]; then + p="!ame $p*" fi ngx_auto_lib_test_dirs " (found under \$${PFX}_BASE)" \ @@ -627,7 +635,7 @@ ngx_auto_lib_run_tests() { if [ $NGX_AUTO_LIB_SEARCH_PARENT = YES ]; then local src_dir=`cd ..; pwd` ngx_auto_lib_test_dirs " (found under Nginx source parent dir)" \ - `find $src_dir/* -maxdepth 0 -type d -name $pfx-* 2> /dev/null | sort -r` && return 0 + `find $src_dir/* -maxdepth 0 -type d !ame $pfx-* 2> /dev/null | sort -r` && return 0 fi @@ -645,9 +653,7 @@ ngx_auto_lib_run_tests() { ####################### ngx_auto_lib_run() { - ngx_auto_lib_get_variables - eval AUTO_$NGX_AUTO_LIB_PFX=NO ngx_auto_lib_check_require || return @@ -749,7 +755,7 @@ ngx_auto_lib_finalize_core() { ngx_auto_lib_set_core_variables ngx_auto_lib_set_generic_variables - if [ ! -z "$ngx_feature_variables" ]; then + if [ "$ngx_feature_variables" ]; then eval $ngx_feature_variables fi diff --git a/notes/VERSION b/notes/VERSION index 1866a36..d156ab4 100644 --- a/notes/VERSION +++ b/notes/VERSION @@ -1 +1 @@ -0.2.9 +0.2.10 \ No newline at end of file diff --git a/patches/rewrite_functions b/patches/rewrite_functions deleted file mode 100644 index 22b9d18..0000000 --- a/patches/rewrite_functions +++ /dev/null @@ -1,269 +0,0 @@ -diff -rNpU8 a/src/http/modules/ngx_http_rewrite_module.c b/src/http/modules/ngx_http_rewrite_module.c ---- a/src/http/modules/ngx_http_rewrite_module.c 2010-06-18 16:15:20.000000000 +0100 -+++ b/src/http/modules/ngx_http_rewrite_module.c 2010-09-18 23:54:34.000000000 +0100 -@@ -1,48 +1,33 @@ - - /* - * Copyright (C) Igor Sysoev -+ * -+ * Note : this file has been patched by the Nginx Development Kit - */ - - - #include - #include - #include - - --typedef struct { -- ngx_array_t *codes; /* uintptr_t */ -- -- ngx_uint_t stack_size; -- -- ngx_flag_t log; -- ngx_flag_t uninitialized_variable_warn; --} ngx_http_rewrite_loc_conf_t; -- -- - static void *ngx_http_rewrite_create_loc_conf(ngx_conf_t *cf); - static char *ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf, - void *parent, void *child); - static ngx_int_t ngx_http_rewrite_init(ngx_conf_t *cf); - static char *ngx_http_rewrite(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); - static char *ngx_http_rewrite_return(ngx_conf_t *cf, ngx_command_t *cmd, - void *conf); - static char *ngx_http_rewrite_break(ngx_conf_t *cf, ngx_command_t *cmd, - void *conf); --static char *ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, -- void *conf); --static char * ngx_http_rewrite_if_condition(ngx_conf_t *cf, -- ngx_http_rewrite_loc_conf_t *lcf); --static char *ngx_http_rewrite_variable(ngx_conf_t *cf, -- ngx_http_rewrite_loc_conf_t *lcf, ngx_str_t *value); - static char *ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, - void *conf); --static char * ngx_http_rewrite_value(ngx_conf_t *cf, -- ngx_http_rewrite_loc_conf_t *lcf, ngx_str_t *value); -+ - - - static ngx_command_t ngx_http_rewrite_commands[] = { - - { ngx_string("rewrite"), - NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF - |NGX_CONF_TAKE23, - ngx_http_rewrite, -@@ -174,17 +159,17 @@ ngx_http_rewrite_handler(ngx_http_reques - if (r->err_status == 0) { - return e->status; - } - - return r->err_status; - } - - --static ngx_int_t -+ngx_int_t - ngx_http_rewrite_var(ngx_http_request_t *r, ngx_http_variable_value_t *v, - uintptr_t data) - { - ngx_http_variable_t *var; - ngx_http_core_main_conf_t *cmcf; - ngx_http_rewrite_loc_conf_t *rlcf; - - rlcf = ngx_http_get_module_loc_conf(r, ngx_http_rewrite_module); -@@ -506,17 +491,17 @@ ngx_http_rewrite_break(ngx_conf_t *cf, n - } - - *code = ngx_http_script_break_code; - - return NGX_CONF_OK; - } - - --static char * -+char * - ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) - { - ngx_http_rewrite_loc_conf_t *lcf = conf; - - void *mconf; - char *rv; - u_char *elts; - ngx_uint_t i; -@@ -622,17 +607,17 @@ ngx_http_rewrite_if(ngx_conf_t *cf, ngx_ - /* the code array belong to parent block */ - - nlcf->codes = NULL; - - return NGX_CONF_OK; - } - - --static char * -+char * - ngx_http_rewrite_if_condition(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf) - { - u_char *p; - size_t len; - ngx_str_t *value; - ngx_uint_t cur, last; - ngx_regex_compile_t rc; - ngx_http_script_code_pt *code; -@@ -842,17 +827,17 @@ ngx_http_rewrite_if_condition(ngx_conf_t - - ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, - "invalid condition \"%V\"", &value[cur]); - - return NGX_CONF_ERROR; - } - - --static char * -+char * - ngx_http_rewrite_variable(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, - ngx_str_t *value) - { - ngx_int_t index; - ngx_http_script_var_code_t *var_code; - - value->len--; - value->data++; -@@ -943,17 +928,17 @@ ngx_http_rewrite_set(ngx_conf_t *cf, ngx - - vcode->code = ngx_http_script_set_var_code; - vcode->index = (uintptr_t) index; - - return NGX_CONF_OK; - } - - --static char * -+char * - ngx_http_rewrite_value(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, - ngx_str_t *value) - { - ngx_int_t n; - ngx_http_script_compile_t sc; - ngx_http_script_value_code_t *val; - ngx_http_script_complex_value_code_t *complex; - -diff -rNpU8 a/src/http/modules/ngx_http_rewrite_module.h b/src/http/modules/ngx_http_rewrite_module.h ---- a/src/http/modules/ngx_http_rewrite_module.h 1970-01-01 01:00:00.000000000 +0100 -+++ b/src/http/modules/ngx_http_rewrite_module.h 2010-09-19 00:51:27.000000000 +0100 -@@ -0,0 +1,45 @@ -+ -+/* -+ * Copyright (C) Marcus Clyne -+ * -+ * Note : this file has been created by the Nginx Development Kit using -+ * some code from ngx_http_rewrite_module.c -+ */ -+ -+ -+#ifndef _NGX_HTTP_REWRITE_H_INCLUDED_ -+#define _NGX_HTTP_REWRITE_H_INCLUDED_ -+ -+#include -+#include -+#include -+ -+ -+extern ngx_module_t ngx_http_rewrite_module; -+ -+ -+typedef struct { -+ ngx_array_t *codes; /* uintptr_t */ -+ -+ ngx_uint_t stack_size; -+ -+ ngx_flag_t log; -+ ngx_flag_t uninitialized_variable_warn; -+} ngx_http_rewrite_loc_conf_t; -+ -+ -+char * -+ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); -+char * -+ngx_http_rewrite_if_condition(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf); -+char * -+ngx_http_rewrite_variable(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, -+ ngx_str_t *value); -+char * -+ngx_http_rewrite_value(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, -+ ngx_str_t *value); -+ngx_int_t -+ngx_http_rewrite_var(ngx_http_request_t *r, ngx_http_variable_value_t *v, -+ uintptr_t data); -+ -+#endif -diff -rNpU8 a/src/http/ngx_http.h b/src/http/ngx_http.h ---- a/src/http/ngx_http.h 2010-06-15 16:13:34.000000000 +0100 -+++ b/src/http/ngx_http.h 2010-09-18 23:49:54.000000000 +0100 -@@ -27,16 +27,17 @@ typedef u_char *(*ngx_http_log_handler_p - #include - #include - #include - #include - #include - #include - #include - #include -+#include - - #if (NGX_HTTP_CACHE) - #include - #endif - #if (NGX_HTTP_SSI) - #include - #endif - #if (NGX_HTTP_SSL) -diff -rNpU8 a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c ---- a/src/http/ngx_http_script.c 2010-09-02 15:37:16.000000000 +0100 -+++ b/src/http/ngx_http_script.c 2010-09-19 01:41:22.000000000 +0100 -@@ -21,19 +21,17 @@ static ngx_int_t ngx_http_script_add_cap - ngx_uint_t n); - #endif - static ngx_int_t - ngx_http_script_add_full_name_code(ngx_http_script_compile_t *sc); - static size_t ngx_http_script_full_name_len_code(ngx_http_script_engine_t *e); - static void ngx_http_script_full_name_code(ngx_http_script_engine_t *e); - - --#define ngx_http_script_exit (u_char *) &ngx_http_script_exit_code -- --static uintptr_t ngx_http_script_exit_code = (uintptr_t) NULL; -+uintptr_t ngx_http_script_exit_code = (uintptr_t) NULL; - - - void - ngx_http_script_flush_complex_value(ngx_http_request_t *r, - ngx_http_complex_value_t *val) - { - ngx_uint_t *index; - -diff -rNpU8 a/src/http/ngx_http_script.h b/src/http/ngx_http_script.h ---- a/src/http/ngx_http_script.h 2010-09-02 15:37:16.000000000 +0100 -+++ b/src/http/ngx_http_script.h 2010-09-19 01:41:38.000000000 +0100 -@@ -8,16 +8,21 @@ - #define _NGX_HTTP_SCRIPT_H_INCLUDED_ - - - #include - #include - #include - - -+#define ngx_http_script_exit (u_char *) &ngx_http_script_exit_code -+ -+extern uintptr_t ngx_http_script_exit_code; -+ -+ - typedef struct { - u_char *ip; - u_char *pos; - ngx_http_variable_value_t *sp; - - ngx_str_t buf; - ngx_str_t line; - diff --git a/patches/rewrite_phase_handler b/patches/rewrite_phase_handler index 79a2a46..bd5161f 100644 --- a/patches/rewrite_phase_handler +++ b/patches/rewrite_phase_handler @@ -1,24 +1,19 @@ -diff -p -r -U 8 a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c ---- a/src/http/ngx_http_core_module.c 2010-09-02 15:02:57.000000000 +0100 -+++ b/src/http/ngx_http_core_module.c 2010-09-18 22:18:01.000000000 +0100 -@@ -905,16 +905,20 @@ ngx_http_core_rewrite_phase(ngx_http_req - - rc = ph->handler(r); - - if (rc == NGX_DECLINED) { - r->phase_handler++; - return NGX_AGAIN; - } - -+ if (rc == NGX_AGAIN || rc == NGX_DONE) { -+ return NGX_OK; -+ } -+ - /* rc == NGX_OK || rc == NGX_ERROR || rc == NGX_HTTP_... */ - - ngx_http_finalize_request(r, rc); - - return NGX_OK; - } - - +diff -p -r a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c +*** a/src/http/ngx_http_core_module.c 2010-09-27 12:48:12.000000000 +0100 +--- b/src/http/ngx_http_core_module.c 2010-10-09 13:44:09.000000000 +0100 +*************** ngx_http_core_rewrite_phase(ngx_http_req +*** 910,915 **** +--- 910,922 ---- + return NGX_AGAIN; + } + ++ #if defined(nginx_version) && nginx_version >= 8042 && (NDK_REWRITE_PHASE) ++ ++ if (rc == NGX_AGAIN || rc == NGX_DONE) { ++ return NGX_OK; ++ } ++ ++ #endif + /* rc == NGX_OK || rc == NGX_ERROR || rc == NGX_HTTP_... */ + + ngx_http_finalize_request(r, rc); diff --git a/src/ndk.h b/src/ndk.h index 7ca622e..528b59a 100644 --- a/src/ndk.h +++ b/src/ndk.h @@ -13,8 +13,8 @@ #include -#define ndk_version 2003 -#define NDK_VERSION "0.2.3" +#define ndk_version 2010 +#define NDK_VERSION "0.2.10" #if !(NDK) @@ -22,7 +22,6 @@ the source (add --with-module=/path/to/devel/kit/src to configure command) #endif - -#include +#include #endif diff --git a/src/ndk_conf_file.c b/src/ndk_conf_file.c index a58ac6b..8ae6660 100644 --- a/src/ndk_conf_file.c +++ b/src/ndk_conf_file.c @@ -117,7 +117,7 @@ ndk_conf_set_num64_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_conf_post_t *post; - np = (ngx_int_t *) (p + cmd->offset); + np = (int64_t *) (p + cmd->offset); if (*np != NGX_CONF_UNSET) { return "is duplicate";