@@ -0,0 +1,184 @@
+From bf6cd93f2098b59260de8d494f0f4b1f11a84627 Mon Sep 17 00:00:00 2001
+From: Weibin Yao <yaoweibin@gmail.com>
+Date: Fri, 27 Feb 2015 23:13:30 +0800
+Subject: [PATCH] fixed the compatible problem with nginx-1.7.9+
+
+---
+ ngx_http_ajp.h | 1 +
+ ngx_http_ajp_module.c | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 86 insertions(+)
+
+diff --git a/ngx_http_ajp.h b/ngx_http_ajp.h
+index 72502ad..b3c7051 100644
+--- a/ngx_http_ajp.h
++++ b/ngx_http_ajp.h
+@@ -5,6 +5,7 @@
+ #include <ngx_config.h>
+ #include <ngx_core.h>
+ #include <ngx_http.h>
++#include <nginx.h>
+ #include "ngx_http_ajp_module.h"
+
+ #define AJP13_DEF_HOST "127.0.0.1"
+diff --git a/ngx_http_ajp_module.c b/ngx_http_ajp_module.c
+index e4d5b00..be32459 100644
+--- a/ngx_http_ajp_module.c
++++ b/ngx_http_ajp_module.c
+@@ -464,8 +464,12 @@ ngx_http_ajp_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+
+ #if (NGX_HTTP_CACHE)
+
++#if (nginx_version >= 1007009)
++ if (alcf->upstream.cache > 0)
++#else
+ if (alcf->upstream.cache != NGX_CONF_UNSET_PTR
+ && alcf->upstream.cache != NULL)
++#endif
+ {
+ return "is incompatible with \"ajp_cache\"";
+ }
+@@ -534,15 +538,27 @@ ngx_http_ajp_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+ ngx_http_ajp_loc_conf_t *alcf = conf;
+
+ ngx_str_t *value;
++#if (nginx_version >= 1007009)
++ ngx_http_complex_value_t cv;
++ ngx_http_compile_complex_value_t ccv;
++#endif
+
+ value = cf->args->elts;
+
++#if (nginx_version >= 1007009)
++ if (alcf->upstream.cache != NGX_CONF_UNSET) {
++#else
+ if (alcf->upstream.cache != NGX_CONF_UNSET_PTR) {
++#endif
+ return "is duplicate";
+ }
+
+ if (ngx_strcmp(value[1].data, "off") == 0) {
++#if (nginx_version >= 1007009)
++ alcf->upstream.cache = 0;
++#else
+ alcf->upstream.cache = NULL;
++#endif
+ return NGX_CONF_OK;
+ }
+
+@@ -550,11 +566,44 @@ ngx_http_ajp_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+ return "is incompatible with \"ajp_store\"";
+ }
+
++#if (nginx_version >= 1007009)
++ alcf->upstream.cache = 1;
++
++ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
++
++ ccv.cf = cf;
++ ccv.value = &value[1];
++ ccv.complex_value = &cv;
++
++ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
++ return NGX_CONF_ERROR;
++ }
++
++ if (cv.lengths != NULL) {
++
++ alcf->upstream.cache_value = ngx_palloc(cf->pool,
++ sizeof(ngx_http_complex_value_t));
++ if (alcf->upstream.cache_value == NULL) {
++ return NGX_CONF_ERROR;
++ }
++
++ *alcf->upstream.cache_value = cv;
++
++ return NGX_CONF_OK;
++ }
++
++ alcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0,
++ &ngx_http_ajp_module);
++ if (alcf->upstream.cache_zone == NULL) {
++ return NGX_CONF_ERROR;
++ }
++#else
+ alcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0,
+ &ngx_http_ajp_module);
+ if (alcf->upstream.cache == NULL) {
+ return NGX_CONF_ERROR;
+ }
++#endif
+
+ return NGX_CONF_OK;
+ }
+@@ -666,7 +715,11 @@ ngx_http_ajp_create_loc_conf(ngx_conf_t *cf)
+ conf->upstream.pass_request_body = NGX_CONF_UNSET;
+
+ #if (NGX_HTTP_CACHE)
++#if (nginx_version >= 1007009)
++ conf->upstream.cache = NGX_CONF_UNSET;
++#else
+ conf->upstream.cache = NGX_CONF_UNSET_PTR;
++#endif
+ conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
+ conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
+ conf->upstream.cache_lock = NGX_CONF_UNSET;
+@@ -699,6 +752,18 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
+ ngx_str_t *h;
+ ngx_hash_init_t hash;
+
++#if (NGX_HTTP_CACHE) && (nginx_version >= 1007009)
++
++ if (conf->upstream.store > 0) {
++ conf->upstream.cache = 0;
++ }
++
++ if (conf->upstream.cache > 0) {
++ conf->upstream.store = 0;
++ }
++
++#endif
++
+ if (conf->upstream.store != 0) {
+ ngx_conf_merge_value(conf->upstream.store,
+ prev->upstream.store, 0);
+@@ -864,6 +929,20 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
+
+ #if (NGX_HTTP_CACHE)
+
++#if (nginx_version >= 1007009)
++ if (conf->upstream.cache == NGX_CONF_UNSET) {
++ ngx_conf_merge_value(conf->upstream.cache,
++ prev->upstream.cache, 0);
++
++ conf->upstream.cache_zone = prev->upstream.cache_zone;
++ conf->upstream.cache_value = prev->upstream.cache_value;
++ }
++
++ if (conf->upstream.cache_zone && conf->upstream.cache_zone->data == NULL) {
++ ngx_shm_zone_t *shm_zone;
++
++ shm_zone = conf->upstream.cache_zone;
++#else
+ ngx_conf_merge_ptr_value(conf->upstream.cache,
+ prev->upstream.cache, NULL);
+
+@@ -871,6 +950,7 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
+ ngx_shm_zone_t *shm_zone;
+
+ shm_zone = conf->upstream.cache;
++#endif
+
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "\"ajp_cache\" zone \"%V\" is unknown, "
+@@ -910,6 +990,11 @@ ngx_http_ajp_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
+ conf->cache_key = prev->cache_key;
+ }
+
++ if (conf->upstream.cache && conf->cache_key.value.data == NULL) {
++ ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
++ "no \"fastcgi_cache_key\" for \"fastcgi_cache\"");
++ }
++
+ ngx_conf_merge_value(conf->upstream.cache_lock,
+ prev->upstream.cache_lock, 0);
+
|