|
|
c4323e |
From cdd650c95faeeed01ad88c199a5f51bd6e03c49e Mon Sep 17 00:00:00 2001
|
|
|
c4323e |
From: "Hongli Lai (Phusion)" <hongli@phusion.nl>
|
|
|
c4323e |
Date: Fri, 2 Jan 2015 14:57:10 +0100
|
|
|
c4323e |
Subject: [PATCH] Fix compatibility with Nginx 1.7.9
|
|
|
c4323e |
|
|
|
c4323e |
Closes GH-1335.
|
|
|
c4323e |
---
|
|
|
c4323e |
CHANGELOG | 1 +
|
|
|
c4323e |
ext/nginx/Configuration.c | 85 ++++++++++++++++++++++++++++++++++++++---------
|
|
|
c4323e |
2 files changed, 70 insertions(+), 16 deletions(-)
|
|
|
c4323e |
|
|
|
c4323e |
diff --git a/ext/nginx/Configuration.c b/ext/nginx/Configuration.c
|
|
|
c4323e |
index 94b19dc..6d594d9 100644
|
|
|
c4323e |
--- a/ext/nginx/Configuration.c
|
|
|
c4323e |
+++ b/ext/nginx/Configuration.c
|
|
|
c4323e |
@@ -268,7 +268,11 @@ passenger_create_loc_conf(ngx_conf_t *cf)
|
|
|
c4323e |
conf->upstream_config.pass_request_body = NGX_CONF_UNSET;
|
|
|
c4323e |
|
|
|
c4323e |
#if (NGX_HTTP_CACHE)
|
|
|
c4323e |
- conf->upstream_config.cache = NGX_CONF_UNSET_PTR;
|
|
|
c4323e |
+ #if NGINX_VERSION_NUM >= 1007009
|
|
|
c4323e |
+ conf->upstream_config.cache = NGX_CONF_UNSET_PTR;
|
|
|
c4323e |
+ #else
|
|
|
c4323e |
+ conf->upstream_config.cache = NGX_CONF_UNSET;
|
|
|
c4323e |
+ #endif
|
|
|
c4323e |
conf->upstream_config.cache_min_uses = NGX_CONF_UNSET_UINT;
|
|
|
c4323e |
conf->upstream_config.cache_bypass = NGX_CONF_UNSET_PTR;
|
|
|
c4323e |
conf->upstream_config.no_cache = NGX_CONF_UNSET_PTR;
|
|
|
c4323e |
@@ -277,6 +281,9 @@ passenger_create_loc_conf(ngx_conf_t *cf)
|
|
|
c4323e |
conf->upstream_config.cache_lock = NGX_CONF_UNSET;
|
|
|
c4323e |
conf->upstream_config.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
|
|
|
c4323e |
#endif
|
|
|
c4323e |
+ #if NGINX_VERSION_NUM >= 1007008
|
|
|
c4323e |
+ conf->upstream_config.cache_lock_age = NGX_CONF_UNSET_MSEC;
|
|
|
c4323e |
+ #endif
|
|
|
c4323e |
#endif
|
|
|
c4323e |
|
|
|
c4323e |
conf->upstream_config.intercept_errors = NGX_CONF_UNSET;
|
|
|
c4323e |
@@ -382,15 +389,34 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
|
c4323e |
/******************************/
|
|
|
c4323e |
/******************************/
|
|
|
c4323e |
|
|
|
c4323e |
- if (conf->upstream_config.store != 0) {
|
|
|
c4323e |
- ngx_conf_merge_value(conf->upstream_config.store,
|
|
|
c4323e |
- prev->upstream_config.store, 0);
|
|
|
c4323e |
+ #if (NGX_HTTP_CACHE) && NGINX_VERSION_NUM >= 1007009
|
|
|
c4323e |
+ if (conf->upstream_config.store > 0) {
|
|
|
c4323e |
+ conf->upstream_config.cache = 0;
|
|
|
c4323e |
+ }
|
|
|
c4323e |
+ if (conf->upstream_config.cache > 0) {
|
|
|
c4323e |
+ conf->upstream_config.store = 0;
|
|
|
c4323e |
+ }
|
|
|
c4323e |
+ #endif
|
|
|
c4323e |
+
|
|
|
c4323e |
+ #if NGINX_VERSION_NUM >= 1007009
|
|
|
c4323e |
+ if (conf->upstream_config.store == NGX_CONF_UNSET) {
|
|
|
c4323e |
+ ngx_conf_merge_value(conf->upstream_config.store,
|
|
|
c4323e |
+ prev->upstream_config.store, 0);
|
|
|
c4323e |
|
|
|
c4323e |
- if (conf->upstream_config.store_lengths == NULL) {
|
|
|
c4323e |
conf->upstream_config.store_lengths = prev->upstream_config.store_lengths;
|
|
|
c4323e |
conf->upstream_config.store_values = prev->upstream_config.store_values;
|
|
|
c4323e |
}
|
|
|
c4323e |
- }
|
|
|
c4323e |
+ #else
|
|
|
c4323e |
+ if (conf->upstream_config.store != 0) {
|
|
|
c4323e |
+ ngx_conf_merge_value(conf->upstream_config.store,
|
|
|
c4323e |
+ prev->upstream_config.store, 0);
|
|
|
c4323e |
+
|
|
|
c4323e |
+ if (conf->upstream_config.store_lengths == NULL) {
|
|
|
c4323e |
+ conf->upstream_config.store_lengths = prev->upstream_config.store_lengths;
|
|
|
c4323e |
+ conf->upstream_config.store_values = prev->upstream_config.store_values;
|
|
|
c4323e |
+ }
|
|
|
c4323e |
+ }
|
|
|
c4323e |
+ #endif
|
|
|
c4323e |
|
|
|
c4323e |
ngx_conf_merge_uint_value(conf->upstream_config.store_access,
|
|
|
c4323e |
prev->upstream_config.store_access, 0600);
|
|
|
c4323e |
@@ -554,20 +580,42 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
|
c4323e |
|
|
|
c4323e |
#if (NGX_HTTP_CACHE)
|
|
|
c4323e |
|
|
|
c4323e |
- ngx_conf_merge_ptr_value(conf->upstream_config.cache,
|
|
|
c4323e |
- prev->upstream_config.cache, NULL);
|
|
|
c4323e |
+ #if NGINX_VERSION_NUM >= 1007009
|
|
|
c4323e |
+ if (conf->upstream_config.cache == NGX_CONF_UNSET) {
|
|
|
c4323e |
+ ngx_conf_merge_value(conf->upstream_config.cache,
|
|
|
c4323e |
+ prev->upstream_config.cache, 0);
|
|
|
c4323e |
|
|
|
c4323e |
- if (conf->upstream_config.cache && conf->upstream_config.cache->data == NULL) {
|
|
|
c4323e |
- ngx_shm_zone_t *shm_zone;
|
|
|
c4323e |
+ conf->upstream_config.cache_zone = prev->upstream_config.cache_zone;
|
|
|
c4323e |
+ conf->upstream_config.cache_value = prev->upstream_config.cache_value;
|
|
|
c4323e |
+ }
|
|
|
c4323e |
|
|
|
c4323e |
- shm_zone = conf->upstream_config.cache;
|
|
|
c4323e |
+ if (conf->upstream_config.cache_zone && conf->upstream_config.cache_zone->data == NULL) {
|
|
|
c4323e |
+ ngx_shm_zone_t *shm_zone;
|
|
|
c4323e |
|
|
|
c4323e |
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
c4323e |
- "\"scgi_cache\" zone \"%V\" is unknown",
|
|
|
c4323e |
- &shm_zone->shm.name);
|
|
|
c4323e |
+ shm_zone = conf->upstream_config.cache_zone;
|
|
|
c4323e |
|
|
|
c4323e |
- return NGX_CONF_ERROR;
|
|
|
c4323e |
- }
|
|
|
c4323e |
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
c4323e |
+ "\"scgi_cache\" zone \"%V\" is unknown",
|
|
|
c4323e |
+ &shm_zone->shm.name);
|
|
|
c4323e |
+
|
|
|
c4323e |
+ return NGX_CONF_ERROR;
|
|
|
c4323e |
+ }
|
|
|
c4323e |
+ #else
|
|
|
c4323e |
+ ngx_conf_merge_ptr_value(conf->upstream_config.cache,
|
|
|
c4323e |
+ prev->upstream_config.cache, NULL);
|
|
|
c4323e |
+
|
|
|
c4323e |
+ if (conf->upstream_config.cache && conf->upstream_config.cache->data == NULL) {
|
|
|
c4323e |
+ ngx_shm_zone_t *shm_zone;
|
|
|
c4323e |
+
|
|
|
c4323e |
+ shm_zone = conf->upstream_config.cache;
|
|
|
c4323e |
+
|
|
|
c4323e |
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
|
|
c4323e |
+ "\"scgi_cache\" zone \"%V\" is unknown",
|
|
|
c4323e |
+ &shm_zone->shm.name);
|
|
|
c4323e |
+
|
|
|
c4323e |
+ return NGX_CONF_ERROR;
|
|
|
c4323e |
+ }
|
|
|
c4323e |
+ #endif
|
|
|
c4323e |
|
|
|
c4323e |
ngx_conf_merge_uint_value(conf->upstream_config.cache_min_uses,
|
|
|
c4323e |
prev->upstream_config.cache_min_uses, 1);
|
|
|
c4323e |
@@ -613,6 +661,11 @@ passenger_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
|
c4323e |
prev->upstream_config.cache_lock_timeout, 5000);
|
|
|
c4323e |
#endif
|
|
|
c4323e |
|
|
|
c4323e |
+ #if NGINX_VERSION_NUM >= 1007008
|
|
|
c4323e |
+ ngx_conf_merge_msec_value(conf->upstream_config.cache_lock_age,
|
|
|
c4323e |
+ prev->upstream_config.cache_lock_age, 5000);
|
|
|
c4323e |
+ #endif
|
|
|
c4323e |
+
|
|
|
c4323e |
#endif
|
|
|
c4323e |
|
|
|
c4323e |
ngx_conf_merge_value(conf->upstream_config.pass_request_headers,
|
|
|
c4323e |
diff --git a/ext/nginx/Configuration.c b/ext/nginx/Configuration.c
|
|
|
c4323e |
index b357dcb..762bf44 100644
|
|
|
c4323e |
--- a/ext/nginx/Configuration.c
|
|
|
c4323e |
+++ b/ext/nginx/Configuration.c
|
|
|
c4323e |
@@ -310,9 +310,9 @@ passenger_create_loc_conf(ngx_conf_t *cf)
|
|
|
c4323e |
|
|
|
c4323e |
#if (NGX_HTTP_CACHE)
|
|
|
c4323e |
#if NGINX_VERSION_NUM >= 1007009
|
|
|
c4323e |
- conf->upstream_config.cache = NGX_CONF_UNSET_PTR;
|
|
|
c4323e |
- #else
|
|
|
c4323e |
conf->upstream_config.cache = NGX_CONF_UNSET;
|
|
|
c4323e |
+ #else
|
|
|
c4323e |
+ conf->upstream_config.cache = NGX_CONF_UNSET_PTR;
|
|
|
c4323e |
#endif
|
|
|
c4323e |
conf->upstream_config.cache_min_uses = NGX_CONF_UNSET_UINT;
|
|
|
c4323e |
conf->upstream_config.cache_bypass = NGX_CONF_UNSET_PTR;
|