yzprofile/ngx_http_dyups_module — pull request #4 by chobits (2014-01-21 12:37:44+00:00)
Title: simplify upstream parsing methods via ngx_conf_parse api

DESCRIPTION
---
The following functions have been dropped, using `ngx_conf_parse` instead.

static ngx_array_t *ngx_dyups_parse_content(ngx_pool_t *pool, ngx_buf_t *buf);
static ngx_int_t ngx_dyups_conf_read_token(ngx_pool_t *pool, ngx_buf_t *body, ngx_array_t *args);
static ngx_array_t *ngx_dyups_copy_args(ngx_pool_t *pool, ngx_array_t *arglist);
static ngx_int_t ngx_http_dyups_check_commands(ngx_array_t *arglist);

The following functions have been added to help parse upstream configuration.

/* parse upstream name, e.g. "upstream dyhost" */
static char *ngx_dyups_parse_upstream_name(ngx_conf_t *cf, ngx_buf_t *buf, ngx_str_t *name);
/* parse upstream servers, syntax is the same as upstream {} block without `{' and `}' */
static char *ngx_dyups_parse_upstream(ngx_conf_t *cf, ngx_buf_t *buf);

TEST
---
The following cases, which is commented in t/dyups.t by myself, is not runned:

like(mhttp_post('/upstream/dyhost', 'server 127.0.0.1:8088;check interval=3000 rise=2 fall=5 timeout=1000 type=http default_down=false;', 8081),
qr/success/m, '2013-03-25 10:29:48');
like(mhttp_get('/', 'dyhost', 8080), qr/8088/m, '2013-03-25 10:39:02');
like(mhttp_delete('/upstream/dyhost', 8081), qr/success/m, '2013-03-25 10:39:28');

like(mhttp_post('/upstream/dyhost', 'server 127.0.0.1:8088;check interval=1000 rise=2 fall=5 timeout=1000 type=http default_down=true;', 8081),
qr/success/m, '2013-03-25 10:49:44');

Other 61 cases without healtch check module have passed.