Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 509d6c5becc5037830e176131ca9868986ee3bb3 Mon Sep 17 00:00:00 2001
- From: Wandenberg Peixoto <wandenberg@gmail.com>
- Date: Tue, 29 Nov 2011 13:53:11 -0200
- Subject: [PATCH] adding parameter to purge cache by groups
- ---
- README.md | 44 ++++++++-
- ngx_cache_purge_module.c | 175 +++++++++++++++++++++++++++++----
- t/proxy.t | 247 +++++++++++++++++++++++++++++++++++++++++++++-
- 3 files changed, 443 insertions(+), 23 deletions(-)
- diff --git a/README.md b/README.md
- index fd06a7e..cb2e583 100644
- --- a/README.md
- +++ b/README.md
- @@ -25,38 +25,53 @@ Configuration directives
- ========================
- fastcgi_cache_purge
- -------------------
- -* **syntax**: `fastcgi_cache_purge zone_name key`
- +* **syntax**: `fastcgi_cache_purge zone_name key [group_key]`
- * **default**: `none`
- * **context**: `location`
- Sets area and key used for purging selected pages from `FastCGI`'s cache.
- +Group key is an optional parameter representing the group of cached files. Has to be set with the same value used on `proxy_cache_key` directive.
- proxy_cache_purge
- -----------------
- -* **syntax**: `proxy_cache_purge zone_name key`
- +* **syntax**: `proxy_cache_purge zone_name key [group_key]`
- * **default**: `none`
- * **context**: `location`
- Sets area and key used for purging selected pages from `proxy`'s cache.
- +Group key is an optional parameter representing the group of cached files. Has to be set with the same value used on `proxy_cache_key` directive.
- scgi_cache_purge
- ----------------
- -* **syntax**: `scgi_cache_purge zone_name key`
- +* **syntax**: `scgi_cache_purge zone_name key [group_key]`
- * **default**: `none`
- * **context**: `location`
- Sets area and key used for purging selected pages from `SCGI`'s cache.
- +Group key is an optional parameter representing the group of cached files. Has to be set with the same value used on `proxy_cache_key` directive.
- uwsgi_cache_purge
- -----------------
- -* **syntax**: `uwsgi_cache_purge zone_name key`
- +* **syntax**: `uwsgi_cache_purge zone_name key [group_key]`
- * **default**: `none`
- * **context**: `location`
- Sets area and key used for purging selected pages from `uWSGI`'s cache.
- +Group key is an optional parameter representing the group of cached files. Has to be set with the same value used on `proxy_cache_key` directive.
- +
- +
- +group_clean_cache_purge
- +-----------------------
- +* **syntax**: `group_clean_cache_purge eval_to_number`
- +* **default**: `0`
- +* **context**: `location`
- +
- +Sets a value to be evaluated to a number, if `0` only the page which match the key and group key is purged, otherwise all pages cached with the group key are purged from cache.
- +May use headers, arguments or any other variable or a fixed value.
- +
- Sample configuration
- @@ -80,6 +95,27 @@ Sample configuration
- }
- +Group configuration
- +===================
- + http {
- + proxy_cache_path /tmp/cache keys_zone=tmpcache:10m;
- +
- + server {
- + location / {
- + proxy_pass http://127.0.0.1:8000;
- + proxy_cache tmpcache;
- + proxy_cache_key $uri$is_args$args $arg_group-$host;
- + }
- +
- + location ~ /purge(/.*) {
- + allow 127.0.0.1;
- + deny all;
- + proxy_cache_purge tmpcache $1$is_args$args $arg_group-$host;
- + group_clean_cache_purge "$http_x_group_clean";
- + }
- + }
- + }
- +
- Testing
- =======
- `ngx_cache_purge` comes with complete test suite based on [Test::Nginx](http://github.com/agentzh/test-nginx).
- diff --git a/ngx_cache_purge_module.c b/ngx_cache_purge_module.c
- index f30112e..32dfc6f 100644
- --- a/ngx_cache_purge_module.c
- +++ b/ngx_cache_purge_module.c
- @@ -60,16 +60,26 @@ ngx_int_t ngx_http_uwsgi_cache_purge_handler(ngx_http_request_t *r);
- # endif /* NGX_HTTP_UWSGI */
- ngx_int_t ngx_http_cache_purge_init(ngx_http_request_t *r,
- - ngx_http_file_cache_t *cache, ngx_http_complex_value_t *cache_key);
- + ngx_http_file_cache_t *cache, ngx_http_complex_value_t *cache_key, ngx_http_complex_value_t *cache_group_key);
- void ngx_http_cache_purge_handler(ngx_http_request_t *r);
- ngx_int_t ngx_http_file_cache_purge(ngx_http_request_t *r);
- +static void *ngx_http_cache_purge_create_loc_conf(ngx_conf_t *cf);
- +
- +static char *ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf,
- + void *parent, void *child);
- +
- +typedef struct {
- + ngx_http_complex_value_t *cache_group_clean;
- +} ngx_http_cache_purge_loc_conf_t;
- +
- +
- static ngx_command_t ngx_http_cache_purge_module_commands[] = {
- # if (NGX_HTTP_FASTCGI)
- { ngx_string("fastcgi_cache_purge"),
- - NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- + NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
- ngx_http_fastcgi_cache_purge_conf,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- @@ -78,7 +88,7 @@ static ngx_command_t ngx_http_cache_purge_module_commands[] = {
- # if (NGX_HTTP_PROXY)
- { ngx_string("proxy_cache_purge"),
- - NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- + NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
- ngx_http_proxy_cache_purge_conf,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- @@ -87,7 +97,7 @@ static ngx_command_t ngx_http_cache_purge_module_commands[] = {
- # if (NGX_HTTP_SCGI)
- { ngx_string("scgi_cache_purge"),
- - NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- + NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
- ngx_http_scgi_cache_purge_conf,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- @@ -96,13 +106,20 @@ static ngx_command_t ngx_http_cache_purge_module_commands[] = {
- # if (NGX_HTTP_UWSGI)
- { ngx_string("uwsgi_cache_purge"),
- - NGX_HTTP_LOC_CONF|NGX_CONF_TAKE2,
- + NGX_HTTP_LOC_CONF|NGX_CONF_TAKE23,
- ngx_http_uwsgi_cache_purge_conf,
- NGX_HTTP_LOC_CONF_OFFSET,
- 0,
- NULL },
- # endif /* NGX_HTTP_UWSGI */
- + { ngx_string("group_clean_cache_purge"),
- + NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
- + ngx_http_set_complex_value_slot,
- + NGX_HTTP_LOC_CONF_OFFSET,
- + offsetof(ngx_http_cache_purge_loc_conf_t, cache_group_clean),
- + NULL },
- +
- ngx_null_command
- };
- @@ -116,8 +133,8 @@ static ngx_http_module_t ngx_http_cache_purge_module_ctx = {
- NULL, /* create server configuration */
- NULL, /* merge server configuration */
- - NULL, /* create location configuration */
- - NULL /* merge location configuration */
- + ngx_http_cache_purge_create_loc_conf, /* create location configuration */
- + ngx_http_cache_purge_merge_loc_conf /* merge location configuration */
- };
- ngx_module_t ngx_http_cache_purge_module = {
- @@ -172,6 +189,7 @@ typedef struct {
- # endif /* nginx_version >= 8040 */
- ngx_http_complex_value_t cache_key;
- + ngx_http_complex_value_t cache_group_key;
- # if (NGX_PCRE)
- ngx_regex_t *split_regex;
- @@ -183,7 +201,7 @@ char *
- ngx_http_fastcgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
- {
- - ngx_http_compile_complex_value_t ccv;
- + ngx_http_compile_complex_value_t ccv, group_ccv;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_fastcgi_loc_conf_t *flcf;
- ngx_str_t *value;
- @@ -225,6 +243,19 @@ ngx_http_fastcgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd,
- return NGX_CONF_ERROR;
- }
- + if (cf->args->nelts > 3) {
- + /* set proxy_cache_group_key part */
- + ngx_memzero(&group_ccv, sizeof(ngx_http_compile_complex_value_t));
- +
- + group_ccv.cf = cf;
- + group_ccv.value = &value[3];
- + group_ccv.complex_value = &flcf->cache_group_key;
- +
- + if (ngx_http_compile_complex_value(&group_ccv) != NGX_OK) {
- + return NGX_CONF_ERROR;
- + }
- + }
- +
- /* set handler */
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- @@ -241,7 +272,7 @@ ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r)
- flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
- if (ngx_http_cache_purge_init(r, flcf->upstream.cache->data,
- - &flcf->cache_key)
- + &flcf->cache_key, &flcf->cache_group_key)
- != NGX_OK)
- {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- @@ -295,6 +326,7 @@ typedef struct {
- ngx_str_t url;
- ngx_http_complex_value_t cache_key;
- + ngx_http_complex_value_t cache_group_key;
- ngx_http_proxy_vars_t vars;
- @@ -307,7 +339,7 @@ typedef struct {
- char *
- ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- {
- - ngx_http_compile_complex_value_t ccv;
- + ngx_http_compile_complex_value_t ccv, group_ccv;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_proxy_loc_conf_t *plcf;
- ngx_str_t *value;
- @@ -349,6 +381,19 @@ ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- return NGX_CONF_ERROR;
- }
- + if (cf->args->nelts > 3) {
- + /* set proxy_cache_group_key part */
- + ngx_memzero(&group_ccv, sizeof(ngx_http_compile_complex_value_t));
- +
- + group_ccv.cf = cf;
- + group_ccv.value = &value[3];
- + group_ccv.complex_value = &plcf->cache_group_key;
- +
- + if (ngx_http_compile_complex_value(&group_ccv) != NGX_OK) {
- + return NGX_CONF_ERROR;
- + }
- + }
- +
- /* set handler */
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- @@ -365,7 +410,7 @@ ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r)
- plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module);
- if (ngx_http_cache_purge_init(r, plcf->upstream.cache->data,
- - &plcf->cache_key)
- + &plcf->cache_key, &plcf->cache_group_key)
- != NGX_OK)
- {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- @@ -399,12 +444,13 @@ typedef struct {
- ngx_array_t *scgi_values;
- ngx_http_complex_value_t cache_key;
- + ngx_http_complex_value_t cache_group_key;
- } ngx_http_scgi_loc_conf_t;
- char *
- ngx_http_scgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- {
- - ngx_http_compile_complex_value_t ccv;
- + ngx_http_compile_complex_value_t ccv, group_ccv;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_scgi_loc_conf_t *slcf;
- ngx_str_t *value;
- @@ -446,6 +492,19 @@ ngx_http_scgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- return NGX_CONF_ERROR;
- }
- + if (cf->args->nelts > 3) {
- + /* set proxy_cache_group_key part */
- + ngx_memzero(&group_ccv, sizeof(ngx_http_compile_complex_value_t));
- +
- + group_ccv.cf = cf;
- + group_ccv.value = &value[3];
- + group_ccv.complex_value = &slcf->cache_group_key;
- +
- + if (ngx_http_compile_complex_value(&group_ccv) != NGX_OK) {
- + return NGX_CONF_ERROR;
- + }
- + }
- +
- /* set handler */
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- @@ -462,7 +521,7 @@ ngx_http_scgi_cache_purge_handler(ngx_http_request_t *r)
- slcf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module);
- if (ngx_http_cache_purge_init(r, slcf->upstream.cache->data,
- - &slcf->cache_key)
- + &slcf->cache_key, &slcf->cache_group_key)
- != NGX_OK)
- {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- @@ -496,6 +555,7 @@ typedef struct {
- ngx_array_t *uwsgi_values;
- ngx_http_complex_value_t cache_key;
- + ngx_http_complex_value_t cache_group_key;
- ngx_str_t uwsgi_string;
- @@ -506,7 +566,7 @@ typedef struct {
- char *
- ngx_http_uwsgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- {
- - ngx_http_compile_complex_value_t ccv;
- + ngx_http_compile_complex_value_t ccv, group_ccv;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_uwsgi_loc_conf_t *ulcf;
- ngx_str_t *value;
- @@ -548,6 +608,19 @@ ngx_http_uwsgi_cache_purge_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
- return NGX_CONF_ERROR;
- }
- + if (cf->args->nelts > 3) {
- + /* set proxy_cache_group_key part */
- + ngx_memzero(&group_ccv, sizeof(ngx_http_compile_complex_value_t));
- +
- + group_ccv.cf = cf;
- + group_ccv.value = &value[3];
- + group_ccv.complex_value = &ulcf->cache_group_key;
- +
- + if (ngx_http_compile_complex_value(&group_ccv) != NGX_OK) {
- + return NGX_CONF_ERROR;
- + }
- + }
- +
- /* set handler */
- clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
- @@ -564,7 +637,7 @@ ngx_http_uwsgi_cache_purge_handler(ngx_http_request_t *r)
- ulcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
- if (ngx_http_cache_purge_init(r, ulcf->upstream.cache->data,
- - &ulcf->cache_key)
- + &ulcf->cache_key, &ulcf->cache_group_key)
- != NGX_OK)
- {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- @@ -585,16 +658,20 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r)
- {
- ngx_chain_t out;
- ngx_buf_t *b;
- - ngx_str_t *key;
- + ngx_str_t *key, *group_key;
- ngx_int_t rc;
- size_t len;
- key = r->cache->keys.elts;
- + group_key = r->cache->group_keys.elts;
- len = sizeof(ngx_http_cache_purge_success_page_top) - 1
- + sizeof(ngx_http_cache_purge_success_page_tail) - 1
- + sizeof("<br>Key : ") - 1 + sizeof(CRLF "<br>Path: ") - 1
- + key[0].len + r->cache->file.name.len;
- + if (r->cache->group_keys.nelts > 0) {
- + len += sizeof("<br>Group Key : ") - 1 + group_key[0].len;
- + }
- r->headers_out.content_type.len = sizeof("text/html") - 1;
- r->headers_out.content_type.data = (u_char *) "text/html";
- @@ -620,6 +697,10 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r)
- sizeof(ngx_http_cache_purge_success_page_top) - 1);
- b->last = ngx_cpymem(b->last, "<br>Key : ", sizeof("<br>Key : ") - 1);
- b->last = ngx_cpymem(b->last, key[0].data, key[0].len);
- + if (r->cache->group_keys.nelts > 0) {
- + b->last = ngx_cpymem(b->last, "<br>Group Key : ", sizeof("<br>Group Key : ") - 1);
- + b->last = ngx_cpymem(b->last, group_key[0].data, group_key[0].len);
- + }
- b->last = ngx_cpymem(b->last, CRLF "<br>Path: ",
- sizeof(CRLF "<br>Path: ") - 1);
- b->last = ngx_cpymem(b->last, r->cache->file.name.data,
- @@ -638,7 +719,7 @@ ngx_http_cache_purge_send_response(ngx_http_request_t *r)
- ngx_int_t
- ngx_http_cache_purge_init(ngx_http_request_t *r, ngx_http_file_cache_t *cache,
- - ngx_http_complex_value_t *cache_key)
- + ngx_http_complex_value_t *cache_key, ngx_http_complex_value_t *cache_group_key)
- {
- ngx_http_cache_t *c;
- ngx_str_t *key;
- @@ -669,6 +750,23 @@ ngx_http_cache_purge_init(ngx_http_request_t *r, ngx_http_file_cache_t *cache,
- return NGX_ERROR;
- }
- + rc = ngx_array_init(&c->group_keys, r->pool, 1, sizeof(ngx_str_t));
- + if (rc != NGX_OK) {
- + return NGX_ERROR;
- + }
- +
- + if ((cache_group_key != NULL) && (cache_group_key->value.len > 0)) {
- + key = ngx_array_push(&c->group_keys);
- + if (key == NULL) {
- + return NGX_ERROR;
- + }
- +
- + rc = ngx_http_complex_value(r, cache_group_key, key);
- + if (rc != NGX_OK) {
- + return NGX_ERROR;
- + }
- + }
- +
- r->cache = c;
- c->body_start = ngx_pagesize;
- c->file_cache = cache;
- @@ -683,6 +781,8 @@ void
- ngx_http_cache_purge_handler(ngx_http_request_t *r)
- {
- ngx_int_t rc;
- + ngx_http_cache_purge_loc_conf_t *cplc;
- + ngx_str_t group_clean = ngx_null_string;
- # if (NGX_HAVE_FILE_AIO)
- if (r->aio) {
- @@ -690,7 +790,17 @@ ngx_http_cache_purge_handler(ngx_http_request_t *r)
- }
- # endif
- - rc = ngx_http_file_cache_purge(r);
- + cplc = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module);
- +
- + if (cplc->cache_group_clean != NULL) {
- + ngx_http_complex_value(r, cplc->cache_group_clean, &group_clean);
- + }
- +
- + if ((group_clean.len > 0) && ngx_atoi(group_clean.data, group_clean.len)) {
- + rc = ngx_http_file_cache_group_clean(r->cache->file_cache, r->cache->group_key);
- + } else {
- + rc = ngx_http_file_cache_purge(r);
- + }
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
- "http file cache purge: %i, \"%s\"",
- @@ -780,6 +890,35 @@ ngx_http_file_cache_purge(ngx_http_request_t *r)
- return NGX_OK;
- }
- +static void *
- +ngx_http_cache_purge_create_loc_conf(ngx_conf_t *cf)
- +{
- + ngx_http_cache_purge_loc_conf_t *conf;
- +
- + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_cache_purge_loc_conf_t));
- + if (conf == NULL) {
- + return NGX_CONF_ERROR;
- + }
- +
- + conf->cache_group_clean = NULL;
- +
- + return conf;
- +}
- +
- +
- +static char *
- +ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
- +{
- + ngx_http_cache_purge_loc_conf_t *prev = parent;
- + ngx_http_cache_purge_loc_conf_t *conf = child;
- +
- + if (conf->cache_group_clean == NULL) {
- + conf->cache_group_clean = prev->cache_group_clean;
- + }
- +
- + return NGX_CONF_OK;
- +}
- +
- #else /* !NGX_HTTP_CACHE */
- static ngx_http_module_t ngx_http_cache_purge_module_ctx = {
- diff --git a/t/proxy.t b/t/proxy.t
- index 72a2405..2461191 100644
- --- a/t/proxy.t
- +++ b/t/proxy.t
- @@ -5,7 +5,7 @@ use Test::Nginx::Socket;
- repeat_each(1);
- -plan tests => repeat_each() * (blocks() * 3 + 3 * 1);
- +plan tests => repeat_each() * 74;
- our $http_config = <<'_EOC_';
- proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m;
- @@ -30,6 +30,25 @@ our $config = <<'_EOC_';
- }
- _EOC_
- +our $config_group = <<'_EOC_';
- + location /proxy_group {
- + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd;
- + proxy_cache test_cache;
- + proxy_cache_key $uri$is_args$args $arg_group;
- + proxy_cache_valid 3m;
- + add_header X-Cache-Status $upstream_cache_status;
- + }
- +
- + location ~ /purge_group(/.*) {
- + proxy_cache_purge test_cache $1$is_args$args $arg_group;
- + group_clean_cache_purge "$http_x_group_clean";
- + }
- +
- + location = /etc/passwd {
- + root /;
- + }
- +_EOC_
- +
- worker_connections(128);
- no_shuffle();
- run_tests();
- @@ -122,3 +141,229 @@ X-Cache-Status: HIT
- --- response_body_like: root
- --- timeout: 10
- --- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 7: prepare cache with group g1
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g1
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 8: prepare cache with group g2
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 9: prepare cache with group g2 (different parameters)
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&bar=foo&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 10: get from cache with group g1
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g1
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: HIT
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 11: get from cache with group g2
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: HIT
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 12: get from cache with group g2 (different parameters)
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&bar=foo&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: HIT
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 13: purge from cache with group g1
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +DELETE /purge_group/?group=g1
- +--- more_headers
- +X-Group-Clean: 1
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/html
- +--- response_body_like: Successful purge
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 14: purge from cache with group g2 specific url
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +DELETE /purge_group/proxy_group/passwd?foo=bar&group=g2
- +--- more_headers
- +X-Group-Clean: 0
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/html
- +--- response_body_like: Successful purge
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 15: purge from empty cache with group g1
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +DELETE /purge_group/?group=g1
- +--- more_headers
- +X-Group-Clean: 1
- +--- error_code: 404
- +--- response_headers
- +Content-Type: text/html
- +--- response_body_like: 404 Not Found
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 16: purge from empty cache with group g2 specific url
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +DELETE /purge_group/proxy_group/passwd?foo=bar&group=g2
- +--- more_headers
- +X-Group-Clean: 0
- +--- error_code: 404
- +--- response_headers
- +Content-Type: text/html
- +--- response_body_like: 404 Not Found
- +--- timeout: 10
- +--- skip_nginx2: 3: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 17: get from source with group g1
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g1
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: MISS
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 18: get from source with group g2
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: MISS
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 19: get from source with group g1 (again)
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g1
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: HIT
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 20: get from source with group g2 (again, after purge)
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: HIT
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- +
- +
- +
- +=== TEST 21: get from cache (again, different parameters)
- +--- http_config eval: $::http_config
- +--- config eval: $::config_group
- +--- request
- +GET /proxy_group/passwd?foo=bar&bar=foo&group=g2
- +--- error_code: 200
- +--- response_headers
- +Content-Type: text/plain
- +X-Cache-Status: HIT
- +--- response_body_like: root
- +--- timeout: 10
- +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62
- --
- 1.7.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement