From d2631d1b03e915d5544446fd939528754565904a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Sun, 2 Feb 2025 19:41:03 +0100 Subject: [PATCH 01/18] rm d/p/CVE-2024-7347.patch --- debian/patches/CVE-2024-7347.patch | 45 ------------------------------ 1 file changed, 45 deletions(-) delete mode 100644 debian/patches/CVE-2024-7347.patch diff --git a/debian/patches/CVE-2024-7347.patch b/debian/patches/CVE-2024-7347.patch deleted file mode 100644 index 1ca3e79..0000000 --- a/debian/patches/CVE-2024-7347.patch +++ /dev/null @@ -1,45 +0,0 @@ -Origin: https://nginx.org/download/patch.2024.mp4.txt - -diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c ---- a/src/http/modules/ngx_http_mp4_module.c -+++ b/src/http/modules/ngx_http_mp4_module.c -@@ -3099,7 +3099,8 @@ static ngx_int_t - ngx_http_mp4_crop_stsc_data(ngx_http_mp4_file_t *mp4, - ngx_http_mp4_trak_t *trak, ngx_uint_t start) - { -- uint32_t start_sample, chunk, samples, id, next_chunk, n, -+ uint64_t n; -+ uint32_t start_sample, chunk, samples, id, next_chunk, - prev_samples; - ngx_buf_t *data, *buf; - ngx_uint_t entries, target_chunk, chunk_samples; -@@ -3155,12 +3156,19 @@ ngx_http_mp4_crop_stsc_data(ngx_http_mp4 - - next_chunk = ngx_mp4_get_32value(entry->chunk); - -+ if (next_chunk < chunk) { -+ ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, -+ "unordered mp4 stsc chunks in \"%s\"", -+ mp4->file.name.data); -+ return NGX_ERROR; -+ } -+ - ngx_log_debug5(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, - "sample:%uD, chunk:%uD, chunks:%uD, " - "samples:%uD, id:%uD", - start_sample, chunk, next_chunk - chunk, samples, id); - -- n = (next_chunk - chunk) * samples; -+ n = (uint64_t) (next_chunk - chunk) * samples; - - if (start_sample < n) { - goto found; -@@ -3182,7 +3190,7 @@ ngx_http_mp4_crop_stsc_data(ngx_http_mp4 - "sample:%uD, chunk:%uD, chunks:%uD, samples:%uD", - start_sample, chunk, next_chunk - chunk, samples); - -- n = (next_chunk - chunk) * samples; -+ n = (uint64_t) (next_chunk - chunk) * samples; - - if (start_sample > n) { - ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, From 92496d21cf129e64f4435d9718a3ceadf029ff26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Sun, 2 Feb 2025 19:41:30 +0100 Subject: [PATCH 02/18] rm d/p/nginx-1.26.1.patch --- debian/patches/nginx-1.26.1.patch | 367 ------------------------------ 1 file changed, 367 deletions(-) delete mode 100644 debian/patches/nginx-1.26.1.patch diff --git a/debian/patches/nginx-1.26.1.patch b/debian/patches/nginx-1.26.1.patch deleted file mode 100644 index 8086ae8..0000000 --- a/debian/patches/nginx-1.26.1.patch +++ /dev/null @@ -1,367 +0,0 @@ -From: =?utf-8?b?SmFuIE1vasW+w63FoQ==?= -Date: Mon, 17 Jun 2024 18:40:09 +0200 -Subject: nginx-1.26.1 -Forwarded: not-needed - -Backport changes from the nginx 1.26.1 and fix -CVE-2024-32760, CVE-2024-31079, CVE-2024-35200, CVE-2024-34161 - ---- - auto/lib/libatomic/conf | 2 +- - src/core/ngx_output_chain.c | 10 ++++++++-- - src/event/quic/ngx_event_quic_frames.c | 1 + - src/event/quic/ngx_event_quic_ssl.c | 5 +++++ - src/event/quic/ngx_event_quic_transport.c | 8 ++++++++ - src/http/modules/ngx_http_grpc_module.c | 5 ++++- - src/http/modules/ngx_http_gunzip_filter_module.c | 18 ++++++++++++++---- - src/http/modules/ngx_http_gzip_filter_module.c | 10 +++++++--- - src/http/modules/ngx_http_ssi_filter_module.c | 8 ++++++-- - src/http/modules/ngx_http_sub_filter_module.c | 8 ++++++-- - src/http/v3/ngx_http_v3_parse.c | 3 +++ - src/http/v3/ngx_http_v3_request.c | 20 ++++++++++++++------ - src/http/v3/ngx_http_v3_table.c | 2 +- - src/http/v3/ngx_http_v3_uni.c | 4 +--- - src/http/v3/ngx_http_v3_uni.h | 2 ++ - 15 files changed, 81 insertions(+), 25 deletions(-) - -diff --git a/auto/lib/libatomic/conf b/auto/lib/libatomic/conf -index d1e484a..8c8cb43 100644 ---- a/auto/lib/libatomic/conf -+++ b/auto/lib/libatomic/conf -@@ -19,7 +19,7 @@ else - #include " - ngx_feature_path= - ngx_feature_libs="-latomic_ops" -- ngx_feature_test="long n = 0; -+ ngx_feature_test="AO_t n = 0; - if (!AO_compare_and_swap(&n, 0, 1)) - return 1; - if (AO_fetch_and_add(&n, 1) != 1) -diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c -index 8570742..a46209c 100644 ---- a/src/core/ngx_output_chain.c -+++ b/src/core/ngx_output_chain.c -@@ -117,7 +117,10 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) - - ngx_debug_point(); - -- ctx->in = ctx->in->next; -+ cl = ctx->in; -+ ctx->in = cl->next; -+ -+ ngx_free_chain(ctx->pool, cl); - - continue; - } -@@ -203,7 +206,10 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in) - /* delete the completed buf from the ctx->in chain */ - - if (ngx_buf_size(ctx->in->buf) == 0) { -- ctx->in = ctx->in->next; -+ cl = ctx->in; -+ ctx->in = cl->next; -+ -+ ngx_free_chain(ctx->pool, cl); - } - - cl = ngx_alloc_chain_link(ctx->pool); -diff --git a/src/event/quic/ngx_event_quic_frames.c b/src/event/quic/ngx_event_quic_frames.c -index 42b7d9f..6ea908c 100644 ---- a/src/event/quic/ngx_event_quic_frames.c -+++ b/src/event/quic/ngx_event_quic_frames.c -@@ -648,6 +648,7 @@ ngx_quic_free_buffer(ngx_connection_t *c, ngx_quic_buffer_t *qb) - ngx_quic_free_chain(c, qb->chain); - - qb->chain = NULL; -+ qb->last_chain = NULL; - } - - -diff --git a/src/event/quic/ngx_event_quic_ssl.c b/src/event/quic/ngx_event_quic_ssl.c -index 7872783..ba0b592 100644 ---- a/src/event/quic/ngx_event_quic_ssl.c -+++ b/src/event/quic/ngx_event_quic_ssl.c -@@ -326,6 +326,11 @@ ngx_quic_handle_crypto_frame(ngx_connection_t *c, ngx_quic_header_t *pkt, - ngx_quic_crypto_frame_t *f; - - qc = ngx_quic_get_connection(c); -+ -+ if (!ngx_quic_keys_available(qc->keys, pkt->level, 0)) { -+ return NGX_OK; -+ } -+ - ctx = ngx_quic_get_send_ctx(qc, pkt->level); - f = &frame->u.crypto; - -diff --git a/src/event/quic/ngx_event_quic_transport.c b/src/event/quic/ngx_event_quic_transport.c -index 19670a6..fba098c 100644 ---- a/src/event/quic/ngx_event_quic_transport.c -+++ b/src/event/quic/ngx_event_quic_transport.c -@@ -1750,6 +1750,14 @@ ngx_quic_parse_transport_params(u_char *p, u_char *end, ngx_quic_tp_t *tp, - return NGX_ERROR; - } - -+ if ((size_t) (end - p) < len) { -+ ngx_log_error(NGX_LOG_INFO, log, 0, -+ "quic failed to parse" -+ " transport param id:0x%xL, data length %uL too long", -+ id, len); -+ return NGX_ERROR; -+ } -+ - rc = ngx_quic_parse_transport_param(p, p + len, id, tp); - - if (rc == NGX_ERROR) { -diff --git a/src/http/modules/ngx_http_grpc_module.c b/src/http/modules/ngx_http_grpc_module.c -index dfe49c5..e7726f3 100644 ---- a/src/http/modules/ngx_http_grpc_module.c -+++ b/src/http/modules/ngx_http_grpc_module.c -@@ -1231,7 +1231,7 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in) - ngx_buf_t *b; - ngx_int_t rc; - ngx_uint_t next, last; -- ngx_chain_t *cl, *out, **ll; -+ ngx_chain_t *cl, *out, *ln, **ll; - ngx_http_upstream_t *u; - ngx_http_grpc_ctx_t *ctx; - ngx_http_grpc_frame_t *f; -@@ -1459,7 +1459,10 @@ ngx_http_grpc_body_output_filter(void *data, ngx_chain_t *in) - last = 1; - } - -+ ln = in; - in = in->next; -+ -+ ngx_free_chain(r->pool, ln); - } - - ctx->in = in; -diff --git a/src/http/modules/ngx_http_gunzip_filter_module.c b/src/http/modules/ngx_http_gunzip_filter_module.c -index c1341f5..5d170a1 100644 ---- a/src/http/modules/ngx_http_gunzip_filter_module.c -+++ b/src/http/modules/ngx_http_gunzip_filter_module.c -@@ -333,6 +333,8 @@ static ngx_int_t - ngx_http_gunzip_filter_add_data(ngx_http_request_t *r, - ngx_http_gunzip_ctx_t *ctx) - { -+ ngx_chain_t *cl; -+ - if (ctx->zstream.avail_in || ctx->flush != Z_NO_FLUSH || ctx->redo) { - return NGX_OK; - } -@@ -344,8 +346,11 @@ ngx_http_gunzip_filter_add_data(ngx_http_request_t *r, - return NGX_DECLINED; - } - -- ctx->in_buf = ctx->in->buf; -- ctx->in = ctx->in->next; -+ cl = ctx->in; -+ ctx->in_buf = cl->buf; -+ ctx->in = cl->next; -+ -+ ngx_free_chain(r->pool, cl); - - ctx->zstream.next_in = ctx->in_buf->pos; - ctx->zstream.avail_in = ctx->in_buf->last - ctx->in_buf->pos; -@@ -374,6 +379,7 @@ static ngx_int_t - ngx_http_gunzip_filter_get_buf(ngx_http_request_t *r, - ngx_http_gunzip_ctx_t *ctx) - { -+ ngx_chain_t *cl; - ngx_http_gunzip_conf_t *conf; - - if (ctx->zstream.avail_out) { -@@ -383,8 +389,12 @@ ngx_http_gunzip_filter_get_buf(ngx_http_request_t *r, - conf = ngx_http_get_module_loc_conf(r, ngx_http_gunzip_filter_module); - - if (ctx->free) { -- ctx->out_buf = ctx->free->buf; -- ctx->free = ctx->free->next; -+ -+ cl = ctx->free; -+ ctx->out_buf = cl->buf; -+ ctx->free = cl->next; -+ -+ ngx_free_chain(r->pool, cl); - - ctx->out_buf->flush = 0; - -diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c -index ed0de60..b555278 100644 ---- a/src/http/modules/ngx_http_gzip_filter_module.c -+++ b/src/http/modules/ngx_http_gzip_filter_module.c -@@ -985,10 +985,14 @@ static void - ngx_http_gzip_filter_free_copy_buf(ngx_http_request_t *r, - ngx_http_gzip_ctx_t *ctx) - { -- ngx_chain_t *cl; -+ ngx_chain_t *cl, *ln; -+ -+ for (cl = ctx->copied; cl; /* void */) { -+ ln = cl; -+ cl = cl->next; - -- for (cl = ctx->copied; cl; cl = cl->next) { -- ngx_pfree(r->pool, cl->buf->start); -+ ngx_pfree(r->pool, ln->buf->start); -+ ngx_free_chain(r->pool, ln); - } - - ctx->copied = NULL; -diff --git a/src/http/modules/ngx_http_ssi_filter_module.c b/src/http/modules/ngx_http_ssi_filter_module.c -index 0b84bd3..47068f7 100644 ---- a/src/http/modules/ngx_http_ssi_filter_module.c -+++ b/src/http/modules/ngx_http_ssi_filter_module.c -@@ -482,9 +482,13 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) - while (ctx->in || ctx->buf) { - - if (ctx->buf == NULL) { -- ctx->buf = ctx->in->buf; -- ctx->in = ctx->in->next; -+ -+ cl = ctx->in; -+ ctx->buf = cl->buf; -+ ctx->in = cl->next; - ctx->pos = ctx->buf->pos; -+ -+ ngx_free_chain(r->pool, cl); - } - - if (ctx->state == ssi_start_state) { -diff --git a/src/http/modules/ngx_http_sub_filter_module.c b/src/http/modules/ngx_http_sub_filter_module.c -index 6d3de59..456bb27 100644 ---- a/src/http/modules/ngx_http_sub_filter_module.c -+++ b/src/http/modules/ngx_http_sub_filter_module.c -@@ -335,9 +335,13 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in) - while (ctx->in || ctx->buf) { - - if (ctx->buf == NULL) { -- ctx->buf = ctx->in->buf; -- ctx->in = ctx->in->next; -+ -+ cl = ctx->in; -+ ctx->buf = cl->buf; -+ ctx->in = cl->next; - ctx->pos = ctx->buf->pos; -+ -+ ngx_free_chain(r->pool, cl); - } - - if (ctx->buf->flush || ctx->buf->recycled) { -diff --git a/src/http/v3/ngx_http_v3_parse.c b/src/http/v3/ngx_http_v3_parse.c -index 5688163..436765c 100644 ---- a/src/http/v3/ngx_http_v3_parse.c -+++ b/src/http/v3/ngx_http_v3_parse.c -@@ -810,6 +810,7 @@ ngx_http_v3_parse_field_lri(ngx_connection_t *c, - - st->literal.length = st->pint.value; - if (st->literal.length == 0) { -+ st->value.data = (u_char *) ""; - goto done; - } - -@@ -932,6 +933,7 @@ ngx_http_v3_parse_field_l(ngx_connection_t *c, - - st->literal.length = st->pint.value; - if (st->literal.length == 0) { -+ st->value.data = (u_char *) ""; - goto done; - } - -@@ -1072,6 +1074,7 @@ ngx_http_v3_parse_field_lpbi(ngx_connection_t *c, - - st->literal.length = st->pint.value; - if (st->literal.length == 0) { -+ st->value.data = (u_char *) ""; - goto done; - } - -diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c -index 87f5f32..0faddd2 100644 ---- a/src/http/v3/ngx_http_v3_request.c -+++ b/src/http/v3/ngx_http_v3_request.c -@@ -134,7 +134,17 @@ ngx_http_v3_init(ngx_connection_t *c) - } - } - -- return ngx_http_v3_send_settings(c); -+ if (ngx_http_v3_send_settings(c) != NGX_OK) { -+ return NGX_ERROR; -+ } -+ -+ if (h3scf->max_table_capacity > 0) { -+ if (ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER) == NULL) { -+ return NGX_ERROR; -+ } -+ } -+ -+ return NGX_OK; - } - - -@@ -398,14 +408,12 @@ ngx_http_v3_wait_request_handler(ngx_event_t *rev) - void - ngx_http_v3_reset_stream(ngx_connection_t *c) - { -- ngx_http_v3_session_t *h3c; -- ngx_http_v3_srv_conf_t *h3scf; -- -- h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module); -+ ngx_http_v3_session_t *h3c; - - h3c = ngx_http_v3_get_session(c); - -- if (h3scf->max_table_capacity > 0 && !c->read->eof && !h3c->hq -+ if (!c->read->eof && !h3c->hq -+ && h3c->known_streams[NGX_HTTP_V3_STREAM_SERVER_DECODER] - && (c->quic->id & NGX_QUIC_STREAM_UNIDIRECTIONAL) == 0) - { - (void) ngx_http_v3_send_cancel_stream(c, c->quic->id); -diff --git a/src/http/v3/ngx_http_v3_table.c b/src/http/v3/ngx_http_v3_table.c -index f49a8fc..428e732 100644 ---- a/src/http/v3/ngx_http_v3_table.c -+++ b/src/http/v3/ngx_http_v3_table.c -@@ -308,7 +308,7 @@ ngx_http_v3_set_capacity(ngx_connection_t *c, ngx_uint_t capacity) - prev_max = dt->capacity / 32; - - if (max > prev_max) { -- elts = ngx_alloc(max * sizeof(void *), c->log); -+ elts = ngx_alloc((max + 1) * sizeof(void *), c->log); - if (elts == NULL) { - return NGX_ERROR; - } -diff --git a/src/http/v3/ngx_http_v3_uni.c b/src/http/v3/ngx_http_v3_uni.c -index 2fc5b07..302064b 100644 ---- a/src/http/v3/ngx_http_v3_uni.c -+++ b/src/http/v3/ngx_http_v3_uni.c -@@ -20,8 +20,6 @@ static void ngx_http_v3_close_uni_stream(ngx_connection_t *c); - static void ngx_http_v3_uni_read_handler(ngx_event_t *rev); - static void ngx_http_v3_uni_dummy_read_handler(ngx_event_t *wev); - static void ngx_http_v3_uni_dummy_write_handler(ngx_event_t *wev); --static ngx_connection_t *ngx_http_v3_get_uni_stream(ngx_connection_t *c, -- ngx_uint_t type); - - - void -@@ -307,7 +305,7 @@ ngx_http_v3_uni_dummy_write_handler(ngx_event_t *wev) - } - - --static ngx_connection_t * -+ngx_connection_t * - ngx_http_v3_get_uni_stream(ngx_connection_t *c, ngx_uint_t type) - { - u_char buf[NGX_HTTP_V3_VARLEN_INT_LEN]; -diff --git a/src/http/v3/ngx_http_v3_uni.h b/src/http/v3/ngx_http_v3_uni.h -index 911e153..2805894 100644 ---- a/src/http/v3/ngx_http_v3_uni.h -+++ b/src/http/v3/ngx_http_v3_uni.h -@@ -19,6 +19,8 @@ ngx_int_t ngx_http_v3_register_uni_stream(ngx_connection_t *c, uint64_t type); - - ngx_int_t ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id); - -+ngx_connection_t *ngx_http_v3_get_uni_stream(ngx_connection_t *c, -+ ngx_uint_t type); - ngx_int_t ngx_http_v3_send_settings(ngx_connection_t *c); - ngx_int_t ngx_http_v3_send_goaway(ngx_connection_t *c, uint64_t id); - ngx_int_t ngx_http_v3_send_ack_section(ngx_connection_t *c, From 2939b5f2428f79794f89ff4946846c557e2d79b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Sun, 2 Feb 2025 19:41:56 +0100 Subject: [PATCH 03/18] d/changelog: remove duplicit lines --- debian/changelog | 2 -- 1 file changed, 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 09302b8..ad1798d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,6 @@ nginx (1.26.2-1) UNRELEASED; urgency=medium [ Jan Mojžíš ] - * d/u/signing-key.asc: add Sergey Kandaurov public key, - the key is used to sign the 1.26.2 release * d/gbp.conf: add upstream-signatures = on * d/{control,copyright}: update my email to "janmojzis@debian.org" * d/copyright: bump my copyright year From 215777eecbceae05ed05a9f64cf6eef074239df7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Sun, 2 Feb 2025 21:09:05 +0100 Subject: [PATCH 04/18] Release to experimental --- debian/changelog | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/debian/changelog b/debian/changelog index ad1798d..469fb8b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,17 +1,16 @@ -nginx (1.26.2-1) UNRELEASED; urgency=medium +nginx (1.26.2-1) experimental; urgency=medium + + * Team upload + * New upstream version 1.26.2 + * Add Sergey Kandaurov pgp public key + * Drop upstream patches [ Jan Mojžíš ] * d/gbp.conf: add upstream-signatures = on * d/{control,copyright}: update my email to "janmojzis@debian.org" * d/copyright: bump my copyright year - [ Jérémy Lal ] - * Add Sergey Kandaurov pgp public key - * New upstream version 1.26.2 - * Drop upstream patches - * Refresh patches - - -- Jérémy Lal Sun, 02 Feb 2025 11:24:55 +0100 + -- Jérémy Lal Sun, 02 Feb 2025 21:08:45 +0100 nginx (1.26.0-3) unstable; urgency=medium From be95fff10182255b961868e900115fb116ca3318 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Wed, 5 Feb 2025 19:03:32 +0100 Subject: [PATCH 05/18] New upstream version 1.26.3 --- .hgtags | 483 ++++++++++++++++++ CHANGES | 24 + CHANGES.ru | 25 + auto/lib/libatomic/conf | 4 +- auto/lib/libatomic/make | 11 +- auto/lib/pcre/make | 3 +- src/core/nginx.h | 4 +- .../quic/ngx_event_quic_openssl_compat.c | 1 + src/event/quic/ngx_event_quic_output.c | 4 +- src/event/quic/ngx_event_quic_streams.c | 18 +- src/event/quic/ngx_event_quic_transport.c | 5 + .../modules/ngx_http_gzip_filter_module.c | 8 +- src/http/modules/ngx_http_mp4_module.c | 18 +- src/http/ngx_http_request.c | 27 +- src/stream/ngx_stream_ssl_module.c | 27 +- 15 files changed, 639 insertions(+), 23 deletions(-) create mode 100644 .hgtags diff --git a/.hgtags b/.hgtags new file mode 100644 index 0000000..0dc64a5 --- /dev/null +++ b/.hgtags @@ -0,0 +1,483 @@ +551102312e19b704cd22bd7254a9444b9ea14e96 release-0.1.0 +23fb87bddda14ce9faec90f774085634106aded4 release-0.1.1 +295d97d70c698585705345f1a8f92b02e63d6d0d release-0.1.2 +ded1284520cc939ad5ae6ddab39925375e64237d release-0.1.3 +0491b909ef7612d8411f1f59054186c1f3471b52 release-0.1.4 +a88a3e4e158fade0aaa6f3eb25597d5ced2c1075 release-0.1.5 +1f31dc6d33a3a4e65240b08066bf186df9e33b79 release-0.1.6 +5aecc125bc33d81d6214c91d73eb44230a903dde release-0.1.7 +bbd6b0b4a2b15ef8c8f1aaf7b027b6da47303524 release-0.1.8 +2ff194b74f1e60cd04670986973e3b1a6aa3bece release-0.1.9 +31ee1b50354fb829564b81a6f34e8d6ceb2d3f48 release-0.1.10 +8e8f3af115b5b903b2b8f3335de971f18891246f release-0.1.11 +c3c2848fc081e19aec5ffa97e468ad20ddb81df0 release-0.1.12 +ad1e9ebf93bb5ae4c748d471fad2de8a0afc4d2a release-0.1.13 +c5240858380136a67bec261c59b1532560b57885 release-0.1.14 +fd661d14a7fad212e326a7dad6234ea0de992fbf release-0.1.15 +621229427cba1b0af417ff2a101fc4f17a7d93c8 release-0.1.16 +4ebe09b07e3021f1a63b459903ec58f162183b26 release-0.1.17 +31ff3e943e1675a2caf745ba7a981244445d4c98 release-0.1.18 +45a460f82aec80b0f61136aa09f412436d42203a release-0.1.19 +0f836f0288eee4980f57736d50a7a60fa082d8e9 release-0.1.20 +975f62e77f0244f1b631f740be77c72c8f2da1de release-0.1.21 +fc9909c369b2b4716304ac8e38da57b8fb781211 release-0.1.22 +d7c90bb5ce83dab08715e98f9c7b81c7df4b37be release-0.1.23 +64d9afb209da0cd4a917202b7b77e51cc23e2229 release-0.1.24 +d4ea69372b946dc4ec37fc3f5ddd93ff7c3da675 release-0.1.25 +b1648294f6935e993e436fd8a68bca75c74c826d release-0.1.26 +ee66921ecd47a7fa459f70f4a9d660f91f6a1b94 release-0.1.27 +cd3117ad9aab9c58c6f7e677e551e1adbdeaba54 release-0.1.28 +9b8c906f6e63ec2c71cecebfff35819a7d32227d release-0.1.29 +c12967aadd8726daf2d85e3f3e622d89c42db176 release-0.1.30 +fbbf16224844e7d560c00043e8ade8a560415bba release-0.1.31 +417a087c9c4d9abb9b0b9b3f787aff515c43c035 release-0.1.32 +dadfa78d227027348d7f9d1e7b7093d06ba545a0 release-0.1.33 +12234c998d83bfbbaa305273b3dd1b855ca325dc release-0.1.34 +6f00349b98e5f706b82115c6e4dc84456fc0d770 release-0.1.35 +2019117e6b38cc3e89fe4f56a23b271479c627a6 release-0.1.36 +09b42134ac0c42625340f16628e29690a04f8db5 release-0.1.37 +7fa11e5c6e9612ecff5eb58274cc846ae742d1d2 release-0.1.38 +e5d7d0334fdb946133c17523c198800142ac9fe9 release-0.1.39 +c3bd8cdabb8f73e5600a91f198eb7df6fac65e92 release-0.1.40 +d6e48c08d718bf5a9e58c20a37e8ae172bff1139 release-0.1.41 +563ad09abf5042eb41e8ecaf5b4e6c9deaa42731 release-0.1.42 +c9ad0d9c7d59b2fa2a5fe669f1e88debd03e6c04 release-0.1.43 +371c1cee100d7a1b0e6cad4d188e05c98a641ee7 release-0.1.44 +b09ee85d0ac823e36861491eedfc4dfafe282997 release-0.1.45 +511a89da35ada16ae806667d699f9610b4f8499a release-0.2.0 +0148586012ab3dde69b394ec5a389d44bb11c869 release-0.2.1 +818fbd4750b99d14d2736212c939855a11b1f1ef release-0.2.2 +e16a8d574da511622b97d6237d005f40f2cddb30 release-0.2.3 +483cca23060331f2078b1c2984870d80f288ad41 release-0.2.4 +45033d85b30e3f12c407b7cfc518d76e0eda0263 release-0.2.5 +7bd37aef1e7e87858c12b124e253e98558889b50 release-0.2.6 +ecd9c160f25b7a7075dd93383d98a0fc8d8c0a41 release-0.3.0 +c1f965ef97188fd7ef81342dcf8719da18c554d2 release-0.3.1 +e48ebafc69393fc94fecfdf9997c4179fd1ce473 release-0.3.2 +9c2f3ed7a24711d3b42b124d5f831155c8beff95 release-0.3.3 +7c1369d37c7eb0017c28ebcaa0778046f5aafdcc release-0.3.4 +1af2fcb3be8a63796b6b23a488049c92a6bc12f4 release-0.3.5 +174f1e853e1e831b01000aeccfd06a9c8d4d95a2 release-0.3.6 +458b6c3fea65a894c99dd429334a77bb164c7e83 release-0.3.7 +58475592100cb792c125101b6d2d898f5adada30 release-0.3.8 +fcd6fc7ff7f9b132c35193d834e6e7d05026c716 release-0.3.9 +4d9ea73a627a914d364e83e20c58eb1283f4031d release-0.3.10 +4c5c2c55975c1152b5ca5d5d55b32d4dd7945f7a release-0.3.11 +326634fb9d47912ad94221dc2f8fa4bec424d40c release-0.3.12 +4e296b7d25bf62390ca2afb599e395426b94f785 release-0.3.13 +401de5a43ba5a8acdb9c52465193c0ea7354afe7 release-0.3.14 +284cc140593bb16ac71094acd509ab415ff4837d release-0.3.15 +d4e858a5751a7fd08e64586795ed7d336011fbc0 release-0.3.16 +8c0cdd81580eb76d774cfc5724de68e7e5cbbdc2 release-0.3.17 +425af804d968f30eeff01e33b808bc2e8c467f2c release-0.3.18 +ebc68d8ca4962fe3531b7e13444f7ac4395d9c6e release-0.3.19 +9262f520ce214d3d5fd7c842891519336ef85ca6 release-0.3.20 +869b6444d2341a587183859d4df736c7f3381169 release-0.3.21 +77f77f53214a0e3a68fef8226c15532b54f2c365 release-0.3.22 +858700ae46b453ea111b966b6d03f2c21ddcb94e release-0.3.23 +5dac8c7fb71b86aafed8ea352305e7f85759f72e release-0.3.24 +77cdfe394a94a625955e7585e09983b3af9b889b release-0.3.25 +608cf78b24ef7baaf9705e4715a361f26bb16ba9 release-0.3.26 +3f8a2132b93d66ac19bec006205a304a68524a0b release-0.3.27 +c73c5c58c619c22dd3a5a26c91bb0567a62c6930 release-0.3.28 +5ef026a2ac7481f04154f29ab49377bf99aaf96f release-0.3.29 +51b27717f140b71a2e9158807d79da17c888ce4c release-0.3.30 +7a16e281c01f1c7ab3b79c64b43ddb754ea7935e release-0.3.31 +93e85a79757c49d502e42a1cb8264a0f133b0b00 release-0.3.32 +0216fd1471f386168545f772836156761eddec08 release-0.3.33 +fbed40ce7cb4fd7203fecc22a617b9ce5b950fb3 release-0.3.34 +387450de0b4d21652f0b6242a5e26a31e3be8d8c release-0.3.35 +65bf042c0b4f39f18a235464c52f980e9fa24f6b release-0.3.36 +5d2b8078c1c2593b95ec50acfeeafbefa65be344 release-0.3.37 +f971949ffb585d400e0f15508a56232a0f897c80 release-0.3.38 +18268abd340cb351e0c01b9c44e9f8cc05492364 release-0.3.39 +e60fe4cf1d4ea3c34be8c49047c712c6d46c1727 release-0.3.40 +715d243270806d38be776fc3ed826d97514a73d6 release-0.3.41 +5e8fb59c18c19347a5607fb5af075fe1e2925b9a release-0.3.42 +947c6fd27699e0199249ad592151f844c8a900b0 release-0.3.43 +4946078f0a79e6cc952d3e410813aac9b8bda650 release-0.3.44 +95d7da23ea5315a6e9255ce036ed2c51f091f180 release-0.3.45 +1e720b0be7ecd92358da8a60944669fa493e78cd release-0.3.46 +39b7d7b33c918d8f4abc86c4075052d8c19da3c7 release-0.3.47 +7cbef16c71a1f43a07f8141f02e0135c775f0f5b release-0.3.48 +4c8cd5ae5cc100add5c08c252d991b82b1838c6b release-0.3.49 +400711951595aef7cd2ef865b84b31df52b15782 release-0.3.50 +649c9063d0fda23620eaeaf0f6393be0a672ebe7 release-0.3.51 +9079ee4735aefa98165bb2cb26dee4f58d58c1d7 release-0.3.52 +6d5c1535bb9dcd891c5963971f767421a334a728 release-0.3.53 +5fd7a5e990477189c40718c8c3e01002a2c20b81 release-0.3.54 +63a820b0bc6ca629c8e45a069b52d622ddc27a2d release-0.3.55 +562806624c4afb1687cba83bc1852f5d0fecbac3 release-0.3.56 +cec32b3753acf610ac1a6227d14032c1a89d6319 release-0.3.57 +b80f94fa2197b99db5e033fec92e0426d1fe5026 release-0.3.58 +e924670896abe2769ea0fcfd2058b405bed8e8ec release-0.3.59 +921a7ce4baf42fd1091b7e40f89c858c6b23053e release-0.3.60 +df95dcff753a6dc5e94257302aea02c18c7a7c87 release-0.3.61 +7e24168b0853ee7e46c9c7b943ef077dc64f17f5 release-0.4.0 +8183d4ba50f8500465efb27e66dd23f98775dd21 release-0.4.1 +610267a772c7bf911b499d37f66c21ce8f2ebaf7 release-0.4.2 +39dd0b045441e21512e0a6061a03d0df63414d8b release-0.4.3 +5e42c1615f4de0079bd4d8913886d588ce6a295d release-0.4.4 +40266f92b829a870808b3d4ee54c8fccdecbd2d6 release-0.4.5 +56e33c6efee7ff63cdc52bd1cf172bde195079df release-0.4.6 +119bad43bfd493400c57a05848eada2c35a46810 release-0.4.7 +0f404f82a1343cb4e4b277a44e3417385798e5e5 release-0.4.8 +d24a717314365c857b9f283d6072c2a427d5e342 release-0.4.9 +d6f0a00015fdef861fd67fb583b9690638650656 release-0.4.10 +e372368dadd7b2ecd0182b2f1b11db86fc27b2c3 release-0.4.11 +fd57967d850d2361072c72562d1ed03598473478 release-0.4.12 +979045fdcbd20cf7188545c1c589ff240251f890 release-0.4.13 +93c94cfa9f78f0a5740595dde4466ec4fba664f8 release-0.4.14 +589ee12e8d7c2ae5e4f4676bcc7a1279a76f9e8e release-0.5.0 +13416db8a807e5acb4021bc3c581203de57e2f50 release-0.5.1 +06c58edc88831fb31c492a8eddcf2c6056567f18 release-0.5.2 +e2ac5fa41bcba14adbbb722d45c083c30c07bb5c release-0.5.3 +393dbc659df15ccd411680b5c1ce87ed86d4c144 release-0.5.4 +38cc7bd8e04f2c519fd4526c12841a876be353cb release-0.5.5 +6d1fcec2ea79101c756316c015f72e75f601a5ab release-0.5.6 +aed8a9de62456c4b360358bc112ccca32ce02e8d release-0.5.7 +7642f45af67d805452df2667486201c36efaff85 release-0.5.8 +779216610662c3a459935d506f66a9b16b9c9576 release-0.5.9 +9eeb585454f3daa30cf768e95c088a092fe229b9 release-0.5.10 +bb491c8197e38ca10ae63b1f1ecb36bf6fdaf950 release-0.5.11 +613369e08810f36bbcc9734ef1059a03ccbf5e16 release-0.5.12 +bd796ef5c9c9dd34bfac20261b98685e0410122a release-0.5.13 +8a730c49f906d783b47e4b44d735efd083936c64 release-0.5.14 +cb447039152d85e9145139ff2575a6199b9af9d4 release-0.5.15 +64854c7c95d04f838585ca08492823000503fa61 release-0.5.16 +d1ffcf84ea1244f659145c36ff28de6fcdf528b2 release-0.5.17 +796a6e30ca9d29504195c10210dbc8deced0ae83 release-0.5.18 +1f81c711d2a039e1f93b9b515065a2235372d455 release-0.5.19 +8e8f6082654aedb4438c8fca408cfc316c7c5a2a release-0.5.20 +e9551132f7dd40da5719dd5bcf924c86f1436f85 release-0.5.21 +533a252896c4d1cff1586ae42129d610f7497811 release-0.5.22 +f461a49b6c747e0b67f721f2be172902afea5528 release-0.5.23 +2d5ef73671f690b65bf6d9e22e7155f68f484d5a release-0.5.24 +77bf42576050862c268e267ef3e508b145845a25 release-0.5.25 +2aefee4d4ed69eb7567680bf27a2efd212232488 release-0.6.0 +7ac0fe9bec9a2b5f8e191f6fdd6922bfd916a6cb release-0.6.1 +4882735ebc71eeec0fbfe645bdfdb31306872d82 release-0.6.2 +b94731c73d0922f472ff938b9d252ba29020f20c release-0.6.3 +13e649b813d6ccba5db33a61e08ebe09d683cd5b release-0.6.4 +80de622646b0059fd4c553eff47c391bf7503b89 release-0.6.5 +3b05edb2619d5935023b979ee7a9611b61b6c9e5 release-0.6.6 +1dcfd375100c4479611f71efb99271d0a3059215 release-0.6.7 +0228185d4c5772947b842e856ad74cf7f7fd52f3 release-0.6.8 +d1879c52326ecac45c713203670f54220879911e release-0.6.9 +5a80c6ccbe2ad24fa3d4ff6f9fe4a2b07408d19d release-0.6.10 +f88a8b0b39601b19cd740e4db614ab0b5b874686 release-0.6.11 +5557460a7247a1602ae96efd1d0ccf781344cb58 release-0.6.12 +451b02cc770a794cd41363461b446948ae1d8bc8 release-0.6.13 +537b6ef014c4a133e0ab0b7dc817508e0647e315 release-0.6.14 +5e68764f0d6e91a983170fa806e7450a9e9b33fe release-0.6.15 +158aa4e8cc46fcf9504a61469d22daf3476b17bf release-0.6.16 +d8fcca555542619228d9fab89e1665b993f8c3ee release-0.6.17 +60707ebc037086cf004736a0d4979e2a608da033 release-0.6.18 +3c2a99d3a71af846855be35e62edb9a12f363f44 release-0.6.19 +3e0a27f9358ffc1b5249e0ea2311ce7da5c8967e release-0.6.20 +143f4d65b1c875d6563ccb7f653d9157afc72194 release-0.6.21 +95e6160d2b7d0af8ffd1b95a23cadadf8f0b3f6d release-0.6.22 +69a03d5e3b6e6660079ef1ef172db7ac08d8370e release-0.6.23 +3e2a58fb48f1e1a99ebf851e0d47a7034c52ae22 release-0.6.24 +3b8607c05a8bebcfa59235c2126a70d737f0ccf5 release-0.6.25 +07ad5b2606614c4be4ee720c46cf4af126059d31 release-0.6.26 +be531addfabe5214f409d457140c1038af10d199 release-0.6.27 +58f05255d3a345d04baef5cff0ca1ae0ac7ecebb release-0.6.28 +eb2bd21dc8d03f6c94016f04ffb9adaf83a2b606 release-0.6.29 +55408deb3cd171efa9b81d23d7a1dd1ccde0b839 release-0.6.30 +d4288915bba73c4c3c9cf5d39d34e86879eb2b45 release-0.6.31 +0a189588830b8629c4dfea68feb49af36b59e4a9 release-0.7.0 +6ab27a06f3346cf9ec8737f5dbcc82dd4031e30f release-0.7.1 +a07e258cef3b0a0b6e76a6ff4ba4651c5facc85a release-0.7.2 +9992c4583513d2804fc2e7fec860fbc7ab043009 release-0.7.3 +4dc24d50230fbadfc037a414a86390db2de69dd2 release-0.7.4 +9527137b4354a648a229c7169850c7c65272c00d release-0.7.5 +c2f0f7cf306f302254beae512bda18713922375c release-0.7.6 +bbcf6d75556fdcee8bd4aba8f6c27014be9920ee release-0.7.7 +43bde71f0bbe5a33b161760d7f9f980d50386597 release-0.7.8 +769f0dd7081e9011394f264aa22aa66fd79730d8 release-0.7.9 +511edfa732da637f5f0c9476335df7dca994706d release-0.7.10 +0e7023bf6b2461309c29885935443449a41be807 release-0.7.11 +9ad1bd2b21d93902863807528e426862aedee737 release-0.7.12 +d90ea21e24ea35379aef50c5d70564158e110a15 release-0.7.13 +c07d2d20d95c83d804079bbdcecbce4a0c8282f0 release-0.7.14 +0cd7bb051f67eac2b179fb9f9cc988b9ba18ed76 release-0.7.15 +eab2e87deba73ae6abd9cc740e8d4365bed96322 release-0.7.16 +91d7a9eb8ade90e9421d7b1e3c2e47a6bc427876 release-0.7.17 +fc10f7b5cb1305fb930f8ac40b46882d0828d61e release-0.7.18 +9dba9779e37e5969a2d408c792084fd7acfec062 release-0.7.19 +61838d1bcbddc7bc4dd9f30d535573a6fddca8f9 release-0.7.20 +5f665d0fa6a5f6e748157f2ccbc445b2db8125d0 release-0.7.21 +24763afa5efe91e54f00b2ae5b87666eb6c08c3b release-0.7.22 +0562fb355a25266150cbe8c8d4e00f55e3654df3 release-0.7.23 +19c452ecd083550816873a8a31eb3ed9879085e6 release-0.7.24 +46b68faf271d6fdcaaf3ad2c69f6167ea9e9fa28 release-0.7.25 +d04bfca0c7e3ae2e4422bc1d383553139d6f0a19 release-0.7.26 +9425d9c7f8ead95b00a3929a9a5e487e0e3c8499 release-0.7.27 +fbc3e7e8b3ee756568a875f87d8a954a2f9d3bf6 release-0.7.28 +5176dfdf153fc785b18604197d58806f919829ad release-0.7.29 +87e07ccdf0a4ec53458d9d7a4ea66e1239910968 release-0.7.30 +9fddd7e1a7a27f8463867f41a461aad57df461b2 release-0.7.31 +780b2ba1ec6daf6e3773774e26b05b9ff0d5483e release-0.7.32 +83027471a25385b1c671968be761e9aa7a8591a7 release-0.7.33 +1e9a362c3dcee221ca6e34308c483ed93867aca2 release-0.7.34 +c7ee9e15717b54ead5f4a554686e74abe66c6b07 release-0.7.35 +b84548abe9b9d4f4e203f848696e52c8c82c308f release-0.7.36 +3286f0bab8e77dbc7ebb370b1dc379592ccff123 release-0.7.37 +11a4e2ed5b166b9c9f119171aa399a9e3aa4684a release-0.7.38 +f822655d4120629977794c32d3b969343b6c30db release-0.7.39 +8a350e49d2b6751296db6d8e27277ccf63ed412a release-0.7.40 +c4a56c197eeafd71fc1caef7a9d890a330e3c23d release-0.7.41 +a9575a57a5443df39611774cf3840e9088132b0e release-0.7.42 +7503d95d6eadad14c28b2db183ba09848265274b release-0.7.43 +9be652e9114435fc6f1fdec84c0458d56702db91 release-0.7.44 +797e070d480a34b31ddac0d364784773f1bbbcf9 release-0.7.45 +9b5037e7ec7db25875c40f9d1cf20a853388b124 release-0.7.46 +d1d0e6d7ff0ca3c0dd1be1ef1cfff2e3fd0b4e1c release-0.7.47 +9816fb28eda599bfd53940e6d3b6617d1ecb6323 release-0.7.48 +452b9d09df8e3f2fb04b2a33d04d2f3a6436eb34 release-0.7.49 +e4350efa7cf7a0e868c2236a1137de8a33bd8ec6 release-0.7.50 +f51f2bec766c8b6d7e1799d904f18f8ea631bd44 release-0.7.51 +18e39e566781c9c187e2eb62bebd9d669d68f08c release-0.7.52 +b073eaa1dcea296a3488b83d455fab6621a73932 release-0.7.53 +01c6fe6c2a55998434cd3b05dd10ca487ac3fb6c release-0.7.54 +3ed9377e686f2521e6ec15873084381033fb490d release-0.7.55 +a1e44954549c35023b409f728c678be8bf898148 release-0.7.56 +fbb1918a85e38a7becdb1a001dbaf5933f23a919 release-0.7.57 +87f4a49a9cc34a5b11c8784cc5ea89e97b4b2bd8 release-0.7.58 +0c22cb4862c8beb4ee1b9e4627125162a29a5304 release-0.7.59 +82d56c2425ef857cd430b8530a3f9e1127145a67 release-0.8.0 +f4acb784b53cd952559567971b97dde1e818a2b6 release-0.8.1 +b3503597c1a0f0f378afdc5e5e5b85e2c095a4be release-0.8.2 +c98da980514a02ba81c421b25bf91803ffffddf3 release-0.8.3 +db34ec0c53c4b9dec12ffdf70caf89a325ab9577 release-0.8.4 +0914802433b8678ba2cdf91280766f00f4b9b76e release-0.8.5 +ff52ee9e6422f3759f43a442b7ba615595b3a3d4 release-0.8.6 +7607237b4829fff1f60999f4663c50ed9d5182f7 release-0.8.7 +1cef1807bc12cb05ac52fb0e7a0f111d3760b569 release-0.8.8 +a40f8475511d74a468ade29c1505e8986600d7a3 release-0.8.9 +2d9faf2260df6c3e5d4aa1781493c31f27a557d0 release-0.8.10 +d0d61c32331a6505381b5218318f7b69db167ca8 release-0.8.11 +ca7a1c6c798a7eb5b294d4ac3179ec87ecf297d3 release-0.8.12 +81c8277cd8ed55febcb2dd9d9213076f6c0ccb09 release-0.8.13 +3089486a8dc5844b5b6e9f78d536b4b26f7ffa16 release-0.8.14 +d364c2c12dd9723a2dfac3f096f5e55d4cfe6838 release-0.8.15 +52163a1027c3efd6b4c461b60a2ca6266c23e193 release-0.8.16 +06564e9a2d9ec5852132c212e85eda0bf1300307 release-0.8.17 +7aaa959da85e09e29bcac3b1cadec35b0a25b64d release-0.8.18 +4bc73c644329a510da4e96b7241b80ead7772f83 release-0.8.19 +ea3d168fb99c32a5c3545717ecc61e85a375e5dd release-0.8.20 +27951ca037e63dae45ff5b6279124c224ae1255a release-0.8.21 +d56c8b5df517c2bf6e7bc2827b8bf3e08cda90e1 release-0.8.22 +3c6ac062b379b126212cbb27e98a3c8275ef381a release-0.8.23 +89b9173476de14688b1418fbf7df10f91d1719ef release-0.8.24 +aa550cb4159ae0d566006e091fb1c7a888771050 release-0.8.25 +06ce92293f6a65651b08c466f90f55bd69984b98 release-0.8.26 +ea50b0d79ef1d7d901cd0e4dcd7373447849d719 release-0.8.27 +e68b1c35cad86105ff1c5b240f53442f4c36356e release-0.8.28 +78d3582a30afe63fc0adb17c3ac8891a64e47146 release-0.8.29 +9852c5965a3292a1b6127dbb4da9fce4912d898a release-0.8.30 +4f84115914490e572bcbee5069157b7334df2744 release-0.8.31 +59dee6f7f3afeb1fad6ed5983756e48c81ad2a5c release-0.8.32 +a4456378d234c07038456cf32bfe3c651f1d5e82 release-0.8.33 +21cb50799a20575a42f9733342d37a426f79db4d release-0.8.34 +7cb3cb8d78ef7ae63561733ed91fd07933896bc8 release-0.8.35 +aed68639d4eb6afe944b7fb50499c16f7f3f503c release-0.8.36 +265b7fd2ae21c75bbffa5115b83a0123d6c4acb4 release-0.8.37 +fa5f1ca353c0c5aa5415f51d72fd7bbcc02d1ed7 release-0.8.38 +af10bf9d4c6532850aa1f70cdf7504bd109b284c release-0.8.39 +4846ec9f83cb5bc4c8519d5641b35fb9b190430c release-0.8.40 +718b4cb3faf7efe4e0648140f064bf7a92c3f7e8 release-0.8.41 +b5a3065749093282ddd19845e0b77ffc2e54333e release-0.8.42 +34df9fb22fed415cdad52def04095dc6d4b48222 release-0.8.43 +00ec8cd76fb89af27363b76c40d9f88bf4679c3b release-0.8.44 +e16dd52a0d226c23dcae9a11252564a04753bbed release-0.8.45 +f034d9173df0a433e0bbcf5974f12ea9eb9076c0 release-0.8.46 +4434dc967087315efcd0658206a67fe6c85528f3 release-0.8.47 +0b65c962e0cd6783a854877b52c903cb058eec8c release-0.8.48 +a2b7e94b9807e981866bf07e37b715847d1b7120 release-0.8.49 +e7bdb8edc1bab2bc352a9fb6ce765c46575c35bf release-0.8.50 +21dacebd12f65cb57ceb8d2688db5b07fad6e06d release-0.8.51 +67dd7533b99c8945b5b8b5b393504d4e003a1c50 release-0.8.52 +010468d890dbac33a4cae6dfb2017db70721b2fe release-0.8.53 +62b599022a2fa625b526c2ad1711dc6db7d66786 release-0.9.0 +71281dd73b17a0ead5535d531afaee098da723cb release-0.9.1 +16cff36b0e49fc9fdeee13b2e92690286bcc1b3d release-0.9.2 +b7b306325972661117694879d3e22faf4cf0df32 release-0.9.3 +fe671505a8ea86a76f0358b3ec4de84a9037ac2b release-0.9.4 +70542931bc5436d1bbd38f152245d93ac063968d release-0.9.5 +27e2f3b7a3db1819c5d0ba28327ceaba84a13c4e release-0.9.6 +657d05d63915ce2f6c4d763091059f5f85bb10e5 release-0.9.7 +e0fd9f36005923b8f98d1ba1ea583cb7625f318f release-1.0.0 +f8f89eb4e0c27e857ec517d893d4f9a454985084 release-1.0.1 +c50df367648e53d55e80b60a447c9c66caa0d326 release-1.0.2 +80d586db316512b5a9d39f00fe185f7f91523f52 release-1.0.3 +c9c2805ac9245cc48ce6efeba2b4a444f859d6aa release-1.0.4 +fa2c37b1122c2c983b6e91d1188e387d72dde4d6 release-1.0.5 +f31aea5b06654c9163be5acd6d9b7aaf0fdf6b33 release-1.1.0 +44bf95f670656fae01ccb266b3863843ea13d324 release-1.1.1 +da1289482a143dfa016769649bdff636c26f53c8 release-1.1.2 +bac8ba08a6570bac2ecd3bf2ad64b0ac3030c903 release-1.1.3 +911060bc8221d4113a693ae97952a1fa88663ca8 release-1.1.4 +e47531dfabbf8e5f8b8aff9ff353642ea4aa7abb release-1.1.5 +f9ddecfe331462f870a95e4c1c3ba1bb8f19f2d3 release-1.1.6 +378c297bb7459fb99aa9c77decac0d35391a3932 release-1.1.7 +71600ce67510af093d4bc0117a78b3b4678c6b3a release-1.1.8 +482d7d907f1ab92b78084d8b8631ed0eb7dd08f7 release-1.1.9 +c7e65deabf0db5109e8d8f6cf64cd3fb7633a3d1 release-1.1.10 +9590f0cf5aab8e6e0b0c8ae59c70187b2b97d886 release-1.1.11 +ade8fc136430cfc04a8d0885c757968b0987d56c release-1.1.12 +6a6836e65827fd3cb10a406e7bbbe36e0dad8736 release-1.1.13 +6845f4ac909233f5a08ed8a51de137713a888328 release-1.1.14 +2397e9c72f1bc5eac67006e12ad3e33e0ea9ba74 release-1.1.15 +7b7c49639a7bceecabf4963c60b26b65a77d6ce0 release-1.1.16 +f7e1113a9a1648cad122543e7080e895cf2d88f4 release-1.1.17 +2b22743c3079b41233ded0fc35af8aa89bcfab91 release-1.1.18 +0f0b425659e0b26f5bc8ea14a42dbf34de2eaba6 release-1.1.19 +f582d662cc408eb7a132c21f4b298b71d0701abb release-1.2.0 +9ee68d629722f583d43d92271f2eb84281afc630 release-1.3.0 +61b6a3438afef630774e568eefd89c53e3b93287 release-1.3.1 +7ccd50a0a455f2f2d3b241f376e1193ad956196d release-1.2.1 +0000000000000000000000000000000000000000 release-1.2.1 +50107e2d96bbfc2c59e46f889b1a5f68dd10cf19 release-1.3.2 +2c5e1e88c8cf710caf551c5c67eba00443601efe release-1.3.3 +a43447fb82aa03eabcd85352758ae14606a84d35 release-1.3.4 +90f3b4ea7992a7bf9385851a3e77173363091eea release-1.3.5 +3aeb14f88daeb973e4708310daa3dc68ac1200f7 release-1.3.6 +dafd375f1c882b15fa4a9b7aa7c801c55082395e release-1.3.7 +ab7ce0eb4cf78a656750ab1d8e55ef61f7e535ec release-1.3.8 +1b1a9337a7399ad3cdc5e3a2f9fbaaec990271d5 release-1.3.9 +2c053b2572694eb9cd4aed26a498b6cb1f51bbcc release-1.3.10 +36409ac209872ce53019f084e4e07467c5d9d25e release-1.3.11 +560dc55e90c13860a79d8f3e0d67a81c7b0257bb release-1.3.12 +dc195ffe0965b2b9072f8e213fe74ecce38f6773 release-1.3.13 +e04428778567dd4de329bbbe97ad653e22801612 release-1.3.14 +cd84e467c72967b9f5fb4d96bfc708c93edeb634 release-1.3.15 +23159600bdea695db8f9d2890aaf73424303e49c release-1.3.16 +7809529022b83157067e7d1e2fb65d57db5f4d99 release-1.4.0 +48a84bc3ff074a65a63e353b9796ff2b14239699 release-1.5.0 +99eed1a88fc33f32d66e2ec913874dfef3e12fcc release-1.5.1 +5bdca4812974011731e5719a6c398b54f14a6d61 release-1.5.2 +644a079526295aca11c52c46cb81e3754e6ad4ad release-1.5.3 +376a5e7694004048a9d073e4feb81bb54ee3ba91 release-1.5.4 +60e0409b9ec7ee194c6d8102f0656598cc4a6cfe release-1.5.5 +70c5cd3a61cb476c2afb3a61826e59c7cda0b7a7 release-1.5.6 +9ba2542d75bf62a3972278c63561fc2ef5ec573a release-1.5.7 +eaa76f24975948b0ce8be01838d949122d44ed67 release-1.5.8 +5a1759f33b7fa6270e1617c08d7e655b7b127f26 release-1.5.9 +b798fc020e3a84ef68e6c9f47865a319c826d33c release-1.5.10 +f995a10d4c7e9a817157a6ce7b753297ad32897e release-1.5.11 +97b47d95e4449cbde976657cf8cbbc118351ffe0 release-1.5.12 +fd722b890eabc600394349730a093f50dac31639 release-1.5.13 +d161d68df8be32e5cbf72b07db1a707714827803 release-1.7.0 +0351a6d89c3dbcc7a76295024ba6b70e27b9a497 release-1.7.1 +0bd223a546192fdf2e862f33938f4ec2a3b5b283 release-1.7.2 +fe7cd01828d5ca7491059f0690bb4453645eb28b release-1.7.3 +cbb146b120296852e781079d5138b04495bab6df release-1.7.4 +fe129aa02db9001d220f1db7c3c056f79482c111 release-1.7.5 +a8d111bb68847f61d682a3c8792fecb2e52efa2c release-1.7.6 +6d2fbc30f8a7f70136cf08f32d5ff3179d524873 release-1.7.7 +d5ea659b8bab2d6402a2266efa691f705e84001e release-1.7.8 +34b201c1abd1e2d4faeae4650a21574771a03c0e release-1.7.9 +860cfbcc4606ee36d898a9cd0c5ae8858db984d6 release-1.7.10 +2b3b737b5456c05cd63d3d834f4fb4d3776953d0 release-1.7.11 +3ef00a71f56420a9c3e9cec311c9a2109a015d67 release-1.7.12 +53d850fe292f157d2fb999c52788ec1dc53c91ed release-1.9.0 +884a967c369f73ab16ea859670d690fb094d3850 release-1.9.1 +3a32d6e7404a79a0973bcd8d0b83181c5bf66074 release-1.9.2 +e27a215601292872f545a733859e06d01af1017d release-1.9.3 +5cb7e2eed2031e32d2e5422caf9402758c38a6ad release-1.9.4 +942475e10cb47654205ede7ccbe7d568698e665b release-1.9.5 +b78018cfaa2f0ec20494fccb16252daa87c48a31 release-1.9.6 +54117529e40b988590ea2d38aae909b0b191663f release-1.9.7 +1bdc497c81607d854e3edf8b9a3be324c3d136b6 release-1.9.8 +ef107f3ddc237a3007e2769ec04adde0dcf627fa release-1.9.9 +be00ca08e41a69e585b6aff70a725ed6c9e1a876 release-1.9.10 +fe66cff450a95beed36a2515210eb2d7ef62c9d3 release-1.9.11 +ead3907d74f90a14d1646f1b2b56ba01d3d11702 release-1.9.12 +5936b7ed929237f1a73b467f662611cdc0309e51 release-1.9.13 +4106db71cbcb9c8274700199ac17e520902c6c0f release-1.9.14 +13070ecfda67397985f0e986eb9c42ecb46d05b5 release-1.9.15 +271ee30c6791847980cd139d31807541f5e569bf release-1.11.0 +cb783d9cc19761e14e1285d91c38f4b84d0b8756 release-1.11.1 +4d3b3a13a8cf5fc3351a7f167d1c13325e00f21c release-1.11.2 +b83a067949a3384a49fd3d943eb8d0997b31f87b release-1.11.3 +953512ca02c6f63b4fcbbc3e10d0d9835896bf99 release-1.11.4 +5253015a339aaca0a3111473d3e931b6d4752393 release-1.11.5 +5e371426b3bcba4312ce08606194b89b758927d1 release-1.11.6 +5c8f60faf33ca8926473d2da27b4c3c417bd4630 release-1.11.7 +4591da489a30f790def29bc5987f43409b503cae release-1.11.8 +20a45c768e5ed26b740679d0e22045c98727c3cc release-1.11.9 +1ad0999a7ded3d4fb01c7acf8ff57c80b643da7e release-1.11.10 +d8b321a876d6254e9e98795e3b194ef053290354 release-1.11.11 +7f394e433f0003222aa6531931ecc0b24740d5e4 release-1.11.12 +3d0e8655f897959e48cc74e87670bb5492a58871 release-1.11.13 +3671096a45bce570a2afa20b9faf42c7fb0f7e66 release-1.13.0 +539f7893ecb96bee60965528c8958d7eb2f1ce6b release-1.13.1 +5be2b25bdc65775a85f18f68a4be4f58c7384415 release-1.13.2 +8457ce87640f9bfe6221c4ac4466ced20e03bebe release-1.13.3 +bbc642c813c829963ce8197c0ca237ab7601f3d4 release-1.13.4 +0d45b4cf7c2e4e626a5a16e1fe604402ace1cea5 release-1.13.5 +f87da7d9ca02b8ced4caa6c5eb9013ccd47b0117 release-1.13.6 +47cca243d0ed39bf5dcb9859184affc958b79b6f release-1.13.7 +20ca4bcff108d3e66977f4d97508637093492287 release-1.13.8 +fb1212c7eca4c5328fe17d6cd95b010c67336aac release-1.13.9 +31c929e16910c38492581ef474e72fa67c28f124 release-1.13.10 +64179f242cb55fc206bca59de9bfdc4cf5ebcec7 release-1.13.11 +051e5fa03b92b8a564f6b12debd483d267391e82 release-1.13.12 +990b3e885636d763b97ed02d0d2cfc161a4e0c09 release-1.15.0 +4189160cb946bb38d0bc0a452b5eb4cdd8979fb5 release-1.15.1 +b234199c7ed8a156a6bb98f7ff58302c857c954f release-1.15.2 +28b3e17ca7eba1e6a0891afde0e4bc5bcc99c861 release-1.15.3 +49d49835653857daa418e68d6cbfed4958c78fca release-1.15.4 +f062e43d74fc2578bb100a9e82a953efa1eb9e4e release-1.15.5 +2351853ce6867b6166823bdf94333c0a76633c0a release-1.15.6 +051a039ce1c7e09144de4a4846669ec7116cecea release-1.15.7 +ee551e3f6dba336c0d875e266d7d55385f379b42 release-1.15.8 +d2fd76709909767fc727a5b4affcf1dc9ca488a7 release-1.15.9 +75f5c7f628411c79c7044102049f7ab4f7a246e7 release-1.15.10 +5155d0296a5ef9841f035920527ffdb771076b44 release-1.15.11 +0130ca3d58437b3c7c707cdddd813d530c68da9a release-1.15.12 +054c1c46395caff79bb4caf16f40b331f71bb6dd release-1.17.0 +7816bd7dabf6ee86c53c073b90a7143161546e06 release-1.17.1 +2fc9f853a6b7cd29dc84e0af2ed3cf78e0da6ca8 release-1.17.2 +ed4303aa1b31a9aad5440640c0840d9d0af45fed release-1.17.3 +ce2ced3856909f36f8130c99eaa4dbdbae636ddc release-1.17.4 +9af0dddbddb2c368bfedd2801bc100ffad01e19b release-1.17.5 +de68d0d94320cbf033599c6f3ca37e5335c67fd7 release-1.17.6 +e56295fe0ea76bf53b06bffa77a2d3a9a335cb8c release-1.17.7 +fdacd273711ddf20f778c1fb91529ab53979a454 release-1.17.8 +5e8d52bca714d4b85284ddb649d1ba4a3ca978a8 release-1.17.9 +c44970de01474f6f3e01b0adea85ec1d03e3a5f2 release-1.17.10 +cbe6ba650211541310618849168631ce0b788f35 release-1.19.0 +062920e2f3bf871ef7a3d8496edec1b3065faf80 release-1.19.1 +a7b46539f507e6c64efa0efda69ad60b6f4ffbce release-1.19.2 +3cbc2602325f0ac08917a4397d76f5155c34b7b1 release-1.19.3 +dc0cc425fa63a80315f6efb68697cadb6626cdf2 release-1.19.4 +8e5b068f761cd512d10c9671fbde0b568c1fd08b release-1.19.5 +f618488eb769e0ed74ef0d93cd118d2ad79ef94d release-1.19.6 +3fa6e2095a7a51acc630517e1c27a7b7ac41f7b3 release-1.19.7 +8c65d21464aaa5923775f80c32474adc7a320068 release-1.19.8 +da571b8eaf8f30f36c43b3c9b25e01e31f47149c release-1.19.9 +ffcbb9980ee2bad27b4d7b1cd680b14ff47b29aa release-1.19.10 +df34dcc9ac072ffd0945e5a1f3eb7987e8275375 release-1.21.0 +a68ac0677f8553b1f84d357bc9da114731ab5f47 release-1.21.1 +bfbc52374adcbf2f9060afd62de940f6fab3bba5 release-1.21.2 +2217a9c1d0b86026f22700b3c089545db1964f55 release-1.21.3 +39be8a682c58308d9399cddd57e37f9fdb7bdf3e release-1.21.4 +d986378168fd4d70e0121cabac274c560cca9bdf release-1.21.5 +714eb4b2c09e712fb2572a2164ce2bf67638ccac release-1.21.6 +5da2c0902e8e2aa4534008a582a60c61c135960e release-1.23.0 +a63d0a70afea96813ba6667997bc7d68b5863f0d release-1.23.1 +aa901551a7ebad1e8b0f8c11cb44e3424ba29707 release-1.23.2 +ff3afd1ce6a6b65057741df442adfaa71a0e2588 release-1.23.3 +ac779115ed6ee4f3039e9aea414a54e560450ee2 release-1.23.4 +12dcf92b0c2c68552398f19644ce3104459807d7 release-1.25.0 +f8134640e8615448205785cf00b0bc810489b495 release-1.25.1 +1d839f05409d1a50d0f15a2bf36547001f99ae40 release-1.25.2 +294a3d07234f8f65d7b0e0b0e2c5b05c12c5da0a release-1.25.3 +173a0a7dbce569adbb70257c6ec4f0f6bc585009 release-1.25.4 +8618e4d900cc71082fbe7dc72af087937d64faf5 release-1.25.5 +a58202a8c41bf0bd97eef1b946e13105a105520d release-1.26.0 +a63c124e34bcf2d1d1feb8d40ff075103b967c4c release-1.26.1 +e4c5da06073ca24e2ffc5c8f8b8d7833a926356f release-1.26.2 diff --git a/CHANGES b/CHANGES index 49e47de..9c2fb00 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,28 @@ +Changes with nginx 1.26.3 05 Feb 2025 + + *) Security: insufficient check in virtual servers handling with TLSv1.3 + SNI allowed to reuse SSL sessions in a different virtual server, to + bypass client SSL certificates verification (CVE-2025-23419). + + *) Bugfix: in the ngx_http_mp4_module. + Thanks to Nils Bars. + + *) Workaround: "gzip filter failed to use preallocated memory" alerts + appeared in logs when using zlib-ng. + + *) Bugfix: nginx could not build libatomic library using the library + sources if the --with-libatomic=DIR option was used. + + *) Bugfix: nginx now ignores QUIC version negotiation packets from + clients. + + *) Bugfix: nginx could not be built on Solaris 10 and earlier with the + ngx_http_v3_module. + + *) Bugfixes in HTTP/3. + + Changes with nginx 1.26.2 14 Aug 2024 *) Security: processing of a specially crafted mp4 file by the diff --git a/CHANGES.ru b/CHANGES.ru index aaa0f5f..0d1ba20 100644 --- a/CHANGES.ru +++ b/CHANGES.ru @@ -1,4 +1,29 @@ +Изменения в nginx 1.26.3 05.02.2025 + + *) Безопасность: недостаточная проверка в обработке виртуальных серверов + при использовании SNI в TLSv1.3 позволяла повторно использовать + SSL-сессию в контексте другого виртуального сервера, чтобы обойти + проверку клиентских SSL-сертификатов (CVE-2025-23419). + + *) Исправление: в модуле ngx_http_mp4_module. + Спасибо Nils Bars. + + *) Изменение: при использовании zlib-ng в логах появлялись сообщения + "gzip filter failed to use preallocated memory". + + *) Исправление: nginx не мог собрать библиотеку libatomic из исходных + текстов, если использовался параметр --with-libatomic=DIR. + + *) Исправление: теперь nginx игнорирует пакеты согласования версий QUIC + от клиентов. + + *) Исправление: nginx не собирался на Solaris 10 и более ранних с + модулем ngx_http_v3_module. + + *) Исправления в HTTP/3. + + Изменения в nginx 1.26.2 14.08.2024 *) Безопасность: обработка специально созданного mp4-файла модулем diff --git a/auto/lib/libatomic/conf b/auto/lib/libatomic/conf index 8c8cb43..dfdc1a6 100644 --- a/auto/lib/libatomic/conf +++ b/auto/lib/libatomic/conf @@ -7,8 +7,8 @@ if [ $NGX_LIBATOMIC != YES ]; then have=NGX_HAVE_LIBATOMIC . auto/have CORE_INCS="$CORE_INCS $NGX_LIBATOMIC/src" - LINK_DEPS="$LINK_DEPS $NGX_LIBATOMIC/src/libatomic_ops.a" - CORE_LIBS="$CORE_LIBS $NGX_LIBATOMIC/src/libatomic_ops.a" + LINK_DEPS="$LINK_DEPS $NGX_LIBATOMIC/build/lib/libatomic_ops.a" + CORE_LIBS="$CORE_LIBS $NGX_LIBATOMIC/build/lib/libatomic_ops.a" else diff --git a/auto/lib/libatomic/make b/auto/lib/libatomic/make index c90318e..530c746 100644 --- a/auto/lib/libatomic/make +++ b/auto/lib/libatomic/make @@ -3,14 +3,19 @@ # Copyright (C) Nginx, Inc. + case $NGX_LIBATOMIC in + /*) ngx_prefix="$NGX_LIBATOMIC/build" ;; + *) ngx_prefix="$PWD/$NGX_LIBATOMIC/build" ;; + esac + cat << END >> $NGX_MAKEFILE -$NGX_LIBATOMIC/src/libatomic_ops.a: $NGX_LIBATOMIC/Makefile - cd $NGX_LIBATOMIC && \$(MAKE) +$NGX_LIBATOMIC/build/lib/libatomic_ops.a: $NGX_LIBATOMIC/Makefile + cd $NGX_LIBATOMIC && \$(MAKE) && \$(MAKE) install $NGX_LIBATOMIC/Makefile: $NGX_MAKEFILE cd $NGX_LIBATOMIC \\ && if [ -f Makefile ]; then \$(MAKE) distclean; fi \\ - && ./configure + && ./configure --prefix=$ngx_prefix END diff --git a/auto/lib/pcre/make b/auto/lib/pcre/make index 839ef29..182590a 100644 --- a/auto/lib/pcre/make +++ b/auto/lib/pcre/make @@ -36,7 +36,8 @@ if [ $PCRE_LIBRARY = PCRE2 ]; then pcre2_valid_utf.c \ pcre2_xclass.c" - ngx_pcre_test="pcre2_convert.c \ + ngx_pcre_test="pcre2_chkdint.c \ + pcre2_convert.c \ pcre2_extuni.c \ pcre2_find_bracket.c \ pcre2_script_run.c \ diff --git a/src/core/nginx.h b/src/core/nginx.h index d29edd2..ef000e0 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -9,8 +9,8 @@ #define _NGINX_H_INCLUDED_ -#define nginx_version 1026002 -#define NGINX_VERSION "1.26.2" +#define nginx_version 1026003 +#define NGINX_VERSION "1.26.3" #define NGINX_VER "nginx/" NGINX_VERSION #ifdef NGX_BUILD diff --git a/src/event/quic/ngx_event_quic_openssl_compat.c b/src/event/quic/ngx_event_quic_openssl_compat.c index c7412e8..6052bc6 100644 --- a/src/event/quic/ngx_event_quic_openssl_compat.c +++ b/src/event/quic/ngx_event_quic_openssl_compat.c @@ -391,6 +391,7 @@ SSL_set_quic_method(SSL *ssl, const SSL_QUIC_METHOD *quic_method) wbio = BIO_new(BIO_s_null()); if (wbio == NULL) { + BIO_free(rbio); return 0; } diff --git a/src/event/quic/ngx_event_quic_output.c b/src/event/quic/ngx_event_quic_output.c index ce6aaab..f087e2b 100644 --- a/src/event/quic/ngx_event_quic_output.c +++ b/src/event/quic/ngx_event_quic_output.c @@ -411,7 +411,7 @@ ngx_quic_send_segments(ngx_connection_t *c, u_char *buf, size_t len, ngx_memzero(msg_control, sizeof(msg_control)); iov.iov_len = len; - iov.iov_base = buf; + iov.iov_base = (void *) buf; msg.msg_iov = &iov; msg.msg_iovlen = 1; @@ -699,7 +699,7 @@ ngx_quic_send(ngx_connection_t *c, u_char *buf, size_t len, ngx_memzero(&msg, sizeof(struct msghdr)); iov.iov_len = len; - iov.iov_base = buf; + iov.iov_base = (void *) buf; msg.msg_iov = &iov; msg.msg_iovlen = 1; diff --git a/src/event/quic/ngx_event_quic_streams.c b/src/event/quic/ngx_event_quic_streams.c index 178b805..a9a21f5 100644 --- a/src/event/quic/ngx_event_quic_streams.c +++ b/src/event/quic/ngx_event_quic_streams.c @@ -174,7 +174,7 @@ ngx_int_t ngx_quic_close_streams(ngx_connection_t *c, ngx_quic_connection_t *qc) { ngx_pool_t *pool; - ngx_queue_t *q; + ngx_queue_t *q, posted_events; ngx_rbtree_t *tree; ngx_connection_t *sc; ngx_rbtree_node_t *node; @@ -197,6 +197,8 @@ ngx_quic_close_streams(ngx_connection_t *c, ngx_quic_connection_t *qc) return NGX_OK; } + ngx_queue_init(&posted_events); + node = ngx_rbtree_min(tree->root, tree->sentinel); while (node) { @@ -213,15 +215,21 @@ ngx_quic_close_streams(ngx_connection_t *c, ngx_quic_connection_t *qc) } sc->read->error = 1; + sc->read->ready = 1; sc->write->error = 1; - - ngx_quic_set_event(sc->read); - ngx_quic_set_event(sc->write); + sc->write->ready = 1; sc->close = 1; - sc->read->handler(sc->read); + + if (sc->read->posted) { + ngx_delete_posted_event(sc->read); + } + + ngx_post_event(sc->read, &posted_events); } + ngx_event_process_posted((ngx_cycle_t *) ngx_cycle, &posted_events); + if (tree->root == tree->sentinel) { return NGX_OK; } diff --git a/src/event/quic/ngx_event_quic_transport.c b/src/event/quic/ngx_event_quic_transport.c index fba098c..bb13447 100644 --- a/src/event/quic/ngx_event_quic_transport.c +++ b/src/event/quic/ngx_event_quic_transport.c @@ -295,6 +295,11 @@ ngx_quic_parse_packet(ngx_quic_header_t *pkt) return NGX_ERROR; } + if (pkt->version == 0) { + /* version negotiation */ + return NGX_ERROR; + } + if (!ngx_quic_supported_version(pkt->version)) { return NGX_ABORT; } diff --git a/src/http/modules/ngx_http_gzip_filter_module.c b/src/http/modules/ngx_http_gzip_filter_module.c index b555278..7113df6 100644 --- a/src/http/modules/ngx_http_gzip_filter_module.c +++ b/src/http/modules/ngx_http_gzip_filter_module.c @@ -516,8 +516,10 @@ ngx_http_gzip_filter_memory(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx) /* * Another zlib variant, https://github.com/zlib-ng/zlib-ng. * It used to force window bits to 13 for fast compression level, - * uses (64 + sizeof(void*)) additional space on all allocations - * for alignment, 16-byte padding in one of window-sized buffers, + * used (64 + sizeof(void*)) additional space on all allocations + * for alignment and 16-byte padding in one of window-sized buffers, + * uses a single allocation with up to 200 bytes for alignment and + * internal pointers, 5/4 times more memory for the pending buffer, * and 128K hash. */ @@ -526,7 +528,7 @@ ngx_http_gzip_filter_memory(ngx_http_request_t *r, ngx_http_gzip_ctx_t *ctx) } ctx->allocated = 8192 + 16 + (1 << (wbits + 2)) - + 131072 + (1 << (memlevel + 8)) + + 131072 + (5 << (memlevel + 6)) + 4 * (64 + sizeof(void*)); ctx->zlib_ng = 1; } diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c index 041ad26..b7bd192 100644 --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c @@ -3176,7 +3176,10 @@ ngx_http_mp4_crop_stsc_data(ngx_http_mp4_file_t *mp4, start_sample -= n; - prev_samples = samples; + if (next_chunk > chunk) { + prev_samples = samples; + } + chunk = next_chunk; samples = ngx_mp4_get_32value(entry->samples); id = ngx_mp4_get_32value(entry->id); @@ -3186,6 +3189,13 @@ ngx_http_mp4_crop_stsc_data(ngx_http_mp4_file_t *mp4, next_chunk = trak->chunks + 1; + if (next_chunk < chunk) { + ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, + "unordered mp4 stsc chunks in \"%s\"", + mp4->file.name.data); + return NGX_ERROR; + } + ngx_log_debug4(NGX_LOG_DEBUG_HTTP, mp4->file.log, 0, "sample:%uD, chunk:%uD, chunks:%uD, samples:%uD", start_sample, chunk, next_chunk - chunk, samples); @@ -3211,6 +3221,12 @@ found: return NGX_ERROR; } + if (chunk == 0) { + ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0, + "zero chunk in \"%s\"", mp4->file.name.data); + return NGX_ERROR; + } + target_chunk = chunk - 1; target_chunk += start_sample / samples; chunk_samples = start_sample % samples; diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index 3cca57c..9593b7f 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c @@ -932,6 +932,31 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg) goto done; } + sscf = ngx_http_get_module_srv_conf(cscf->ctx, ngx_http_ssl_module); + +#if (defined TLS1_3_VERSION \ + && !defined LIBRESSL_VERSION_NUMBER && !defined OPENSSL_IS_BORINGSSL) + + /* + * SSL_SESSION_get0_hostname() is only available in OpenSSL 1.1.1+, + * but servername being negotiated in every TLSv1.3 handshake + * is only returned in OpenSSL 1.1.1+ as well + */ + + if (sscf->verify) { + const char *hostname; + + hostname = SSL_SESSION_get0_hostname(SSL_get0_session(ssl_conn)); + + if (hostname != NULL && ngx_strcmp(hostname, servername) != 0) { + c->ssl->handshake_rejected = 1; + *ad = SSL_AD_ACCESS_DENIED; + return SSL_TLSEXT_ERR_ALERT_FATAL; + } + } + +#endif + hc->ssl_servername = ngx_palloc(c->pool, sizeof(ngx_str_t)); if (hc->ssl_servername == NULL) { goto error; @@ -945,8 +970,6 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg) ngx_set_connection_log(c, clcf->error_log); - sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module); - c->ssl->buffer_size = sscf->buffer_size; if (sscf->ssl.ctx) { diff --git a/src/stream/ngx_stream_ssl_module.c b/src/stream/ngx_stream_ssl_module.c index ba44477..6dee106 100644 --- a/src/stream/ngx_stream_ssl_module.c +++ b/src/stream/ngx_stream_ssl_module.c @@ -521,12 +521,35 @@ ngx_stream_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg) goto done; } + sscf = ngx_stream_get_module_srv_conf(cscf->ctx, ngx_stream_ssl_module); + +#if (defined TLS1_3_VERSION \ + && !defined LIBRESSL_VERSION_NUMBER && !defined OPENSSL_IS_BORINGSSL) + + /* + * SSL_SESSION_get0_hostname() is only available in OpenSSL 1.1.1+, + * but servername being negotiated in every TLSv1.3 handshake + * is only returned in OpenSSL 1.1.1+ as well + */ + + if (sscf->verify) { + const char *hostname; + + hostname = SSL_SESSION_get0_hostname(SSL_get0_session(ssl_conn)); + + if (hostname != NULL && ngx_strcmp(hostname, servername) != 0) { + c->ssl->handshake_rejected = 1; + *ad = SSL_AD_ACCESS_DENIED; + return SSL_TLSEXT_ERR_ALERT_FATAL; + } + } + +#endif + s->srv_conf = cscf->ctx->srv_conf; ngx_set_connection_log(c, cscf->error_log); - sscf = ngx_stream_get_module_srv_conf(s, ngx_stream_ssl_module); - if (sscf->ssl.ctx) { if (SSL_set_SSL_CTX(ssl_conn, sscf->ssl.ctx) == NULL) { goto error; From c5cca14382978b08a86f6aecf0767c0ee49c3a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Wed, 5 Feb 2025 19:07:54 +0100 Subject: [PATCH 06/18] Bump ABI --- debian/libnginx-mod.abisubstvars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/libnginx-mod.abisubstvars b/debian/libnginx-mod.abisubstvars index 21d5511..57261d4 100644 --- a/debian/libnginx-mod.abisubstvars +++ b/debian/libnginx-mod.abisubstvars @@ -8,4 +8,4 @@ # changes without upgrading the upstream nginx version, e.g. security updates # in oldstable -nginx:abi=nginx-abi-1.26.2-1 +nginx:abi=nginx-abi-1.26.3-1 From 58f592a8ab0e66fc979a6552e0d770b2cfbad015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Wed, 5 Feb 2025 19:08:06 +0100 Subject: [PATCH 07/18] Release --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 469fb8b..0597f2f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nginx (1.26.3-1) experimental; urgency=medium + + * Team upload + * New upstream version 1.26.3 + + -- Jérémy Lal Wed, 05 Feb 2025 19:08:02 +0100 + nginx (1.26.2-1) experimental; urgency=medium * Team upload From c789199d370d353157519250d7ef5930defe1942 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Fri, 7 Feb 2025 12:53:15 +0100 Subject: [PATCH 08/18] Release to unstable --- debian/changelog | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0597f2f..d75820b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nginx (1.26.3-2) unstable; urgency=medium + + * Team upload + * Upload to unstable + + -- Jérémy Lal Fri, 07 Feb 2025 12:53:11 +0100 + nginx (1.26.3-1) experimental; urgency=medium * Team upload From 3ef9946d9dbc44bd19cd5e193d7cc80072e9acfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Wed, 12 Feb 2025 19:36:44 +0100 Subject: [PATCH 09/18] d/changelog: fix whitespace in 1.26.3-2 record --- debian/changelog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/debian/changelog b/debian/changelog index d75820b..0870922 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,13 @@ +nginx (1.26.3-3) UNRELEASED; urgency=medium + + * d/changelog: fix whitespace in 1.26.3-2 record + + -- Jan Mojžíš Wed, 12 Feb 2025 19:37:40 +0100 + nginx (1.26.3-2) unstable; urgency=medium * Team upload - * Upload to unstable + * Upload to unstable -- Jérémy Lal Fri, 07 Feb 2025 12:53:11 +0100 From 6c57927b8d95a6c61c855e24b29132567f122ad5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Wed, 12 Feb 2025 19:43:05 +0100 Subject: [PATCH 10/18] d/control: add libnginx-mod-http-lua dependency for nginx-extras package for riscv64 platform --- debian/changelog | 2 ++ debian/control | 2 +- debian/tests/control | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/changelog b/debian/changelog index 0870922..0f2ce75 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,8 @@ nginx (1.26.3-3) UNRELEASED; urgency=medium * d/changelog: fix whitespace in 1.26.3-2 record + * d/control: add libnginx-mod-http-lua dependency for nginx-extras package + for riscv64 platform -- Jan Mojžíš Wed, 12 Feb 2025 19:37:40 +0100 diff --git a/debian/control b/debian/control index 4f36832..47749f4 100644 --- a/debian/control +++ b/debian/control @@ -198,7 +198,7 @@ Depends: nginx (= ${binary:Version}), libnginx-mod-http-fancyindex, libnginx-mod-http-geoip2, libnginx-mod-http-headers-more-filter, - libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x powerpc], + libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x riscv64 powerpc], libnginx-mod-http-subs-filter, libnginx-mod-http-uploadprogress, libnginx-mod-http-upstream-fair, diff --git a/debian/tests/control b/debian/tests/control index 880cc6d..b8c6569 100644 --- a/debian/tests/control +++ b/debian/tests/control @@ -31,7 +31,7 @@ Depends: nginx-core, libnginx-mod-http-geoip2, libnginx-mod-http-headers-more-filter, libnginx-mod-http-image-filter, - libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x powerpc], + libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x riscv64 powerpc], libnginx-mod-http-perl, libnginx-mod-http-subs-filter, libnginx-mod-http-uploadprogress, @@ -62,7 +62,7 @@ Depends: nginx-full, libnginx-mod-http-geoip2, libnginx-mod-http-headers-more-filter, libnginx-mod-http-image-filter, - libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x powerpc], + libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x riscv64 powerpc], libnginx-mod-http-perl, libnginx-mod-http-subs-filter, libnginx-mod-http-uploadprogress, @@ -93,7 +93,7 @@ Depends: nginx-light, libnginx-mod-http-geoip2, libnginx-mod-http-headers-more-filter, libnginx-mod-http-image-filter, - libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x powerpc], + libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x riscv64 powerpc], libnginx-mod-http-perl, libnginx-mod-http-subs-filter, libnginx-mod-http-uploadprogress, @@ -124,7 +124,7 @@ Depends: nginx-extras, libnginx-mod-http-geoip2, libnginx-mod-http-headers-more-filter, libnginx-mod-http-image-filter, - libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x powerpc], + libnginx-mod-http-lua [amd64 arm64 armel armhf i386 mips64el mipsel s390x riscv64 powerpc], libnginx-mod-http-perl, libnginx-mod-http-subs-filter, libnginx-mod-http-uploadprogress, From 54cc7989701eb5d8ff561c6891f0a819cc54dcae Mon Sep 17 00:00:00 2001 From: Thomas Ward Date: Sun, 23 Feb 2025 18:17:04 +0000 Subject: [PATCH 11/18] Fix DebBug #1098477, salsa issue nginx-team/nginx:#23 --- debian/changelog | 7 +++++++ debian/nginx-common.nginx.service | 1 + 2 files changed, 8 insertions(+) diff --git a/debian/changelog b/debian/changelog index 0f2ce75..c1224e3 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,9 +1,16 @@ nginx (1.26.3-3) UNRELEASED; urgency=medium + [ Jan Mojžíš ] * d/changelog: fix whitespace in 1.26.3-2 record * d/control: add libnginx-mod-http-lua dependency for nginx-extras package for riscv64 platform + [ Thomas Ward ] + * d/nginx-common.nginx.service: Add ConditionFileIsExecutable to + SystemD service file, prevents starting of service if nginx is + not installed (which can happen if nginx-common is installed + independently from `nginx` itself (Closes: #1098477) + -- Jan Mojžíš Wed, 12 Feb 2025 19:37:40 +0100 nginx (1.26.3-2) unstable; urgency=medium diff --git a/debian/nginx-common.nginx.service b/debian/nginx-common.nginx.service index a63fa0f..510c542 100644 --- a/debian/nginx-common.nginx.service +++ b/debian/nginx-common.nginx.service @@ -25,6 +25,7 @@ ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid TimeoutStopSec=5 KillMode=mixed +ConditionFileIsExecutable=/usr/sbin/nginx [Install] WantedBy=multi-user.target From bfbdc5aef2d486391f4ca542c23d6ecf52b34d72 Mon Sep 17 00:00:00 2001 From: Thomas Ward Date: Mon, 24 Feb 2025 20:42:35 +0000 Subject: [PATCH 12/18] Move ConditionFileIsExecutable to proper section --- debian/nginx-common.nginx.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/nginx-common.nginx.service b/debian/nginx-common.nginx.service index 510c542..cb759f6 100644 --- a/debian/nginx-common.nginx.service +++ b/debian/nginx-common.nginx.service @@ -15,6 +15,7 @@ Description=A high performance web server and a reverse proxy server Documentation=man:nginx(8) After=network-online.target remote-fs.target nss-lookup.target Wants=network-online.target +ConditionFileIsExecutable=/usr/sbin/nginx [Service] Type=forking @@ -25,7 +26,6 @@ ExecReload=/usr/sbin/nginx -g 'daemon on; master_process on;' -s reload ExecStop=-/sbin/start-stop-daemon --quiet --stop --retry QUIT/5 --pidfile /run/nginx.pid TimeoutStopSec=5 KillMode=mixed -ConditionFileIsExecutable=/usr/sbin/nginx [Install] WantedBy=multi-user.target From 653827e5a861000e0700f2d837dec6262e2188f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Moj=C5=BE=C3=AD=C5=A1?= Date: Thu, 15 May 2025 15:32:06 +0200 Subject: [PATCH 13/18] release nginx 1.26.3-3, upload to unstable --- debian/changelog | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index c1224e3..8ec0edd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -nginx (1.26.3-3) UNRELEASED; urgency=medium +nginx (1.26.3-3) unstable; urgency=medium [ Jan Mojžíš ] * d/changelog: fix whitespace in 1.26.3-2 record @@ -11,7 +11,7 @@ nginx (1.26.3-3) UNRELEASED; urgency=medium not installed (which can happen if nginx-common is installed independently from `nginx` itself (Closes: #1098477) - -- Jan Mojžíš Wed, 12 Feb 2025 19:37:40 +0100 + -- Jan Mojžíš Thu, 15 May 2025 15:31:38 +0200 nginx (1.26.3-2) unstable; urgency=medium From 67b2e7933cd9823cc8a5a1627cc90ecacb1b891d Mon Sep 17 00:00:00 2001 From: wrapper Date: Tue, 15 Jul 2025 15:05:37 +0700 Subject: [PATCH 14/18] sid init --- .gitignore | 9 ++++++ configure.docker.sh | 69 +++++++++++++++++++++++++++++++++++++++++++++ configure.sh | 66 +++++++++++++++++++++++++++++++++++++++++++ modules/PLACEHOLDER | 0 4 files changed, 144 insertions(+) create mode 100644 .gitignore create mode 100755 configure.docker.sh create mode 100755 configure.sh create mode 100644 modules/PLACEHOLDER diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3f04d13 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +objs/* +!objs/ndk_* +.pc/ +.vscode/ +modules/media-framework/ +modules/nginx-srt-module/ +modules/nginx-vod-module/ +Makefile +*.orig \ No newline at end of file diff --git a/configure.docker.sh b/configure.docker.sh new file mode 100755 index 0000000..f99417d --- /dev/null +++ b/configure.docker.sh @@ -0,0 +1,69 @@ +#!/bin/bash +./configure \ + --with-cc-opt="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -I/tmp/build/quickjs/" \ + --with-ld-opt="-Wl,-z,relro -Wl,-z,now -fPIC -L/tmp/build/quickjs/" \ + --sbin-path=/usr/local/sbin/nginx \ + --conf-path=/video_server/nginx/nginx.conf \ + --error-log-path=/var/log/nginx/error.log \ + --pid-path=/var/run/nginx/nginx.pid \ + --lock-path=/var/lock/nginx/nginx.lock \ + --http-log-path=/var/log/nginx/access.log \ + --http-client-body-temp-path=/tmp/nginx-client-body \ + --with-compat \ + --with-debug \ + --with-pcre-jit \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_auth_request_module \ + --with-http_v2_module \ + --with-http_dav_module \ + --with-http_slice_module \ + --with-threads \ + --with-http_addition_module \ + --with-http_flv_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_mp4_module \ + --with-http_random_index_module \ + --with-http_secure_link_module \ + --with-http_sub_module \ + --with-mail_ssl_module \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-stream_realip_module \ + --with-http_geoip_module=dynamic \ + --with-http_image_filter_module=dynamic \ + --with-http_perl_module=dynamic \ + --with-http_xslt_module=dynamic \ + --with-mail=dynamic \ + --with-stream=dynamic \ + --with-stream_geoip_module=dynamic \ + --add-module=./modules_deb/libnginx-mod-http-ndk-0.3.2 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-brotli-1.0.0~rc \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-cache-purge-2.3 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-echo-0.63 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-geoip2-3.4 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-headers-more-filter-0.34\ + --add-dynamic-module=./modules_deb/libnginx-mod-http-memc-0.19 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-set-misc-0.33 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-srcache-filter-0.33 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-subs-filter-0.6.4 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409 \ + --add-dynamic-module=./modules_deb/libnginx-mod-nchan-1.3.6+dfsg \ + --add-dynamic-module=./modules/njs/nginx \ + --add-module=./modules/media-framework/nginx-common \ + --add-dynamic-module=./modules/nginx-stream-preread-str-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-in-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-out-module \ + --add-dynamic-module=./modules/media-framework/nginx-rtmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-rtmp-kmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-mpegts-module \ + --add-dynamic-module=./modules/media-framework/nginx-mpegts-kmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-cc-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-rtmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-live-module \ + --add-dynamic-module=./modules/nginx-srt-module \ + --add-dynamic-module=./modules/media-framework/nginx-pckg-module \ + --add-dynamic-module=./modules/nginx-vod-module \ + --add-dynamic-module=./modules/nginx-secure-token-module \ No newline at end of file diff --git a/configure.sh b/configure.sh new file mode 100755 index 0000000..6d76886 --- /dev/null +++ b/configure.sh @@ -0,0 +1,66 @@ +#!/bin/bash +./configure \ + --with-cc-opt="-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -fPIC -D_FORTIFY_SOURCE=2 -I/usr/local/include/quickjs/" \ + --with-ld-opt="-Wl,-z,relro -Wl,-z,now -fPIC -L/usr/local/lib/quickjs/" \ + --prefix=/usr/local/temp/nginx/ \ + --error-log-path=stderr \ + --lock-path=/var/lock/nginx.lock \ + --pid-path=/run/nginx.pid \ + --with-compat \ + --with-debug \ + --with-pcre-jit \ + --with-http_ssl_module \ + --with-http_stub_status_module \ + --with-http_realip_module \ + --with-http_auth_request_module \ + --with-http_v2_module \ + --with-http_dav_module \ + --with-http_slice_module \ + --with-threads \ + --with-http_addition_module \ + --with-http_flv_module \ + --with-http_gunzip_module \ + --with-http_gzip_static_module \ + --with-http_mp4_module \ + --with-http_random_index_module \ + --with-http_secure_link_module \ + --with-http_sub_module \ + --with-mail_ssl_module \ + --with-stream_ssl_module \ + --with-stream_ssl_preread_module \ + --with-stream_realip_module \ + --with-http_geoip_module=dynamic \ + --with-http_image_filter_module=dynamic \ + --with-http_perl_module=dynamic \ + --with-http_xslt_module=dynamic \ + --with-mail=dynamic \ + --with-stream=dynamic \ + --with-stream_geoip_module=dynamic \ + --add-module=./modules_deb/libnginx-mod-http-ndk-0.3.2 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-brotli-1.0.0~rc \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-cache-purge-2.3 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-echo-0.63 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-geoip2-3.4 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-headers-more-filter-0.34\ + --add-dynamic-module=./modules_deb/libnginx-mod-http-memc-0.19 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-set-misc-0.33 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-srcache-filter-0.33 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-subs-filter-0.6.4 \ + --add-dynamic-module=./modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409 \ + --add-dynamic-module=./modules_deb/libnginx-mod-nchan-1.3.6+dfsg \ + --add-dynamic-module=./modules/njs/nginx \ + --add-module=./modules/media-framework/nginx-common \ + --add-dynamic-module=./modules/nginx-stream-preread-str-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-in-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-out-module \ + --add-dynamic-module=./modules/media-framework/nginx-rtmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-rtmp-kmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-mpegts-module \ + --add-dynamic-module=./modules/media-framework/nginx-mpegts-kmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-cc-module \ + --add-dynamic-module=./modules/media-framework/nginx-kmp-rtmp-module \ + --add-dynamic-module=./modules/media-framework/nginx-live-module \ + --add-dynamic-module=./modules/nginx-srt-module \ + --add-dynamic-module=./modules/media-framework/nginx-pckg-module \ + --add-dynamic-module=./modules/nginx-vod-module \ + --add-dynamic-module=./modules/nginx-secure-token-module \ No newline at end of file diff --git a/modules/PLACEHOLDER b/modules/PLACEHOLDER new file mode 100644 index 0000000..e69de29 From bf4e347d840944f38946e4c7a8b83f62f76ea4e9 Mon Sep 17 00:00:00 2001 From: wrapper Date: Tue, 15 Jul 2025 15:11:13 +0700 Subject: [PATCH 15/18] sid 2 --- .../.gitmodules | 3 + .../.travis.yml | 46 + .../CONTRIBUTING.md | 27 + .../libnginx-mod-http-brotli-1.0.0~rc/LICENSE | 27 + .../README.md | 177 + .../libnginx-mod-http-brotli-1.0.0~rc/config | 34 + .../debian/changelog | 49 + .../debian/control | 41 + .../debian/copyright | 72 + .../debian/gbp.conf | 9 + .../libnginx-mod-http-brotli-filter.install | 1 + .../libnginx-mod-http-brotli-static.install | 1 + .../debian/patches/0001-Fix-Vary-header.patch | 38 + .../debian/patches/series | 1 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 22 + .../debian/tests/filter | 44 + .../debian/tests/generic | 73 + .../debian/tests/static | 36 + .../debian/upstream/metadata | 4 + .../debian/watch | 6 + .../filter/config | 132 + .../filter/ngx_http_brotli_filter_module.c | 770 +++ .../script/.travis-before-test.sh | 24 + .../script/.travis-compile.sh | 29 + .../script/.travis-test.sh | 168 + .../script/test.conf | 32 + .../script/test_h2.conf | 32 + .../static/config | 54 + .../static/ngx_http_brotli_static_module.c | 323 + .../.astylerc | 22 + .../.format.sh | 14 + .../.gitattributes | 1 + .../.travis.yml | 49 + .../CHANGES | 103 + .../LICENSE | 26 + .../README.md | 283 + .../config | 31 + .../debian/changelog | 74 + .../debian/control | 23 + .../debian/copyright | 36 + .../debian/gbp.conf | 12 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 13 + .../debian/tests/generic | 73 + .../debian/tests/purgetest | 34 + .../debian/upstream/metadata | 4 + .../debian/watch | 6 + .../ngx_cache_purge_module.c | 2163 +++++++ .../t/proxy1.t | 136 + .../t/proxy1_vars.t | 138 + .../t/proxy2.t | 349 ++ .../t/proxy2_vars.t | 353 ++ .../t/proxy3.t | 140 + .../t/proxy4.t | 168 + .../t/resptype1.t | 245 + .../.gitattributes | 1 + .../libnginx-mod-http-echo-0.63/.gitignore | 65 + .../libnginx-mod-http-echo-0.63/.travis.yml | 48 + .../libnginx-mod-http-echo-0.63/LICENSE | 25 + .../README.markdown | 1851 ++++++ .../libnginx-mod-http-echo-0.63/config | 63 + .../debian/changelog | 53 + .../debian/control | 36 + .../debian/copyright | 71 + .../debian/fix.scanned.copyright | 2 + .../debian/gbp.conf | 9 + .../libnginx-mod-http-echo-0.63/debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 13 + .../debian/tests/generic | 73 + .../debian/tests/helloworld | 32 + .../debian/upstream/metadata | 4 + .../libnginx-mod-http-echo-0.63/debian/watch | 6 + .../libnginx-mod-http-echo-0.63/src/ddebug.h | 114 + .../src/ngx_http_echo_echo.c | 342 ++ .../src/ngx_http_echo_echo.h | 25 + .../src/ngx_http_echo_filter.c | 282 + .../src/ngx_http_echo_filter.h | 15 + .../src/ngx_http_echo_foreach.c | 183 + .../src/ngx_http_echo_foreach.h | 16 + .../src/ngx_http_echo_handler.c | 433 ++ .../src/ngx_http_echo_handler.h | 18 + .../src/ngx_http_echo_location.c | 182 + .../src/ngx_http_echo_location.h | 13 + .../src/ngx_http_echo_module.c | 682 +++ .../src/ngx_http_echo_module.h | 151 + .../src/ngx_http_echo_request_info.c | 522 ++ .../src/ngx_http_echo_request_info.h | 36 + .../src/ngx_http_echo_sleep.c | 208 + .../src/ngx_http_echo_sleep.h | 16 + .../src/ngx_http_echo_subrequest.c | 791 +++ .../src/ngx_http_echo_subrequest.h | 19 + .../src/ngx_http_echo_timer.c | 95 + .../src/ngx_http_echo_timer.h | 13 + .../src/ngx_http_echo_util.c | 302 + .../src/ngx_http_echo_util.h | 58 + .../src/ngx_http_echo_var.c | 110 + .../src/ngx_http_echo_var.h | 9 + .../t/abort-parent.t | 63 + .../t/blocking-sleep.t | 156 + .../t/echo-after-body.t | 261 + .../t/echo-before-body.t | 278 + .../t/echo-duplicate.t | 89 + .../t/echo-timer.t | 107 + .../libnginx-mod-http-echo-0.63/t/echo.t | 416 ++ .../libnginx-mod-http-echo-0.63/t/exec.t | 228 + .../t/filter-used.t | 59 + .../t/foreach-split.t | 283 + .../libnginx-mod-http-echo-0.63/t/gzip.t | 31 + .../libnginx-mod-http-echo-0.63/t/if.t | 150 + .../libnginx-mod-http-echo-0.63/t/incr.t | 32 + .../t/location-async.t | 439 ++ .../libnginx-mod-http-echo-0.63/t/location.t | 567 ++ .../libnginx-mod-http-echo-0.63/t/mixed.t | 82 + .../t/request-body.t | 58 + .../t/request-info.t | 870 +++ .../libnginx-mod-http-echo-0.63/t/sleep.t | 200 + .../libnginx-mod-http-echo-0.63/t/status.t | 142 + .../t/subrequest-async.t | 604 ++ .../t/subrequest.t | 725 +++ .../libnginx-mod-http-echo-0.63/t/unused.t | 119 + .../libnginx-mod-http-echo-0.63/util/build.sh | 44 + .../util/wiki2pod.pl | 131 + .../valgrind.suppress | 53 + .../libnginx-mod-http-geoip2-3.4/LICENSE | 23 + .../libnginx-mod-http-geoip2-3.4/README.md | 153 + .../libnginx-mod-http-geoip2-3.4/config | 43 + .../debian/changelog | 52 + .../debian/control | 41 + .../debian/copyright | 46 + .../debian/gbp.conf | 9 + .../debian/libnginx-mod-http-geoip2.install | 1 + .../debian/libnginx-mod-stream-geoip2.install | 1 + .../libnginx-mod-http-geoip2-3.4/debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 6 + .../debian/tests/generic | 73 + .../debian/upstream/metadata | 4 + .../libnginx-mod-http-geoip2-3.4/debian/watch | 6 + .../ngx_http_geoip2_module.c | 803 +++ .../ngx_stream_geoip2_module.c | 694 +++ .../.gitattributes | 1 + .../.gitignore | 54 + .../.travis.yml | 58 + .../LICENSE | 20 + .../README.markdown | 538 ++ .../config | 32 + .../debian/changelog | 72 + .../debian/control | 26 + .../debian/copyright | 62 + .../debian/gbp.conf | 12 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 13 + .../debian/tests/generic | 73 + .../debian/tests/helloworld | 34 + .../debian/upstream/metadata | 4 + .../debian/watch | 6 + .../src/ddebug.h | 124 + .../src/ngx_http_headers_more_filter_module.c | 348 ++ .../src/ngx_http_headers_more_filter_module.h | 81 + .../src/ngx_http_headers_more_headers_in.c | 959 +++ .../src/ngx_http_headers_more_headers_in.h | 26 + .../src/ngx_http_headers_more_headers_out.c | 814 +++ .../src/ngx_http_headers_more_headers_out.h | 26 + .../src/ngx_http_headers_more_util.c | 382 ++ .../src/ngx_http_headers_more_util.h | 52 + .../t/bug.t | 416 ++ .../t/builtin.t | 338 + .../t/eval.t | 36 + .../t/input-conn.t | 137 + .../t/input-cookie.t | 183 + .../t/input-ua.t | 628 ++ .../t/input.t | 1331 ++++ .../t/phase.t | 25 + .../t/sanity.t | 628 ++ .../t/subrequest.t | 68 + .../t/unused.t | 174 + .../t/vars.t | 58 + .../util/build.sh | 38 + .../valgrind.suppress | 135 + .../libnginx-mod-http-ndk-0.3.4/.gitignore | 4 + .../libnginx-mod-http-ndk-0.3.4/LICENSE | 13 + .../libnginx-mod-http-ndk-0.3.4/README.md | 254 + .../README_AUTO_LIB.md | 394 ++ .../auto/actions/array | 10 + .../auto/actions/palloc | 8 + .../libnginx-mod-http-ndk-0.3.4/auto/build | 597 ++ .../auto/data/action_replacements | 5 + .../auto/data/action_types | 12 + .../auto/data/conf_args | 22 + .../auto/data/conf_locs | 25 + .../auto/data/conf_macros | 35 + .../auto/data/contexts | 22 + .../auto/data/header_files | 3 + .../auto/data/headers | 4 + .../auto/data/module_dependencies | 5 + .../auto/data/modules_optional | 15 + .../auto/data/prefixes | 2 + .../auto/src/array.h | 7 + .../auto/src/conf_cmd_basic.h | 43 + .../auto/src/conf_merge.h | 78 + .../auto/src/palloc.h | 6 + .../auto/text/autogen | 12 + .../libnginx-mod-http-ndk-0.3.4/config | 65 + .../debian/changelog | 58 + .../debian/control | 47 + .../debian/copyright | 155 + .../debian/copyright-scan-patterns.yml | 4 + .../debian/fix.scanned.copyright | 1 + .../debian/gbp.conf | 12 + .../debian/libnginx-mod-http-ndk-dev.install | 5 + .../debian/libnginx-mod-http-ndk.install | 1 + .../debian/libnginx-mod-http-ndk.nginx | 1 + .../debian/mod-http-ndk.conf | 1 + .../libnginx-mod-http-ndk-0.3.4/debian/rules | 35 + .../debian/source/format | 1 + .../debian/tests/control | 6 + .../debian/tests/generic | 73 + .../debian/upstream/metadata | 4 + .../libnginx-mod-http-ndk-0.3.4/debian/watch | 6 + .../docs/core/action_macros | 63 + .../docs/core/conf_cmds | 62 + .../docs/modules/set_var | 124 + .../docs/patches/more_logging_info | 48 + .../docs/upstream/list | 45 + .../examples/README | 12 + .../examples/http/set_var/config | 4 + .../ngx_http_set_var_examples_module.c | 136 + .../ngx_auto_lib_core | 797 +++ .../libnginx-mod-http-ndk-0.3.4/notes/CHANGES | 17 + .../libnginx-mod-http-ndk-0.3.4/notes/LICENSE | 24 + .../objs/ndk_array.h | 113 + .../objs/ndk_conf_cmd_basic.h | 2203 +++++++ .../objs/ndk_conf_cmd_extra.h | 5423 +++++++++++++++++ .../objs/ndk_conf_merge.h | 227 + .../objs/ndk_config.c | 72 + .../objs/ndk_config.h | 98 + .../objs/ndk_includes.h | 66 + .../objs/ndk_palloc.h | 112 + .../patches/auto_config | 16 + .../patches/expose_rewrite_functions | 291 + .../patches/rewrite_phase_handler | 19 + .../src/hash/md5.h | 117 + .../src/hash/murmurhash2.c | 77 + .../src/hash/sha.h | 200 + .../libnginx-mod-http-ndk-0.3.4/src/ndk.c | 155 + .../libnginx-mod-http-ndk-0.3.4/src/ndk.h | 53 + .../libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c | 43 + .../libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h | 5 + .../src/ndk_complex_path.c | 129 + .../src/ndk_complex_path.h | 30 + .../src/ndk_complex_value.c | 192 + .../src/ndk_complex_value.h | 21 + .../src/ndk_conf_file.c | 396 ++ .../src/ndk_conf_file.h | 44 + .../src/ndk_debug.c | 72 + .../src/ndk_debug.h | 171 + .../src/ndk_encoding.c | 57 + .../src/ndk_encoding.h | 12 + .../src/ndk_hash.c | 82 + .../src/ndk_hash.h | 45 + .../src/ndk_http.c | 138 + .../src/ndk_http.h | 3 + .../src/ndk_http_headers.h | 35 + .../libnginx-mod-http-ndk-0.3.4/src/ndk_log.c | 3 + .../libnginx-mod-http-ndk-0.3.4/src/ndk_log.h | 165 + .../src/ndk_parse.h | 67 + .../src/ndk_path.c | 583 ++ .../src/ndk_path.h | 22 + .../src/ndk_process.c | 20 + .../src/ndk_process.h | 12 + .../src/ndk_regex.c | 215 + .../src/ndk_regex.h | 7 + .../src/ndk_rewrite.c | 103 + .../src/ndk_rewrite.h | 26 + .../src/ndk_set_var.c | 602 ++ .../src/ndk_set_var.h | 44 + .../src/ndk_string.c | 434 ++ .../src/ndk_string.h | 37 + .../src/ndk_string_util.h | 14 + .../src/ndk_upstream_list.c | 205 + .../src/ndk_upstream_list.h | 27 + .../libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c | 45 + .../libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h | 6 + .../.gitattributes | 1 + .../.gitignore | 72 + .../.travis.yml | 54 + .../README.markdown | 1451 +++++ .../libnginx-mod-http-set-misc-0.33/config | 79 + .../debian/changelog | 53 + .../debian/control | 27 + .../debian/copyright | 49 + .../debian/copyright-scan-patterns.yml | 4 + .../debian/fix.scanned.copyright | 2 + .../debian/gbp.conf | 9 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 13 + .../debian/tests/generic | 73 + .../debian/tests/setifempty | 36 + .../debian/upstream/metadata | 4 + .../debian/watch | 6 + .../src/ddebug.h | 74 + .../src/ngx_http_set_base32.c | 263 + .../src/ngx_http_set_base32.h | 18 + .../src/ngx_http_set_base64.c | 48 + .../src/ngx_http_set_base64.h | 10 + .../src/ngx_http_set_base64url.c | 50 + .../src/ngx_http_set_base64url.h | 10 + .../src/ngx_http_set_default_value.c | 48 + .../src/ngx_http_set_default_value.h | 15 + .../src/ngx_http_set_escape_uri.c | 210 + .../src/ngx_http_set_escape_uri.h | 10 + .../src/ngx_http_set_hash.c | 83 + .../src/ngx_http_set_hash.h | 15 + .../src/ngx_http_set_hashed_upstream.c | 141 + .../src/ngx_http_set_hashed_upstream.h | 27 + .../src/ngx_http_set_hex.c | 62 + .../src/ngx_http_set_hex.h | 9 + .../src/ngx_http_set_hmac.c | 62 + .../src/ngx_http_set_hmac.h | 9 + .../src/ngx_http_set_local_today.c | 110 + .../src/ngx_http_set_local_today.h | 13 + .../src/ngx_http_set_misc_module.c | 586 ++ .../src/ngx_http_set_misc_module.h | 30 + .../src/ngx_http_set_quote_json.c | 165 + .../src/ngx_http_set_quote_json.h | 16 + .../src/ngx_http_set_quote_sql.c | 382 ++ .../src/ngx_http_set_quote_sql.h | 21 + .../src/ngx_http_set_random.c | 57 + .../src/ngx_http_set_random.h | 12 + .../src/ngx_http_set_rotate.c | 113 + .../src/ngx_http_set_rotate.h | 18 + .../src/ngx_http_set_secure_random.c | 104 + .../src/ngx_http_set_secure_random.h | 15 + .../src/ngx_http_set_unescape_uri.c | 184 + .../src/ngx_http_set_unescape_uri.h | 16 + .../t/base32.t | 556 ++ .../t/base32_no_padding.t | 531 ++ .../t/base64.t | 40 + .../t/base64url.t | 40 + .../t/default-value.t | 88 + .../t/escape-uri.t | 139 + .../t/formatted-time.t | 84 + .../libnginx-mod-http-set-misc-0.33/t/hash.t | 94 + .../t/hashed-upstream.t | 70 + .../libnginx-mod-http-set-misc-0.33/t/hex.t | 57 + .../libnginx-mod-http-set-misc-0.33/t/hmac.t | 78 + .../t/local-today.t | 29 + .../t/quote-json.t | 69 + .../t/quote-sql.t | 195 + .../libnginx-mod-http-set-misc-0.33/t/rand.t | 168 + .../t/rotate.t | 270 + .../t/secure-random.t | 107 + .../t/unescape-uri.t | 58 + .../util/build.sh | 35 + .../valgrind.suppress | 105 + .../.gitattributes | 1 + .../.gitignore | 79 + .../.travis.yml | 87 + .../Changes | 16 + .../README.markdown | 1258 ++++ .../config | 50 + .../debian/changelog | 60 + .../debian/control | 24 + .../debian/copyright | 56 + .../debian/fix.scanned.copyright | 2 + .../debian/gbp.conf | 9 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 6 + .../debian/tests/generic | 73 + .../debian/upstream/metadata | 4 + .../debian/watch | 9 + .../src/ddebug.h | 124 + .../src/ngx_http_srcache_fetch.c | 470 ++ .../src/ngx_http_srcache_fetch.h | 22 + .../src/ngx_http_srcache_filter_module.c | 623 ++ .../src/ngx_http_srcache_filter_module.h | 152 + .../src/ngx_http_srcache_headers.c | 359 ++ .../src/ngx_http_srcache_headers.h | 30 + .../src/ngx_http_srcache_store.c | 675 ++ .../src/ngx_http_srcache_store.h | 23 + .../src/ngx_http_srcache_util.c | 1296 ++++ .../src/ngx_http_srcache_util.h | 61 + .../src/ngx_http_srcache_var.c | 180 + .../src/ngx_http_srcache_var.h | 19 + .../t/000_init.t | 158 + .../t/access.t | 84 + .../t/bugs.t | 668 ++ .../t/conditional-get.t | 302 + .../t/content-length.t | 96 + .../t/content-type.t | 90 + .../t/disk.t | 68 + .../t/drizzle-main.t | 105 + .../t/drizzle-sub.t | 113 + .../t/empty-resp.t | 88 + .../t/err-page.t | 82 + .../t/etag.t | 186 + .../t/eval.t | 96 + .../t/expire-var.t | 592 ++ .../t/expires.t | 377 ++ .../t/fetch-header.t | 232 + .../t/fetch-skip.t | 528 ++ .../t/gzip.t | 160 + .../t/header-buf-size.t | 145 + .../t/main-req.t | 146 + .../t/max-age.t | 305 + .../t/methods.t | 389 ++ .../t/no-cache.t | 309 + .../t/no-store.t | 305 + .../t/postgres-main.t | 138 + .../t/private.t | 528 ++ .../t/proxy.t | 65 + .../t/ranges.t | 410 ++ .../t/redis.t | 246 + .../t/req-cache-control.t | 394 ++ .../t/satisfy.t | 118 + .../t/static.t | 162 + .../t/status.t | 723 +++ .../t/store-hide-headers.t | 389 ++ .../t/store-max-size.t | 356 ++ .../t/store-pass-headers.t | 173 + .../t/store-skip.t | 434 ++ .../t/sub-req.t | 448 ++ .../t/timeout.t | 119 + .../t/unused.t | 113 + .../util/build.sh | 75 + .../valgrind.suppress | 93 + .../CHANGES | 37 + .../README | 141 + .../config | 15 + .../debian/changelog | 52 + .../debian/control | 24 + .../debian/copyright | 116 + .../debian/gbp.conf | 9 + ...Feature-nginx-dynamic-module-support.patch | 36 + ...ntent-encoding-header-more-carefully.patch | 29 + .../patches/0003-PCRE2-support-added.patch | 30 + .../debian/patches/series | 3 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 6 + .../debian/tests/generic | 73 + .../debian/upstream/metadata | 4 + .../debian/watch | 6 + .../doc/README.google_code_home_page.wiki | 120 + .../doc/README.html | 199 + .../doc/README.wiki | 123 + .../ngx_http_subs_filter_module.c | 1302 ++++ .../test/README | 275 + .../test/inc/Module/AutoInstall.pm | 820 +++ .../test/inc/Module/Install.pm | 470 ++ .../test/inc/Module/Install/AutoInstall.pm | 82 + .../test/inc/Module/Install/Base.pm | 83 + .../test/inc/Module/Install/Can.pm | 81 + .../test/inc/Module/Install/Fetch.pm | 93 + .../test/inc/Module/Install/Include.pm | 34 + .../test/inc/Module/Install/Makefile.pm | 415 ++ .../test/inc/Module/Install/Metadata.pm | 716 +++ .../test/inc/Module/Install/TestBase.pm | 29 + .../test/inc/Module/Install/Win32.pm | 64 + .../test/inc/Module/Install/WriteAll.pm | 63 + .../test/inc/Spiffy.pm | 539 ++ .../test/inc/Test/Base.pm | 682 +++ .../test/inc/Test/Base/Filter.pm | 341 ++ .../test/inc/Test/Builder.pm | 1413 +++++ .../test/inc/Test/Builder/Module.pm | 81 + .../test/inc/Test/More.pm | 735 +++ .../test/lib/Test/Nginx.pm | 315 + .../test/lib/Test/Nginx/LWP.pm | 524 ++ .../test/lib/Test/Nginx/Socket.pm | 1749 ++++++ .../test/lib/Test/Nginx/Util.pm | 874 +++ .../test/t/subs.t | 136 + .../test/t/subs_capture.t | 32 + .../test/t/subs_fix_string.t | 32 + .../test/t/subs_regex.t | 108 + .../test/t/subs_types.t | 59 + .../test/test.sh | 5 + .../util/update-readme.sh | 7 + .../util/wiki2google_code_homepage.pl | 29 + .../util/wiki2pod.pl | 129 + .../.gdbinit | 39 + .../README | 53 + .../config | 12 + .../debian/changelog | 44 + .../debian/control | 23 + .../debian/copyright | 39 + .../debian/gbp.conf | 9 + .../debian/patches/drop-default-port.patch | 37 + .../debian/patches/dynamic-module.patch | 29 + .../debian/patches/openssl-1.1.0.patch | 50 + .../debian/patches/series | 3 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/tests/control | 6 + .../debian/tests/generic | 73 + .../debian/upstream/metadata | 4 + .../debian/watch | 7 + .../ngx_http_upstream_fair_module.c | 1354 ++++ .../libnginx-mod-nchan-1.3.7+dfsg/LICENCE | 24 + .../libnginx-mod-nchan-1.3.7+dfsg/README.md | 1745 ++++++ .../changelog.txt | 595 ++ .../cloc-exclude.txt | 16 + .../libnginx-mod-nchan-1.3.7+dfsg/config | 170 + .../debian/changelog | 81 + .../debian/control | 32 + .../debian/copyright | 246 + .../debian/fix.scanned.copyright | 3 + .../debian/gbp.conf | 12 + .../debian/rules | 6 + .../debian/source/format | 1 + .../debian/source/options | 1 + .../debian/tests/control | 9 + .../debian/tests/generic | 73 + .../debian/upstream/metadata | 4 + .../debian/watch | 9 + .../src/.gitignore | 2 + .../src/nchan_commands.rb | 1188 ++++ .../src/nchan_config_commands.c | 1046 ++++ .../src/nchan_defs.c | 97 + .../src/nchan_defs.h | 150 + .../src/nchan_module.c | 1336 ++++ .../src/nchan_module.h | 73 + .../src/nchan_setup.c | 1747 ++++++ .../src/nchan_types.h | 542 ++ .../src/nchan_variables.c | 319 + .../src/nchan_variables.h | 1 + .../src/nchan_version.h | 1 + .../src/nchan_websocket_publisher.c | 82 + .../src/nchan_websocket_publisher.h | 2 + .../src/store/memory/groups.c | 570 ++ .../src/store/memory/groups.h | 55 + .../src/store/memory/ipc-handlers.c | 1213 ++++ .../src/store/memory/ipc-handlers.h | 28 + .../src/store/memory/ipc.c | 558 ++ .../src/store/memory/ipc.h | 66 + .../src/store/memory/memstore.c | 3498 +++++++++++ .../src/store/memory/recycloc.c | 47 + .../src/store/memory/store-private.h | 180 + .../src/store/memory/store.h | 13 + .../src/store/ngx_rwlock.c | 178 + .../src/store/ngx_rwlock.h | 5 + .../src/store/redis/cmp.c | 3352 ++++++++++ .../src/store/redis/cmp.h | 526 ++ .../src/store/redis/hiredis/.gitignore | 9 + .../src/store/redis/hiredis/.travis.yml | 131 + .../src/store/redis/hiredis/CHANGELOG.md | 364 ++ .../src/store/redis/hiredis/COPYING | 29 + .../src/store/redis/hiredis/README.md | 664 ++ .../src/store/redis/hiredis/alloc.c | 86 + .../src/store/redis/hiredis/alloc.h | 91 + .../src/store/redis/hiredis/async.c | 890 +++ .../src/store/redis/hiredis/async.h | 147 + .../src/store/redis/hiredis/async_private.h | 75 + .../src/store/redis/hiredis/dict.c | 357 ++ .../src/store/redis/hiredis/dict.h | 126 + .../src/store/redis/hiredis/fmacros.h | 12 + .../src/store/redis/hiredis/hiredis.c | 1174 ++++ .../src/store/redis/hiredis/hiredis.h | 339 ++ .../src/store/redis/hiredis/hiredis_ssl.h | 127 + .../src/store/redis/hiredis/net.c | 615 ++ .../src/store/redis/hiredis/net.h | 56 + .../src/store/redis/hiredis/read.c | 739 +++ .../src/store/redis/hiredis/read.h | 129 + .../src/store/redis/hiredis/sds.c | 1294 ++++ .../src/store/redis/hiredis/sds.h | 278 + .../src/store/redis/hiredis/sdsalloc.h | 44 + .../src/store/redis/hiredis/sockcompat.c | 248 + .../src/store/redis/hiredis/sockcompat.h | 92 + .../src/store/redis/hiredis/ssl.c | 526 ++ .../src/store/redis/hiredis/test.c | 1387 +++++ .../src/store/redis/hiredis/win32.h | 56 + .../src/store/redis/rdsstore.c | 2721 +++++++++ .../store/redis/redis-lua-scripts/.gitignore | 1 + .../src/store/redis/redis-lua-scripts/Gemfile | 11 + .../redis/redis-lua-scripts/add_fakesub.lua | 52 + .../redis-lua-scripts/channel_keepalive.lua | 45 + .../store/redis/redis-lua-scripts/delete.lua | 91 + .../redis/redis-lua-scripts/find_channel.lua | 92 + .../redis/redis-lua-scripts/get_message.lua | 155 + .../get_message_from_key.lua | 8 + .../get_subscriber_info_id.lua | 18 + ...nostore_publish_multiexec_channel_info.lua | 56 + .../store/redis/redis-lua-scripts/publish.lua | 296 + .../request_subscriber_info.lua | 15 + .../store/redis/redis-lua-scripts/rsck.lua | 216 + .../redis-lua-scripts/subscriber_register.lua | 61 + .../subscriber_unregister.lua | 50 + .../redis/redis-lua-scripts/testscripts.rb | 269 + .../src/store/redis/redis_lua_commands.c | 1185 ++++ .../src/store/redis/redis_lua_commands.h | 83 + .../src/store/redis/redis_nginx_adapter.c | 165 + .../src/store/redis/redis_nginx_adapter.h | 22 + .../src/store/redis/redis_nodeset.c | 3824 ++++++++++++ .../src/store/redis/redis_nodeset.h | 469 ++ .../src/store/redis/redis_nodeset_parser.c | 248 + .../src/store/redis/redis_nodeset_parser.h | 40 + .../src/store/redis/redis_nodeset_stats.c | 578 ++ .../src/store/redis/store-private.h | 114 + .../src/store/redis/store.h | 26 + .../src/store/spool.c | 1293 ++++ .../src/store/spool.h | 117 + .../src/store/store_common.c | 8 + .../src/store/store_common.h | 12 + .../src/subscribers/benchmark.c | 72 + .../src/subscribers/benchmark.h | 3 + .../src/subscribers/common.c | 456 ++ .../src/subscribers/common.h | 27 + .../src/subscribers/eventsource.c | 414 ++ .../src/subscribers/eventsource.h | 4 + .../src/subscribers/getmsg_proxy.c | 106 + .../src/subscribers/getmsg_proxy.h | 1 + .../src/subscribers/http-chunked.c | 259 + .../src/subscribers/http-chunked.h | 4 + .../src/subscribers/http-multipart-mixed.c | 291 + .../src/subscribers/http-multipart-mixed.h | 3 + .../src/subscribers/http-raw-stream.c | 157 + .../src/subscribers/http-raw-stream.h | 1 + .../src/subscribers/internal.c | 298 + .../src/subscribers/internal.h | 32 + .../src/subscribers/intervalpoll.c | 33 + .../src/subscribers/intervalpoll.h | 1 + .../src/subscribers/longpoll-private.h | 38 + .../src/subscribers/longpoll.c | 551 ++ .../src/subscribers/longpoll.h | 2 + .../src/subscribers/memstore_ipc.c | 197 + .../src/subscribers/memstore_ipc.h | 5 + .../src/subscribers/memstore_multi.c | 174 + .../src/subscribers/memstore_multi.h | 2 + .../src/subscribers/memstore_redis.c | 261 + .../src/subscribers/memstore_redis.h | 3 + .../src/subscribers/websocket.c | 2065 +++++++ .../src/subscribers/websocket.h | 5 + .../src/uthash.h | 1208 ++++ .../src/util/hdr_histogram.c | 1015 +++ .../src/util/hdr_histogram.h | 427 ++ .../src/util/nchan_accumulator.c | 212 + .../src/util/nchan_accumulator.h | 45 + .../src/util/nchan_benchmark.c | 804 +++ .../src/util/nchan_benchmark.h | 91 + .../src/util/nchan_bufchainpool.c | 237 + .../src/util/nchan_bufchainpool.h | 56 + .../src/util/nchan_channel_id.c | 316 + .../src/util/nchan_channel_id.h | 6 + .../src/util/nchan_debug.c | 81 + .../src/util/nchan_debug.h | 13 + .../src/util/nchan_fake_request.c | 524 ++ .../src/util/nchan_fake_request.h | 58 + .../src/util/nchan_list.c | 175 + .../src/util/nchan_list.h | 54 + .../src/util/nchan_msg.c | 773 +++ .../src/util/nchan_msg.h | 35 + .../src/util/nchan_output.c | 670 ++ .../src/util/nchan_output.h | 30 + .../src/util/nchan_output_info.c | 284 + .../src/util/nchan_output_info.h | 6 + .../src/util/nchan_rbtree.c | 379 ++ .../src/util/nchan_rbtree.h | 64 + .../src/util/nchan_reaper.c | 320 + .../src/util/nchan_reaper.h | 33 + .../src/util/nchan_reuse_queue.c | 151 + .../src/util/nchan_reuse_queue.h | 24 + .../src/util/nchan_slist.c | 164 + .../src/util/nchan_slist.h | 41 + .../src/util/nchan_stats.c | 103 + .../src/util/nchan_stats.h | 48 + .../src/util/nchan_subrequest.c | 325 + .../src/util/nchan_subrequest.h | 6 + .../src/util/nchan_thingcache.c | 209 + .../src/util/nchan_thingcache.h | 4 + .../src/util/nchan_timequeue.c | 137 + .../src/util/nchan_timequeue.h | 37 + .../src/util/nchan_util.c | 1334 ++++ .../src/util/nchan_util.h | 86 + .../src/util/ngx_nchan_hacked_slab.c | 770 +++ .../src/util/ngx_nchan_hacked_slab.h | 26 + .../src/util/shmem.c | 223 + .../src/util/shmem.h | 33 + src/core/nginx.c | 24 +- src/event/ngx_event_openssl.c | 32 + src/os/unix/ngx_daemon.c | 8 +- src/os/unix/ngx_posix_config.h | 5 +- 687 files changed, 145455 insertions(+), 6 deletions(-) create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.gitmodules create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.travis.yml create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/CONTRIBUTING.md create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/README.md create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/config create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/control create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/gbp.conf create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-filter.install create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-static.install create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/0001-Fix-Vary-header.patch create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/series create mode 100755 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/rules create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/filter create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/static create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/watch create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/config create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/ngx_http_brotli_filter_module.c create mode 100755 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-before-test.sh create mode 100755 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-compile.sh create mode 100755 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-test.sh create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test.conf create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test_h2.conf create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/config create mode 100644 modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/ngx_http_brotli_static_module.c create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/.astylerc create mode 100755 modules_deb/libnginx-mod-http-cache-purge-2.5.3/.format.sh create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/.gitattributes create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/.travis.yml create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/CHANGES create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/README.md create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/config create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/control create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/gbp.conf create mode 100755 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/rules create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/purgetest create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/watch create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/ngx_cache_purge_module.c create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1_vars.t create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2_vars.t create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy3.t create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy4.t create mode 100644 modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/resptype1.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/.gitattributes create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/.gitignore create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/.travis.yml create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/LICENSE create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/README.markdown create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/config create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/control create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/fix.scanned.copyright create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/gbp.conf create mode 100755 modules_deb/libnginx-mod-http-echo-0.63/debian/rules create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/tests/helloworld create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/debian/watch create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.c create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.h create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/abort-parent.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/blocking-sleep.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/echo-after-body.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/echo-before-body.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/echo-duplicate.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/echo-timer.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/echo.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/exec.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/filter-used.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/foreach-split.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/gzip.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/if.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/incr.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/location-async.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/location.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/mixed.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/request-body.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/sleep.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/status.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/subrequest-async.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/t/unused.t create mode 100755 modules_deb/libnginx-mod-http-echo-0.63/util/build.sh create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/util/wiki2pod.pl create mode 100644 modules_deb/libnginx-mod-http-echo-0.63/valgrind.suppress create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/LICENSE create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/README.md create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/config create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/control create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/gbp.conf create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-http-geoip2.install create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-stream-geoip2.install create mode 100755 modules_deb/libnginx-mod-http-geoip2-3.4/debian/rules create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/debian/watch create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/ngx_http_geoip2_module.c create mode 100644 modules_deb/libnginx-mod-http-geoip2-3.4/ngx_stream_geoip2_module.c create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitattributes create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitignore create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/.travis.yml create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/LICENSE create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/config create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/control create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/gbp.conf create mode 100755 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/rules create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/helloworld create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/watch create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t create mode 100755 modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh create mode 100644 modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/.gitignore create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/LICENSE create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/README.md create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/array create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/palloc create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/build create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_replacements create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_types create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_args create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_locs create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_macros create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/contexts create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/header_files create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/headers create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/module_dependencies create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/modules_optional create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/prefixes create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/array.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_cmd_basic.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_merge.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/palloc.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/auto/text/autogen create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/config create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/control create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright-scan-patterns.yml create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/fix.scanned.copyright create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/gbp.conf create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk-dev.install create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.install create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.nginx create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/mod-http-ndk.conf create mode 100755 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/rules create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/debian/watch create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/action_macros create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/conf_cmds create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/docs/modules/set_var create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/docs/patches/more_logging_info create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/docs/upstream/list create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/examples/README create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/config create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/ngx_http_set_var_examples_module.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/ngx_auto_lib_core create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/notes/CHANGES create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/notes/LICENSE create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_array.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_basic.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_extra.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_merge.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_includes.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_palloc.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/patches/auto_config create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/patches/expose_rewrite_functions create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/patches/rewrite_phase_handler create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/md5.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/murmurhash2.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/sha.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http_headers.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_parse.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string_util.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.h create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c create mode 100644 modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/.gitattributes create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/.gitignore create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/.travis.yml create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/README.markdown create mode 100755 modules_deb/libnginx-mod-http-set-misc-0.33/config create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/control create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright-scan-patterns.yml create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/fix.scanned.copyright create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/gbp.conf create mode 100755 modules_deb/libnginx-mod-http-set-misc-0.33/debian/rules create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/setifempty create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/debian/watch create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ddebug.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.c create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.h create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/base32.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/base32_no_padding.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/base64.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/base64url.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/default-value.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/escape-uri.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/formatted-time.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/hash.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/hashed-upstream.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/hex.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/hmac.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/local-today.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-json.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-sql.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/rand.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/rotate.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/secure-random.t create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/t/unescape-uri.t create mode 100755 modules_deb/libnginx-mod-http-set-misc-0.33/util/build.sh create mode 100644 modules_deb/libnginx-mod-http-set-misc-0.33/valgrind.suppress create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitattributes create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitignore create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/.travis.yml create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/Changes create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/README.markdown create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/config create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/control create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/fix.scanned.copyright create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/gbp.conf create mode 100755 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/rules create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/debian/watch create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ddebug.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_fetch.c create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_fetch.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_filter_module.c create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_filter_module.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_headers.c create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_headers.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_store.c create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_store.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_util.c create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_util.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_var.c create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/src/ngx_http_srcache_var.h create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/000_init.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/access.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/bugs.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/conditional-get.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/content-length.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/content-type.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/disk.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/drizzle-main.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/drizzle-sub.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/empty-resp.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/err-page.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/etag.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/eval.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/expire-var.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/expires.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/fetch-header.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/fetch-skip.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/gzip.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/header-buf-size.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/main-req.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/max-age.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/methods.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/no-cache.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/no-store.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/postgres-main.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/private.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/proxy.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/ranges.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/redis.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/req-cache-control.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/satisfy.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/static.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/status.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/store-hide-headers.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/store-max-size.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/store-pass-headers.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/store-skip.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/sub-req.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/timeout.t create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/t/unused.t create mode 100755 modules_deb/libnginx-mod-http-srcache-filter-0.33/util/build.sh create mode 100644 modules_deb/libnginx-mod-http-srcache-filter-0.33/valgrind.suppress create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/CHANGES create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/README create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/config create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/control create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/gbp.conf create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/patches/0001-Feature-nginx-dynamic-module-support.patch create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/patches/0002-check-content-encoding-header-more-carefully.patch create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/patches/0003-PCRE2-support-added.patch create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/patches/series create mode 100755 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/rules create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/debian/watch create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/doc/README.google_code_home_page.wiki create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/doc/README.html create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/doc/README.wiki create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/ngx_http_subs_filter_module.c create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/README create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/AutoInstall.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/AutoInstall.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Base.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Can.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Fetch.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Include.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Makefile.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Metadata.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/TestBase.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/Win32.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Module/Install/WriteAll.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Spiffy.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Test/Base.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Test/Base/Filter.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Test/Builder.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Test/Builder/Module.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/inc/Test/More.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/lib/Test/Nginx.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/lib/Test/Nginx/LWP.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/lib/Test/Nginx/Socket.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/lib/Test/Nginx/Util.pm create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/t/subs.t create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/t/subs_capture.t create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/t/subs_fix_string.t create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/t/subs_regex.t create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/t/subs_types.t create mode 100755 modules_deb/libnginx-mod-http-subs-filter-0.6.4/test/test.sh create mode 100755 modules_deb/libnginx-mod-http-subs-filter-0.6.4/util/update-readme.sh create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/util/wiki2google_code_homepage.pl create mode 100644 modules_deb/libnginx-mod-http-subs-filter-0.6.4/util/wiki2pod.pl create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/.gdbinit create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/README create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/config create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/changelog create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/control create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/copyright create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/gbp.conf create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/patches/drop-default-port.patch create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/patches/dynamic-module.patch create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/patches/openssl-1.1.0.patch create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/patches/series create mode 100755 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/rules create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/source/format create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/tests/control create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/debian/watch create mode 100644 modules_deb/libnginx-mod-http-upstream-fair-0.0~git20120408.a18b409/ngx_http_upstream_fair_module.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/LICENCE create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/README.md create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/changelog.txt create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/cloc-exclude.txt create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/config create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/changelog create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/control create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/copyright create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/fix.scanned.copyright create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/gbp.conf create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/rules create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/source/format create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/source/options create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/tests/control create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/tests/generic create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/upstream/metadata create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/debian/watch create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/.gitignore create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_commands.rb create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_config_commands.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_defs.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_defs.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_module.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_module.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_setup.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_types.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_variables.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_variables.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_version.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_websocket_publisher.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/nchan_websocket_publisher.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/groups.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/groups.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/ipc-handlers.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/ipc-handlers.h create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/ipc.c create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/ipc.h create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/memstore.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/recycloc.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/store-private.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/memory/store.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/ngx_rwlock.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/cmp.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/cmp.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/.gitignore create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/.travis.yml create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/CHANGELOG.md create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/COPYING create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/README.md create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/alloc.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/alloc.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/async.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/async.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/async_private.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/dict.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/dict.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/fmacros.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/hiredis.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/hiredis.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/hiredis_ssl.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/net.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/net.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/read.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/read.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/sds.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/sds.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/sdsalloc.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/sockcompat.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/sockcompat.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/ssl.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/test.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/hiredis/win32.h create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/rdsstore.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/.gitignore create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/Gemfile create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/add_fakesub.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/channel_keepalive.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/delete.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/find_channel.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/get_message.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/get_message_from_key.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/get_subscriber_info_id.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/nostore_publish_multiexec_channel_info.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/publish.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/request_subscriber_info.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/rsck.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/subscriber_register.lua create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/subscriber_unregister.lua create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis-lua-scripts/testscripts.rb create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_lua_commands.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_lua_commands.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nginx_adapter.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nginx_adapter.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nodeset.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nodeset.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nodeset_parser.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nodeset_parser.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/redis_nodeset_stats.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/store-private.h create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/redis/store.h create mode 100755 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/spool.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/spool.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/store_common.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/store/store_common.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/benchmark.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/benchmark.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/common.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/common.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/eventsource.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/eventsource.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/getmsg_proxy.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/getmsg_proxy.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/http-chunked.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/http-chunked.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/http-multipart-mixed.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/http-multipart-mixed.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/http-raw-stream.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/http-raw-stream.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/internal.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/internal.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/intervalpoll.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/intervalpoll.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/longpoll-private.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/longpoll.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/longpoll.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/memstore_ipc.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/memstore_ipc.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/memstore_multi.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/memstore_multi.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/memstore_redis.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/memstore_redis.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/websocket.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/subscribers/websocket.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/uthash.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/hdr_histogram.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/hdr_histogram.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_accumulator.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_accumulator.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_benchmark.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_benchmark.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_bufchainpool.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_bufchainpool.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_channel_id.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_channel_id.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_debug.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_debug.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_fake_request.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_fake_request.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_list.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_list.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_msg.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_msg.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_output.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_output.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_output_info.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_output_info.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_rbtree.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_rbtree.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_reaper.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_reaper.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_reuse_queue.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_reuse_queue.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_slist.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_slist.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_stats.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_stats.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_subrequest.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_subrequest.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_thingcache.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_thingcache.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_timequeue.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_timequeue.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_util.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/nchan_util.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/ngx_nchan_hacked_slab.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/ngx_nchan_hacked_slab.h create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/shmem.c create mode 100644 modules_deb/libnginx-mod-nchan-1.3.7+dfsg/src/util/shmem.h diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.gitmodules b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.gitmodules new file mode 100644 index 0000000..694f088 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.gitmodules @@ -0,0 +1,3 @@ +[submodule "deps/brotli"] + path = deps/brotli + url = https://github.com/google/brotli.git diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.travis.yml b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.travis.yml new file mode 100644 index 0000000..57d2b8a --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/.travis.yml @@ -0,0 +1,46 @@ +# required for http2 support in curl. +dist: bionic +language: c +sudo: false +matrix: + include: + # unfortunately, gcc-4.9 is dropped in bionic + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + env: + - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" + + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 + env: + - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" + - os: linux + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + env: + - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" + + +script: +- script/.travis-compile.sh +- script/.travis-before-test.sh +- script/.travis-test.sh +after_success: +- killall nginx +after_failure: +- killall nginx + diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/CONTRIBUTING.md b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/CONTRIBUTING.md new file mode 100644 index 0000000..a9eabff --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/CONTRIBUTING.md @@ -0,0 +1,27 @@ +# Contributing + +Want to contribute? Great! First, read this page (including the small print at the end). + +### Before you contribute +Before we can use your code, you must sign the +[Google Individual Contributor License Agreement](https://cla.developers.google.com/about/google-individual) +(CLA), which you can do online. The CLA is necessary mainly because you own the +copyright to your changes, even after your contribution becomes part of our +codebase, so we need your permission to use and distribute your code. We also +need to be sure of various other things—for instance that you'll tell us if you +know that your code infringes on other people's patents. You don't have to sign +the CLA until after you've submitted your code for review and a member has +approved it, but you must do it before we can put your code into our codebase. +Before you start working on a larger contribution, you should get in touch with +us first through the issue tracker with your idea so that we can help out and +possibly guide you. Coordinating up front makes it much easier to avoid +frustration later on. + +### Code reviews +All submissions, including submissions by project members, require review. We +use Github pull requests for this purpose. + +### The small print +Contributions made by corporations are covered by a different agreement than +the one above, the +[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate). diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE new file mode 100644 index 0000000..db3aca7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/LICENSE @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2002-2015 Igor Sysoev + * Copyright (C) 2011-2015 Nginx, Inc. + * Copyright (C) 2015-2019 Google Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/README.md b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/README.md new file mode 100644 index 0000000..80428e9 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/README.md @@ -0,0 +1,177 @@ +# ngx_brotli + +Brotli is a generic-purpose lossless compression algorithm that compresses data +using a combination of a modern variant of the LZ77 algorithm, Huffman coding +and 2nd order context modeling, with a compression ratio comparable to the best +currently available general-purpose compression methods. It is similar in speed +with deflate but offers more dense compression. + +ngx_brotli is a set of two nginx modules: + +- ngx_brotli filter module - used to compress responses on-the-fly, +- ngx_brotli static module - used to serve pre-compressed files. + +[![TravisCI Build Status](https://travis-ci.org/google/ngx_brotli.svg?branch=master)](https://travis-ci.org/google/ngx_brotli) + +## Table of Contents + +- [Status](#status) +- [Installation](#installation) +- [Configuration directives](#configuration-directives) + - [`brotli_static`](#brotli_static) + - [`brotli`](#brotli) + - [`brotli_types`](#brotli_types) + - [`brotli_buffers`](#brotli_buffers) + - [`brotli_comp_level`](#brotli_comp_level) + - [`brotli_window`](#brotli_window) + - [`brotli_min_length`](#brotli_min_length) +- [Variables](#variables) + - [`$brotli_ratio`](#brotli_ratio) +- [Sample configuration](#sample-configuration) +- [Contributing](#contributing) +- [License](#license) + +## Status + +Both Brotli library and nginx module are under active development. + +## Installation + +### Dynamically loaded + + $ cd nginx-1.x.x + $ ./configure --with-compat --add-dynamic-module=/path/to/ngx_brotli + $ make modules + +You will need to use **exactly** the same `./configure` arguments as your Nginx configuration and append `--with-compat --add-dynamic-module=/path/to/ngx_brotli` to the end, otherwise you will get a "module is not binary compatible" error on startup. You can run `nginx -V` to get the configuration arguments for your Nginx installation. + +`make modules` will result in `ngx_http_brotli_filter_module.so` and `ngx_http_brotli_static_module.so` in the `objs` directory. Copy these to `/usr/lib/nginx/modules/` then add the `load_module` directives to `nginx.conf` (above the http block): +```nginx +load_module modules/ngx_http_brotli_filter_module.so; +load_module modules/ngx_http_brotli_static_module.so; +``` + +### Statically compiled + + $ cd nginx-1.x.x + $ ./configure --add-module=/path/to/ngx_brotli + $ make && make install + +This will compile the module directly into Nginx. + +## Configuration directives + +### `brotli_static` + +- **syntax**: `brotli_static on|off|always` +- **default**: `off` +- **context**: `http`, `server`, `location` + +Enables or disables checking of the existence of pre-compressed files with`.br` +extension. With the `always` value, pre-compressed file is used in all cases, +without checking if the client supports it. + +### `brotli` + +- **syntax**: `brotli on|off` +- **default**: `off` +- **context**: `http`, `server`, `location`, `if` + +Enables or disables on-the-fly compression of responses. + +### `brotli_types` + +- **syntax**: `brotli_types [..]` +- **default**: `text/html` +- **context**: `http`, `server`, `location` + +Enables on-the-fly compression of responses for the specified MIME types +in addition to `text/html`. The special value `*` matches any MIME type. +Responses with the `text/html` MIME type are always compressed. + +### `brotli_buffers` + +- **syntax**: `brotli_buffers ` +- **default**: `32 4k|16 8k` +- **context**: `http`, `server`, `location` + +**Deprecated**, ignored. + +### `brotli_comp_level` + +- **syntax**: `brotli_comp_level ` +- **default**: `6` +- **context**: `http`, `server`, `location` + +Sets on-the-fly compression Brotli quality (compression) `level`. +Acceptable values are in the range from `0` to `11`. + +### `brotli_window` + +- **syntax**: `brotli_window ` +- **default**: `512k` +- **context**: `http`, `server`, `location` + +Sets Brotli window `size`. Acceptable values are `1k`, `2k`, `4k`, `8k`, `16k`, +`32k`, `64k`, `128k`, `256k`, `512k`, `1m`, `2m`, `4m`, `8m` and `16m`. + +### `brotli_min_length` + +- **syntax**: `brotli_min_length ` +- **default**: `20` +- **context**: `http`, `server`, `location` + +Sets the minimum `length` of a response that will be compressed. +The length is determined only from the `Content-Length` response header field. + +## Variables + +### `$brotli_ratio` + +Achieved compression ratio, computed as the ratio between the original +and compressed response sizes. + +## Sample configuration + +``` +brotli on; +brotli_comp_level 6; +brotli_static on; +brotli_types application/atom+xml application/javascript application/json application/rss+xml + application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype + application/x-font-ttf application/x-javascript application/xhtml+xml application/xml + font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon + image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml; +``` + +## Contributing + +See [Contributing](CONTRIBUTING.md). + +## License + + Copyright (C) 2002-2015 Igor Sysoev + Copyright (C) 2011-2015 Nginx, Inc. + Copyright (C) 2015 Google Inc. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/config b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/config new file mode 100644 index 0000000..42162a6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/config @@ -0,0 +1,34 @@ +# Copyright (C) 2019 Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +# Make sure the module knows it is a submodule. +ngx_addon_name=ngx_brotli +. $ngx_addon_dir/filter/config + +# Make sure the module knows it is a submodule. +ngx_addon_name=ngx_brotli +. $ngx_addon_dir/static/config + +# The final name for reporting. +ngx_addon_name=ngx_brotli diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/changelog b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/changelog new file mode 100644 index 0000000..c7021b7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/changelog @@ -0,0 +1,49 @@ +libnginx-mod-http-brotli (1.0.0~rc-6) unstable; urgency=medium + + * d/control: update my email to janmojzis@debian.org + * d/copyright: update my email to janmojzis@debian.org + * d/control: bump Standards-Version: 4.7.2, no changes + * d/copyright: bump debian/* copyright year + * d/watch: use more generic template + + -- Jan Mojžíš Fri, 11 Apr 2025 14:26:55 +0200 + +libnginx-mod-http-brotli (1.0.0~rc-5) unstable; urgency=medium + + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + + -- Jan Mojžíš Sat, 07 Oct 2023 15:31:24 +0200 + +libnginx-mod-http-brotli (1.0.0~rc-4) unstable; urgency=medium + + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Tue, 27 Jun 2023 23:16:35 +0200 + +libnginx-mod-http-brotli (1.0.0~rc-3) unstable; urgency=medium + + * d/watch: updated uversionmangle to be more generic + * d/copyright: reformat text to be compatible with 'cme update dpkg-copyright' + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 12:56:11 +0100 + +libnginx-mod-http-brotli (1.0.0~rc-2) unstable; urgency=medium + + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/p/0001-Fix-Vary-header.patch added (Closes: 1028153) + "brotli_static on;" causes "Vary: Accept-Encoding" to be added to every + file (including images, ...) + The patch fixes the problem and adds "Vary: Accept-Encoding" only to + responses when brotli static compression is used. + * d/changelog: bump my copyright year + + -- Jan Mojžíš Fri, 13 Jan 2023 17:45:13 +0100 + +libnginx-mod-http-brotli (1.0.0~rc-1) unstable; urgency=medium + + * Initial release. (Closes: 1025515) + + -- Jan Mojžíš Tue, 06 Dec 2022 10:25:40 +0100 diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/control b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/control new file mode 100644 index 0000000..6e5752d --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/control @@ -0,0 +1,41 @@ +Source: libnginx-mod-http-brotli +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jan Mojžíš , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, + libbrotli-dev, +Standards-Version: 4.7.2 +Homepage: https://github.com/google/ngx_brotli +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-brotli.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-brotli +Rules-Requires-Root: no + +Package: libnginx-mod-http-brotli-filter +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Description: Brotli lossless compression support for Nginx - filter + Brotli is a generic-purpose lossless compression algorithm that compresses + data using a combination of a modern variant of the LZ77 algorithm, Huffman + coding and 2nd order context modeling, with a compression ratio comparable + to the best currently available general-purpose compression methods. It is + similar in speed with deflate but offers more dense compression. + . + ngx_brotli filter module - used to compress responses on-the-fly + +Package: libnginx-mod-http-brotli-static +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Description: Brotli lossless compression support for Nginx - static + Brotli is a generic-purpose lossless compression algorithm that compresses + data using a combination of a modern variant of the LZ77 algorithm, Huffman + coding and 2nd order context modeling, with a compression ratio comparable + to the best currently available general-purpose compression methods. It is + similar in speed with deflate but offers more dense compression. + . + ngx_brotli static module - used to serve pre-compressed files diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/copyright b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/copyright new file mode 100644 index 0000000..2ecfff5 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/copyright @@ -0,0 +1,72 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ngx-brotli +Source: https://github.com/google/ngx_brotli + +Files: * +Copyright: 2015-2019, Google Inc. + 2011-2015, Nginx, Inc. + 2002-2015, Igor Sysoev +License: BSD-2-clause + +Files: CONTRIBUTING.md +Copyright: Copyright (C) 2015 Google Inc. + Copyright (C) 2011-2015 Nginx, Inc. + Copyright (C) 2002-2015 Igor Sysoev +License: BSD-2-clause + +Files: config +Copyright: 2015-2019, Google Inc. +License: BSD-2-clause + +Files: debian/* +Copyright: 2022, Miao Wang + 2022-2025, Jan Mojzis +License: BSD-2-clause + +Files: filter/* +Copyright: 2015-2019, Google Inc. +License: BSD-2-clause + +Files: filter/ngx_http_brotli_filter_module.c +Copyright: Nginx, Inc. + Igor Sysoev + Google Inc. +License: BSD-2-clause + +Files: script/* +Copyright: Copyright (C) 2015 Google Inc. + Copyright (C) 2011-2015 Nginx, Inc. + Copyright (C) 2002-2015 Igor Sysoev +License: BSD-2-clause + +Files: static/* +Copyright: 2015-2019, Google Inc. +License: BSD-2-clause + +Files: static/ngx_http_brotli_static_module.c +Copyright: Nginx, Inc. + Igor Sysoev + Google Inc. +License: BSD-2-clause + +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/gbp.conf b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/gbp.conf new file mode 100644 index 0000000..38c12c1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/gbp.conf @@ -0,0 +1,9 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = True +sign-tags = True + +[import-orig] +merge-mode = replace diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-filter.install b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-filter.install new file mode 100644 index 0000000..5fcd39d --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-filter.install @@ -0,0 +1 @@ +/usr/lib/nginx/modules/ngx_http_brotli_filter_module.so diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-static.install b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-static.install new file mode 100644 index 0000000..dd4a44e --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/libnginx-mod-http-brotli-static.install @@ -0,0 +1 @@ +/usr/lib/nginx/modules/ngx_http_brotli_static_module.so diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/0001-Fix-Vary-header.patch b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/0001-Fix-Vary-header.patch new file mode 100644 index 0000000..09735a7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/0001-Fix-Vary-header.patch @@ -0,0 +1,38 @@ +From: Jan Mojzis +Date: Fri, 13 Jan 2023 12:59:07 +0100 +Subject: Fix 'Vary' header + +The patch fixes problem described here: +https://github.com/google/ngx_brotli/issues/97 + +"brotli_static on;" causes "Vary: Accept-Encoding" to be added to every +file (including images, ...) +The patch fixes the problem and adds "Vary: Accept-Encoding" only to +responses when brotli static compression is used. +--- + static/ngx_http_brotli_static_module.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/static/ngx_http_brotli_static_module.c b/static/ngx_http_brotli_static_module.c +index 8f96177..44f0cb0 100644 +--- a/static/ngx_http_brotli_static_module.c ++++ b/static/ngx_http_brotli_static_module.c +@@ -168,7 +168,6 @@ static ngx_int_t handler(ngx_http_request_t* req) { + /* Ignore request properties (e.g. Accept-Encoding). */ + } else { + /* NGX_HTTP_BROTLI_STATIC_ON */ +- req->gzip_vary = 1; + rc = check_eligility(req); + if (rc != NGX_OK) return NGX_DECLINED; + } +@@ -227,6 +226,10 @@ static ngx_int_t handler(ngx_http_request_t* req) { + return NGX_DECLINED; + } + ++ if (cfg->enable == NGX_HTTP_BROTLI_STATIC_ON) { ++ req->gzip_vary = 1; ++ } ++ + /* So far so good. */ + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", + file_info.fd); diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/series b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/series new file mode 100644 index 0000000..dfd7340 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/patches/series @@ -0,0 +1 @@ +0001-Fix-Vary-header.patch diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/rules b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/rules new file mode 100755 index 0000000..d8309f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/source/format b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/control b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/control new file mode 100644 index 0000000..de69689 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/control @@ -0,0 +1,22 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, + +Tests: static +Restrictions: allow-stderr isolation-container needs-root +Depends: brotli, + curl, + libnginx-mod-http-brotli-static, + nginx, + nginx-core, + +Tests: filter +Restrictions: allow-stderr isolation-container needs-root +Depends: brotli, + curl, + libnginx-mod-http-brotli-filter, + nginx, + nginx-core, diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/filter b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/filter new file mode 100644 index 0000000..16ac356 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/filter @@ -0,0 +1,44 @@ +#!/bin/sh +set -e + +cat < "/etc/nginx/sites-enabled/default" +server { + listen 80 default_server; + root /var/www/html; + + location /helloworld { + default_type text/plain; + brotli on; + brotli_types text/plain; + brotli_min_length 10; + brotli_comp_level 11; + } +} +EOF + +mkdir -p /var/www/html +echo 'hello world' > /var/www/html/helloworld + +exp="content-encoding: br +hello world +response_code: 200" + +nginx -t +invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; } + +out=`curl --compressed --fail -D- -w "response_code: %{http_code}\n" http://127.0.0.1/helloworld` +out=`echo "${out}" | sed 's/\r//'` +out=`echo "${out}" | awk '{print tolower($0)}'` +out=`echo "${out}" | grep '^content-encoding: \|^hello world$\|response_code: '` + +if [ x"${out}" != x"${exp}" ]; then + echo "output:" + echo "=====================" + echo "${out}" + echo "=====================" + echo "expected output:" + echo "=====================" + echo "${exp}" + echo "=====================" + exit 1 +fi diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/generic b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/static b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/static new file mode 100644 index 0000000..bce1fbc --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/tests/static @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +cat < "/etc/nginx/sites-enabled/default" +server { + listen 80 default_server; + root /var/www/html; + + location /helloworld { + brotli_static on; + } +} +EOF + +mkdir -p /var/www/html +echo 'hello world' | brotli -9 > /var/www/html/helloworld.br + +exp="hello world +response_code: 200" + +nginx -t +invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; } + +out=`curl --compressed --fail -w "response_code: %{http_code}\n" http://127.0.0.1/helloworld` + +if [ x"${out}" != x"${exp}" ]; then + echo "output:" + echo "=====================" + echo "${out}" + echo "=====================" + echo "expected output:" + echo "=====================" + echo "${exp}" + echo "=====================" + exit 1 +fi diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/upstream/metadata b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/upstream/metadata new file mode 100644 index 0000000..30627c6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/google/ngx_brotli/issues +Bug-Submit: https://github.com/google/ngx_brotli/issues/new +Repository-Browse: https://github.com/google/ngx_brotli diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/watch b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/watch new file mode 100644 index 0000000..08b8983 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/google/ngx_brotli/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/config b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/config new file mode 100644 index 0000000..9c27fc7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/config @@ -0,0 +1,132 @@ +# Copyright (C) 2015-2016 Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +if [ "$ngx_addon_name" = "ngx_brotli" ]; then + BROTLI_MODULE_SRC_DIR="$ngx_addon_dir/filter" +else + BROTLI_MODULE_SRC_DIR="$ngx_addon_dir" +fi + +ngx_addon_name=ngx_brotli_filter + +if [ -z "$ngx_module_link" ]; then +cat << END + +$0: error: Brotli module requires recent version of NGINX (1.9.11+). + +END + exit 1 +fi + +ngx_module_type=HTTP_FILTER +ngx_module_name=ngx_http_brotli_filter_module + +brotli="$ngx_addon_dir/deps/brotli/c" +if [ ! -f "$brotli/include/brotli/encode.h" ]; then + brotli="/usr/local" +fi +if [ ! -f "$brotli/include/brotli/encode.h" ]; then + brotli="/usr" +fi +if [ ! -f "$brotli/include/brotli/encode.h" ]; then +cat << END + +$0: error: \ +Brotli library is missing from the $brotli directory. + +Please make sure that the git submodule has been checked out: + + cd $ngx_addon_dir && git submodule update --init && cd $PWD + +END + exit 1 +fi + +BROTLI_LISTS_FILE="$brotli/../scripts/sources.lst" + +if [ -f "$BROTLI_LISTS_FILE" ]; then + +BROTLI_LISTS=`cat "$BROTLI_LISTS_FILE" | grep -v "#" | tr '\n' '#' | \ + sed 's/\\\\#//g' | tr -s ' ' '+' | tr -s '#' ' ' | \ + sed 's/+c/+$brotli/g' | sed 's/+=+/=/g'` +for ITEM in ${BROTLI_LISTS}; do + VAR=`echo $ITEM | sed 's/=.*//'` + VAL=`echo $ITEM | sed 's/.*=//' | tr '+' ' '` + eval ${VAR}=\"$VAL\" +done + +else # BROTLI_LISTS_FILE + +BROTLI_ENC_H="$brotli/include/brotli/encode.h \ + $brotli/include/brotli/port.h \ + $brotli/include/brotli/types.h" +BROTLI_ENC_LIB="-lbrotlienc" + +fi + +ngx_module_incs="$brotli/include" +ngx_module_deps="$BROTLI_COMMON_H $BROTLI_ENC_H" +ngx_module_srcs="$BROTLI_COMMON_C $BROTLI_ENC_C \ + $BROTLI_MODULE_SRC_DIR/ngx_http_brotli_filter_module.c" +ngx_module_libs="$BROTLI_ENC_LIB -lm" +ngx_module_order="$ngx_module_name \ + ngx_pagespeed \ + ngx_http_postpone_filter_module \ + ngx_http_ssi_filter_module \ + ngx_http_charset_filter_module \ + ngx_http_xslt_filter_module \ + ngx_http_image_filter_module \ + ngx_http_sub_filter_module \ + ngx_http_addition_filter_module \ + ngx_http_gunzip_filter_module \ + ngx_http_userid_filter_module \ + ngx_http_headers_filter_module \ + ngx_http_copy_filter_module \ + ngx_http_range_body_filter_module \ + ngx_http_not_modified_filter_module \ + ngx_http_slice_filter_module" + +. auto/module + +if [ "$ngx_module_link" != DYNAMIC ]; then + # ngx_module_order doesn't work with static modules, + # so we must re-order filters here. + + if [ "$HTTP_GZIP" = YES ]; then + next=ngx_http_gzip_filter_module + elif echo $HTTP_FILTER_MODULES | grep pagespeed_etag_filter >/dev/null; then + next=ngx_pagespeed_etag_filter + else + next=ngx_http_range_header_filter_module + fi + + HTTP_FILTER_MODULES=`echo $HTTP_FILTER_MODULES \ + | sed "s/$ngx_module_name//" \ + | sed "s/$next/$next $ngx_module_name/"` +fi + +CFLAGS="$CFLAGS -Wno-deprecated-declarations" + +have=NGX_HTTP_BROTLI_FILTER . auto/have +have=NGX_HTTP_BROTLI_FILTER_MODULE . auto/have # deprecated diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/ngx_http_brotli_filter_module.c b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/ngx_http_brotli_filter_module.c new file mode 100644 index 0000000..592b767 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/filter/ngx_http_brotli_filter_module.c @@ -0,0 +1,770 @@ +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + * Copyright (C) Google Inc. + */ + +#include +#include +#include + +#if (NGX_HAVE_BROTLI_ENC_ENCODE_H) +#include +#else +#include +#endif + +/* Brotli and GZip modules never stack, i.e. when one of them sets + "Content-Encoding" the other becomes a pass-through filter. Consequently, + it is almost legal to reuse this "buffered" bit. + IIUC, buffered == some data passed to filter has not been pushed further. */ +#define NGX_HTTP_BROTLI_BUFFERED NGX_HTTP_GZIP_BUFFERED + +/* Module configuration. */ +typedef struct { + ngx_flag_t enable; + + /* Supported MIME types. */ + ngx_hash_t types; + ngx_array_t* types_keys; + + /* Minimal required length for compression (if known). */ + ssize_t min_length; + + ngx_bufs_t deprecated_unused_bufs; + + /* Brotli encoder parameter: quality */ + ngx_int_t quality; + + /* Brotli encoder parameter: (max) lg_win */ + size_t lg_win; +} ngx_http_brotli_conf_t; + +/* Instance context. */ +typedef struct { + /* Brotli encoder instance. */ + BrotliEncoderState* encoder; + + /* Payload length; -1, if unknown. */ + off_t content_length; + + /* (uncompressed) bytes pushed to encoder. */ + size_t bytes_in; + /* (compressed) bytes pulled from encoder. */ + size_t bytes_out; + + /* Input buffer chain. */ + ngx_chain_t* in; + + /* Output chain. */ + ngx_chain_t* out_chain; + + /* Output buffer. */ + ngx_buf_t* out_buf; + + /* Various state flags. */ + + /* 1 if encoder is initialized, output chain and buffer are allocated. */ + unsigned initialized : 1; + /* 1 if compression is finished / failed. */ + unsigned closed : 1; + /* 1 if compression is finished. */ + unsigned success : 1; + + /* 1 if out_chain is ready to be committed, 0 otherwise. */ + unsigned output_ready : 1; + /* 1 if output buffer is committed to the next filter and not yet fully used. + 0 otherwise. */ + unsigned output_busy : 1; + + unsigned end_of_input : 1; + unsigned end_of_block : 1; + + ngx_http_request_t* request; +} ngx_http_brotli_ctx_t; + +/* Forward declarations. */ + +/* Initializes encoder, output chain and buffer, if necessary. Returns NGX_OK + if encoder is successfully initialized (have been already initialized), + and requires objects are allocated. Returns NGX_ERROR otherwise. */ +static ngx_int_t ngx_http_brotli_filter_ensure_stream_initialized( + ngx_http_request_t* r, ngx_http_brotli_ctx_t* ctx); +/* Marks instance as closed and performs cleanup. */ +static void ngx_http_brotli_filter_close(ngx_http_brotli_ctx_t* ctx); + +static void* ngx_http_brotli_filter_alloc(void* opaque, size_t size); +static void ngx_http_brotli_filter_free(void* opaque, void* address); + +static ngx_int_t ngx_http_brotli_check_request(ngx_http_request_t* r); + +static ngx_int_t ngx_http_brotli_add_variables(ngx_conf_t* cf); +static ngx_int_t ngx_http_brotli_ratio_variable(ngx_http_request_t* r, + ngx_http_variable_value_t* v, + uintptr_t data); + +static void* ngx_http_brotli_create_conf(ngx_conf_t* cf); +static char* ngx_http_brotli_merge_conf(ngx_conf_t* cf, void* parent, + void* child); +static ngx_int_t ngx_http_brotli_filter_init(ngx_conf_t* cf); + +static char* ngx_http_brotli_parse_wbits(ngx_conf_t* cf, void* post, + void* data); + +/* Configuration literals. */ + +static ngx_conf_num_bounds_t ngx_http_brotli_comp_level_bounds = { + ngx_conf_check_num_bounds, BROTLI_MIN_QUALITY, BROTLI_MAX_QUALITY}; + +static ngx_conf_post_handler_pt ngx_http_brotli_parse_wbits_p = + ngx_http_brotli_parse_wbits; + +static ngx_command_t ngx_http_brotli_filter_commands[] = { + {ngx_string("brotli"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_HTTP_LIF_CONF | NGX_CONF_FLAG, + ngx_conf_set_flag_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_brotli_conf_t, enable), NULL}, + + /* Deprecated, unused. */ + {ngx_string("brotli_buffers"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_CONF_TAKE2, + ngx_conf_set_bufs_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_brotli_conf_t, deprecated_unused_bufs), NULL}, + + {ngx_string("brotli_types"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_CONF_1MORE, + ngx_http_types_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_brotli_conf_t, types_keys), + &ngx_http_html_default_types[0]}, + + {ngx_string("brotli_comp_level"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_CONF_TAKE1, + ngx_conf_set_num_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_brotli_conf_t, quality), + &ngx_http_brotli_comp_level_bounds}, + + {ngx_string("brotli_window"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_CONF_TAKE1, + ngx_conf_set_size_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_brotli_conf_t, lg_win), &ngx_http_brotli_parse_wbits_p}, + + {ngx_string("brotli_min_length"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_CONF_TAKE1, + ngx_conf_set_size_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_brotli_conf_t, min_length), NULL}, + + ngx_null_command}; + +/* Module context hooks. */ +static ngx_http_module_t ngx_http_brotli_filter_module_ctx = { + ngx_http_brotli_add_variables, /* pre-configuration */ + ngx_http_brotli_filter_init, /* post-configuration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_brotli_create_conf, /* create location configuration */ + ngx_http_brotli_merge_conf /* merge location configuration */ +}; + +/* Module descriptor. */ +ngx_module_t ngx_http_brotli_filter_module = { + NGX_MODULE_V1, + &ngx_http_brotli_filter_module_ctx, /* module context */ + ngx_http_brotli_filter_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING}; + +/* Variable names. */ +static ngx_str_t ngx_http_brotli_ratio = ngx_string("brotli_ratio"); + +/* Next filter in the filter chain. */ +static ngx_http_output_header_filter_pt ngx_http_next_header_filter; +static ngx_http_output_body_filter_pt ngx_http_next_body_filter; + +static /* const */ char kEncoding[] = "br"; +static const size_t kEncodingLen = 2; + +static ngx_int_t check_accept_encoding(ngx_http_request_t* req) { + ngx_table_elt_t* accept_encoding_entry; + ngx_str_t* accept_encoding; + u_char* cursor; + u_char* end; + u_char before; + u_char after; + + accept_encoding_entry = req->headers_in.accept_encoding; + if (accept_encoding_entry == NULL) return NGX_DECLINED; + accept_encoding = &accept_encoding_entry->value; + + cursor = accept_encoding->data; + end = cursor + accept_encoding->len; + while (1) { + u_char digit; + /* It would be an idiotic idea to rely on compiler to produce performant + binary, that is why we just do -1 at every call site. */ + cursor = ngx_strcasestrn(cursor, kEncoding, kEncodingLen - 1); + if (cursor == NULL) return NGX_DECLINED; + before = (cursor == accept_encoding->data) ? ' ' : cursor[-1]; + cursor += kEncodingLen; + after = (cursor >= end) ? ' ' : *cursor; + if (before != ',' && before != ' ') continue; + if (after != ',' && after != ' ' && after != ';') continue; + + /* Check for ";q=0[.[0[0[0]]]]" */ + while (*cursor == ' ') cursor++; + if (*(cursor++) != ';') break; + while (*cursor == ' ') cursor++; + if (*(cursor++) != 'q') break; + while (*cursor == ' ') cursor++; + if (*(cursor++) != '=') break; + while (*cursor == ' ') cursor++; + if (*(cursor++) != '0') break; + if (*(cursor++) != '.') return NGX_DECLINED; /* ;q=0, */ + digit = *(cursor++); + if (digit < '0' || digit > '9') return NGX_DECLINED; /* ;q=0., */ + if (digit > '0') break; + digit = *(cursor++); + if (digit < '0' || digit > '9') return NGX_DECLINED; /* ;q=0.0, */ + if (digit > '0') break; + digit = *(cursor++); + if (digit < '0' || digit > '9') return NGX_DECLINED; /* ;q=0.00, */ + if (digit > '0') break; + return NGX_DECLINED; /* ;q=0.000 */ + } + return NGX_OK; +} + +/* Process headers and decide if request is eligible for brotli compression. */ +static ngx_int_t ngx_http_brotli_header_filter(ngx_http_request_t* r) { + ngx_table_elt_t* h; + ngx_http_brotli_ctx_t* ctx; + ngx_http_brotli_conf_t* conf; + + conf = ngx_http_get_module_loc_conf(r, ngx_http_brotli_filter_module); + + /* Filter only if enabled. */ + if (!conf->enable) { + return ngx_http_next_header_filter(r); + } + + /* Only compress OK / forbidden / not found responses. */ + if (r->headers_out.status != NGX_HTTP_OK && + r->headers_out.status != NGX_HTTP_FORBIDDEN && + r->headers_out.status != NGX_HTTP_NOT_FOUND) { + return ngx_http_next_header_filter(r); + } + + /* Bypass "header only" responses. */ + if (r->header_only) { + return ngx_http_next_header_filter(r); + } + + /* Bypass already compressed responses. */ + if (r->headers_out.content_encoding && + r->headers_out.content_encoding->value.len) { + return ngx_http_next_header_filter(r); + } + + /* If response size is known, do not compress tiny responses. */ + if (r->headers_out.content_length_n != -1 && + r->headers_out.content_length_n < conf->min_length) { + return ngx_http_next_header_filter(r); + } + + /* Compress only certain MIME-typed responses. */ + if (ngx_http_test_content_type(r, &conf->types) == NULL) { + return ngx_http_next_header_filter(r); + } + + r->gzip_vary = 1; + + /* Check if client support brotli encoding. */ + if (ngx_http_brotli_check_request(r) != NGX_OK) { + return ngx_http_next_header_filter(r); + } + + /* Prepare instance context. */ + ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_brotli_ctx_t)); + if (ctx == NULL) { + return NGX_ERROR; + } + ctx->request = r; + ctx->content_length = r->headers_out.content_length_n; + ngx_http_set_ctx(r, ctx, ngx_http_brotli_filter_module); + + /* Prepare response headers, so that following filters in the chain will + notice that response body is compressed. */ + h = ngx_list_push(&r->headers_out.headers); + if (h == NULL) { + return NGX_ERROR; + } + + h->hash = 1; + ngx_str_set(&h->key, "Content-Encoding"); + ngx_str_set(&h->value, "br"); + r->headers_out.content_encoding = h; + + r->main_filter_need_in_memory = 1; + + ngx_http_clear_content_length(r); + ngx_http_clear_accept_ranges(r); + ngx_http_weak_etag(r); + + return ngx_http_next_header_filter(r); +} + +/* Response body filtration (compression). */ +static ngx_int_t ngx_http_brotli_body_filter(ngx_http_request_t* r, + ngx_chain_t* in) { + int rc; + ngx_http_brotli_ctx_t* ctx; + size_t available_output; + ptrdiff_t available_busy_output; + size_t input_size; + size_t available_input; + const uint8_t* next_input_byte; + size_t consumed_input; + BROTLI_BOOL ok; + u_char* out; + ngx_chain_t* link; + + ctx = ngx_http_get_module_ctx(r, ngx_http_brotli_filter_module); + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http brotli filter"); + + if (ctx == NULL || ctx->closed || r->header_only) { + return ngx_http_next_body_filter(r, in); + } + + if (ngx_http_brotli_filter_ensure_stream_initialized(r, ctx) != NGX_OK) { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + + /* If more input is provided - append it to our input chain. */ + if (in) { + if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + r->connection->buffered |= NGX_HTTP_BROTLI_BUFFERED; + } + + /* Main loop: + - if output is not yet consumed - stop; encoder should not be touched, + until all the output is consumed + - if encoder has output - wrap it and send to consumer + - if encoder is finished (and all output is consumed) - stop + - if there is more input - push it to encoder */ + for (;;) { + if (ctx->output_busy || ctx->output_ready) { + if (ctx->output_busy) { + available_busy_output = ngx_buf_size(ctx->out_buf); + } else { + available_busy_output = 0; + } + + rc = ngx_http_next_body_filter(r, + ctx->output_ready ? ctx->out_chain : NULL); + if (ctx->output_ready) { + ctx->output_ready = 0; + ctx->output_busy = 1; + } + if (ngx_buf_size(ctx->out_buf) == 0) { + ctx->output_busy = 0; + } + if (rc == NGX_OK) { + if (ctx->output_busy && + available_busy_output == ngx_buf_size(ctx->out_buf)) { + r->connection->buffered |= NGX_HTTP_BROTLI_BUFFERED; + return NGX_AGAIN; + } + continue; + } else if (rc == NGX_AGAIN) { + if (ctx->output_busy) { + /* Can't continue compression, let the outer filer decide. */ + if (ctx->in != NULL) { + r->connection->buffered |= NGX_HTTP_BROTLI_BUFFERED; + } + return NGX_AGAIN; + } else { + /* Inner filter has given up, but we can continue processing. */ + continue; + } + } else { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + } + + if (BrotliEncoderHasMoreOutput(ctx->encoder)) { + available_output = 0; + out = (u_char*)BrotliEncoderTakeOutput(ctx->encoder, &available_output); + if (out == NULL || available_output == 0) { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + ctx->out_buf->start = out; + ctx->out_buf->pos = out; + ctx->out_buf->last = out + available_output; + ctx->out_buf->end = out + available_output; + ctx->bytes_out += available_output; + ctx->out_buf->last_buf = 0; + ctx->out_buf->flush = 0; + if (ctx->end_of_input && BrotliEncoderIsFinished(ctx->encoder)) { + ctx->out_buf->last_buf = 1; + r->connection->buffered &= ~NGX_HTTP_BROTLI_BUFFERED; + } else if (ctx->end_of_block) { + ctx->out_buf->flush = 1; + r->connection->buffered &= ~NGX_HTTP_BROTLI_BUFFERED; + } + ctx->end_of_block = 0; + ctx->output_ready = 1; + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "brotli out: %p, size:%uz", ctx->out_buf, + ngx_buf_size(ctx->out_buf)); + continue; + } + + if (BrotliEncoderIsFinished(ctx->encoder)) { + ctx->success = 1; + r->connection->buffered &= ~NGX_HTTP_BROTLI_BUFFERED; + ngx_http_brotli_filter_close(ctx); + return NGX_OK; + } + + if (ctx->end_of_input) { + // Ask the encoder to dump the leftover. + available_input = 0; + available_output = 0; + ok = BrotliEncoderCompressStream(ctx->encoder, BROTLI_OPERATION_FINISH, + &available_input, NULL, + &available_output, NULL, NULL); + r->connection->buffered |= NGX_HTTP_BROTLI_BUFFERED; + if (!ok) { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + continue; + } + + if (ctx->in == NULL) { + return NGX_OK; + } + + /* TODO: coalesce tiny inputs, if they are not last/flush. */ + input_size = ngx_buf_size(ctx->in->buf); + if (input_size == 0) { + if (!ctx->in->buf->last_buf && !ctx->in->buf->flush) { + link = ctx->in; + ctx->in = ctx->in->next; + ngx_free_chain(r->pool, link); + continue; + } + } + + available_input = input_size; + next_input_byte = (const uint8_t*)ctx->in->buf->pos; + available_output = 0; + ok = BrotliEncoderCompressStream( + ctx->encoder, + ctx->in->buf->last_buf ? BROTLI_OPERATION_FINISH + : ctx->in->buf->flush ? BROTLI_OPERATION_FLUSH + : BROTLI_OPERATION_PROCESS, + &available_input, &next_input_byte, &available_output, NULL, NULL); + r->connection->buffered |= NGX_HTTP_BROTLI_BUFFERED; + if (!ok) { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + + consumed_input = input_size - available_input; + ctx->bytes_in += consumed_input; + ctx->in->buf->pos += consumed_input; + + if (consumed_input == input_size) { + if (ctx->in->buf->last_buf) { + ctx->end_of_input = 1; + } else if (ctx->in->buf->flush) { + ctx->end_of_block = 1; + } + link = ctx->in; + ctx->in = ctx->in->next; + ngx_free_chain(r->pool, link); + continue; + } + + /* Should never happen, just to make sure we don't enter infinite loop. */ + if (consumed_input == 0) { + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; + } + } + + /* unreachable */ + ngx_http_brotli_filter_close(ctx); + return NGX_ERROR; +} + +static ngx_int_t ngx_http_brotli_filter_ensure_stream_initialized( + ngx_http_request_t* r, ngx_http_brotli_ctx_t* ctx) { + ngx_http_brotli_conf_t* conf; + BROTLI_BOOL ok; + size_t wbits; + + if (ctx->initialized) { + return NGX_OK; + } + ctx->initialized = 1; + + conf = ngx_http_get_module_loc_conf(r, ngx_http_brotli_filter_module); + + /* Tune lg_win, if size is known. */ + if (ctx->content_length > 0) { + wbits = BROTLI_MIN_WINDOW_BITS; + while ((wbits < conf->lg_win) && (ctx->content_length > (1 << wbits))) { + wbits++; + } + } else { + wbits = conf->lg_win; + } + + ctx->encoder = BrotliEncoderCreateInstance( + ngx_http_brotli_filter_alloc, ngx_http_brotli_filter_free, r->pool); + if (ctx->encoder == NULL) { + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "OOM / BrotliEncoderCreateInstance"); + return NGX_ERROR; + } + + ok = BrotliEncoderSetParameter(ctx->encoder, BROTLI_PARAM_QUALITY, + (uint32_t)conf->quality); + if (!ok) { + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "BrotliEncoderSetParameter(QUALITY, %uD) failed", + (uint32_t)conf->quality); + return NGX_ERROR; + } + + ok = BrotliEncoderSetParameter(ctx->encoder, BROTLI_PARAM_LGWIN, + (uint32_t)wbits); + if (!ok) { + ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, + "BrotliEncoderSetParameter(LGWIN, %uD) failed", + (uint32_t)wbits); + return NGX_ERROR; + } + + ctx->out_buf = ngx_calloc_buf(r->pool); + if (ctx->out_buf == NULL) { + return NGX_ERROR; + } + ctx->out_buf->temporary = 1; + + ctx->out_chain = ngx_alloc_chain_link(r->pool); + if (ctx->out_chain == NULL) { + return NGX_ERROR; + } + ctx->out_chain->buf = ctx->out_buf; + ctx->out_chain->next = NULL; + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "brotli encoder initialized: lvl:%i win:%d", conf->quality, + (1 << wbits)); + + return NGX_OK; +} + +static void* ngx_http_brotli_filter_alloc(void* opaque, size_t size) { + ngx_pool_t* pool = opaque; + void* p; + + p = ngx_palloc(pool, size); + +#if (NGX_DEBUG) + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pool->log, 0, "brotli alloc: %p, size:%uz", + p, size); +#endif + + return p; +} + +static void ngx_http_brotli_filter_free(void* opaque, void* address) { + ngx_pool_t* pool = opaque; + +#if (NGX_DEBUG) + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pool->log, 0, "brotli free: %p", address); +#endif + + ngx_pfree(pool, address); +} + +static void ngx_http_brotli_filter_close(ngx_http_brotli_ctx_t* ctx) { + ctx->closed = 1; + if (ctx->encoder) { + BrotliEncoderDestroyInstance(ctx->encoder); + ctx->encoder = NULL; + } + if (ctx->out_chain) { + ngx_free_chain(ctx->request->pool, ctx->out_chain); + ctx->out_chain = NULL; + } + if (ctx->out_buf) { + ngx_pfree(ctx->request->pool, ctx->out_buf); + ctx->out_buf = NULL; + } +} + +static ngx_int_t ngx_http_brotli_check_request(ngx_http_request_t* req) { + if (req != req->main) return NGX_DECLINED; + if (check_accept_encoding(req) != NGX_OK) return NGX_DECLINED; + req->gzip_tested = 1; + req->gzip_ok = 0; + return NGX_OK; +} + +static ngx_int_t ngx_http_brotli_add_variables(ngx_conf_t* cf) { + ngx_http_variable_t* var; + + var = ngx_http_add_variable(cf, &ngx_http_brotli_ratio, 0); + if (var == NULL) { + return NGX_ERROR; + } + + var->get_handler = ngx_http_brotli_ratio_variable; + + return NGX_OK; +} + +static ngx_int_t ngx_http_brotli_ratio_variable(ngx_http_request_t* r, + ngx_http_variable_value_t* v, + uintptr_t data) { + ngx_uint_t ratio_int; + ngx_uint_t ratio_frac; + ngx_http_brotli_ctx_t* ctx; + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + ctx = ngx_http_get_module_ctx(r, ngx_http_brotli_filter_module); + + /* Only report variable on non-failing streams. */ + if (ctx == NULL || !ctx->success) { + v->not_found = 1; + return NGX_OK; + } + + v->data = ngx_pnalloc(r->pool, NGX_INT32_LEN + 3); + if (v->data == NULL) { + return NGX_ERROR; + } + + ratio_int = (ngx_uint_t)(ctx->bytes_in / ctx->bytes_out); + ratio_frac = (ngx_uint_t)((ctx->bytes_in * 100 / ctx->bytes_out) % 100); + + /* Rounding; e.g. 2.125 to 2.13 */ + if ((ctx->bytes_in * 1000 / ctx->bytes_out) % 10 > 4) { + ratio_frac++; + if (ratio_frac > 99) { + ratio_int++; + ratio_frac = 0; + } + } + + v->len = ngx_sprintf(v->data, "%ui.%02ui", ratio_int, ratio_frac) - v->data; + + return NGX_OK; +} + +static void* ngx_http_brotli_create_conf(ngx_conf_t* cf) { + ngx_http_brotli_conf_t* conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_brotli_conf_t)); + if (conf == NULL) { + return NULL; + } + + /* ngx_pcalloc fills result with zeros -> + conf->bufs.num = 0; + conf->types = { NULL }; + conf->types_keys = NULL; */ + + conf->enable = NGX_CONF_UNSET; + + conf->quality = NGX_CONF_UNSET; + conf->lg_win = NGX_CONF_UNSET_SIZE; + conf->min_length = NGX_CONF_UNSET; + + return conf; +} + +static char* ngx_http_brotli_merge_conf(ngx_conf_t* cf, void* parent, + void* child) { + ngx_http_brotli_conf_t* prev = parent; + ngx_http_brotli_conf_t* conf = child; + char* rc; + + ngx_conf_merge_value(conf->enable, prev->enable, 0); + + ngx_conf_merge_value(conf->quality, prev->quality, 6); + ngx_conf_merge_size_value(conf->lg_win, prev->lg_win, 19); + ngx_conf_merge_value(conf->min_length, prev->min_length, 20); + + rc = ngx_http_merge_types(cf, &conf->types_keys, &conf->types, + &prev->types_keys, &prev->types, + ngx_http_html_default_types); + if (rc != NGX_CONF_OK) { + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + +/* Prepend to filter chain. */ +static ngx_int_t ngx_http_brotli_filter_init(ngx_conf_t* cf) { + ngx_http_next_header_filter = ngx_http_top_header_filter; + ngx_http_top_header_filter = ngx_http_brotli_header_filter; + + ngx_http_next_body_filter = ngx_http_top_body_filter; + ngx_http_top_body_filter = ngx_http_brotli_body_filter; + + return NGX_OK; +} + +/* Translate "window size" to window bits (log2), and check bounds. */ +static char* ngx_http_brotli_parse_wbits(ngx_conf_t* cf, void* post, + void* data) { + size_t* parameter = data; + size_t bits; + size_t wsize; + + for (bits = BROTLI_MIN_WINDOW_BITS; bits <= BROTLI_MAX_WINDOW_BITS; bits++) { + wsize = 1u << bits; + if (*parameter == wsize) { + *parameter = bits; + return NGX_CONF_OK; + } + } + + return "must be 1k, 2k, 4k, 8k, 16k, 32k, 64k, 128k, 256k, 512k, 1m, 2m, 4m, " + "8m or 16m"; +} diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-before-test.sh b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-before-test.sh new file mode 100755 index 0000000..9f69164 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-before-test.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -ex + +# Setup shortcuts. +ROOT=`pwd` +FILES=$ROOT/script/test + +# Setup directory structure. +cd $ROOT/script +if [ ! -d test ]; then + mkdir test +fi +cd test +if [ ! -d logs ]; then + mkdir logs +fi + +# Download sample texts. +curl --compressed -o $FILES/war-and-peace.txt http://www.gutenberg.org/files/2600/2600-0.txt +echo "Kot lomom kolol slona!" > $FILES/small.txt +echo "Kot lomom kolol slona!" > $FILES/small.html + +# Restore status-quo. +cd $ROOT diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-compile.sh b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-compile.sh new file mode 100755 index 0000000..2fa01d6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-compile.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -ex + +# Setup shortcuts. +ROOT=`pwd` + +# Clone nginx read-only git repository. +if [ ! -d "nginx" ]; then + git clone https://github.com/nginx/nginx.git +fi + +# Build nginx + filter module. +cd $ROOT/nginx +# Pro memoria: --with-debug +./auto/configure \ + --prefix=$ROOT/script/test \ + --with-http_v2_module \ + --add-module=$ROOT +make -j 16 + +# Build brotli CLI. +cd $ROOT/deps/brotli +mkdir out +cd out +cmake .. +make -j 16 brotli + +# Restore status-quo. +cd $ROOT diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-test.sh b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-test.sh new file mode 100755 index 0000000..1db8d15 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/.travis-test.sh @@ -0,0 +1,168 @@ +#!/bin/bash + +# Setup shortcuts. +ROOT=`pwd` +NGINX=$ROOT/nginx/objs/nginx +BROTLI=$ROOT/deps/brotli/out/brotli +SERVER=http://localhost:8080 +FILES=$ROOT/script/test +HR="---------------------------------------------------------------------------" + +if [ ! -d tmp ]; then + mkdir tmp +fi + +rm tmp/* + +add_result() { + echo $1 >&2 + echo $1 >> tmp/results.log +} + +get_failed() { + echo `cat tmp/results.log | grep -v OK | wc -l` +} + +get_count() { + echo `cat tmp/results.log | wc -l` +} + +expect_equal() { + expected=$1 + actual=$2 + if cmp $expected $actual; then + add_result "OK" + else + add_result "FAIL (equality)" + fi +} + +expect_br_equal() { + expected=$1 + actual_br=$2 + if $BROTLI -dfk ./${actual_br}.br; then + expect_equal $expected $actual_br + else + add_result "FAIL (decompression)" + fi +} + +################################################################################ + +# Start default server. +echo "Statring NGINX" +$NGINX -c $ROOT/script/test.conf +# Fetch vanilla 404 response. +curl -s -o tmp/notfound.txt $SERVER/notfound + +CURL="curl -s" + +# Run tests. +echo $HR + +echo "Test: long file with rate limit" +$CURL -H 'Accept-encoding: br' -o tmp/war-and-peace.br --limit-rate 300K $SERVER/war-and-peace.txt +expect_br_equal $FILES/war-and-peace.txt tmp/war-and-peace + +echo "Test: compressed 404" +$CURL -H 'Accept-encoding: br' -o tmp/notfound.br $SERVER/notfound +expect_br_equal tmp/notfound.txt tmp/notfound + +echo "Test: A-E: 'gzip, br'" +$CURL -H 'Accept-encoding: gzip, br' -o tmp/ae-01.br $SERVER/small.txt +expect_br_equal $FILES/small.txt tmp/ae-01 + +echo "Test: A-E: 'gzip, br, deflate'" +$CURL -H 'Accept-encoding: gzip, br, deflate' -o tmp/ae-02.br $SERVER/small.txt +expect_br_equal $FILES/small.txt tmp/ae-02 + +echo "Test: A-E: 'gzip, br;q=1, deflate'" +$CURL -H 'Accept-encoding: gzip, br;q=1, deflate' -o tmp/ae-03.br $SERVER/small.txt +expect_br_equal $FILES/small.txt tmp/ae-03 + +echo "Test: A-E: 'br;q=0.001'" +$CURL -H 'Accept-encoding: br;q=0.001' -o tmp/ae-04.br $SERVER/small.txt +expect_br_equal $FILES/small.txt tmp/ae-04 + +echo "Test: A-E: 'bro'" +$CURL -H 'Accept-encoding: bro' -o tmp/ae-05.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-05.txt + +echo "Test: A-E: 'bo'" +$CURL -H 'Accept-encoding: bo' -o tmp/ae-06.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-06.txt + +echo "Test: A-E: 'br;q=0'" +$CURL -H 'Accept-encoding: br;q=0' -o tmp/ae-07.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-07.txt + +echo "Test: A-E: 'br;q=0.'" +$CURL -H 'Accept-encoding: br;q=0.' -o tmp/ae-08.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-08.txt + +echo "Test: A-E: 'br;q=0.0'" +$CURL -H 'Accept-encoding: br;q=0.0' -o tmp/ae-09.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-09.txt + +echo "Test: A-E: 'br;q=0.00'" +$CURL -H 'Accept-encoding: br;q=0.00' -o tmp/ae-10.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-10.txt + +echo "Test: A-E: 'br ; q = 0.000'" +$CURL -H 'Accept-encoding: br ; q = 0.000' -o tmp/ae-11.txt $SERVER/small.txt +expect_equal $FILES/small.txt tmp/ae-11.txt + +echo "Test: A-E: 'bar'" +$CURL -H 'Accept-encoding: bar' -o tmp/ae-12.txt $SERVER/small.html +expect_equal $FILES/small.html tmp/ae-12.txt + +echo "Test: A-E: 'b'" +$CURL -H 'Accept-encoding: b' -o tmp/ae-13.txt $SERVER/small.html +expect_equal $FILES/small.html tmp/ae-13.txt + +echo $HR +echo "Stopping default NGINX" +# Stop server. +$NGINX -c $ROOT/script/test.conf -s stop + +################################################################################ + +# Start default server. +echo "Statring h2 NGINX" +$NGINX -c $ROOT/script/test_h2.conf + +CURL="curl --http2-prior-knowledge -s" + +# Run tests. +echo $HR + +echo "Test: long file with rate limit" +$CURL -H 'Accept-encoding: br' -o tmp/h2-war-and-peace.br --limit-rate 300K $SERVER/war-and-peace.txt +expect_br_equal $FILES/war-and-peace.txt tmp/h2-war-and-peace + +echo "Test: A-E: 'gzip, br'" +$CURL -H 'Accept-encoding: gzip, br' -o tmp/h2-ae-01.br $SERVER/small.txt +expect_br_equal $FILES/small.txt tmp/h2-ae-01 + +echo "Test: A-E: 'b'" +$CURL -H 'Accept-encoding: b' -o tmp/h2-ae-13.txt $SERVER/small.html +expect_equal $FILES/small.html tmp/h2-ae-13.txt + +echo $HR +echo "Stopping h2 NGINX" +# Stop server. +$NGINX -c $ROOT/script/test_h2.conf -s stop + +################################################################################ + +# Report. + +FAILED=$(get_failed $STATUS) +COUNT=$(get_count $STATUS) +echo $HR +echo "Results: $FAILED of $COUNT tests failed" + +# Restore status-quo. +cd $ROOT + +exit $FAILED diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test.conf b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test.conf new file mode 100644 index 0000000..93957f9 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test.conf @@ -0,0 +1,32 @@ +events { + worker_connections 4; +} + +daemon on; +error_log /dev/stdout info; + +http { + access_log ./access.log; + error_log ./error.log; + + gzip on; + gzip_comp_level 1; + gzip_types text/plain text/css; + + brotli on; + brotli_comp_level 1; + brotli_types text/plain text/css; + + server { + listen 8080 default_server; + listen [::]:8080 default_server; + + root ./; + + index index.html; + + location / { + try_files $uri $uri/ =404; + } + } +} diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test_h2.conf b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test_h2.conf new file mode 100644 index 0000000..0f2c791 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/script/test_h2.conf @@ -0,0 +1,32 @@ +events { + worker_connections 4; +} + +daemon on; +error_log /dev/stdout info; + +http { + access_log ./access.log; + error_log ./error.log; + + gzip on; + gzip_comp_level 1; + gzip_types text/plain text/css; + + brotli on; + brotli_comp_level 1; + brotli_types text/plain text/css; + + server { + listen 8080 http2; + listen [::]:8080 http2; + + root ./; + + index index.html; + + location / { + try_files $uri $uri/ =404; + } + } +} diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/config b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/config new file mode 100644 index 0000000..de07d1c --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/config @@ -0,0 +1,54 @@ +# Copyright (C) 2015-2019 Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. + +if [ "$ngx_addon_name" = "ngx_brotli" ]; then + BROTLI_MODULE_SRC_DIR="$ngx_addon_dir/static" +else + BROTLI_MODULE_SRC_DIR="$ngx_addon_dir" +fi + +ngx_addon_name=ngx_brotli_static + +if [ -z "$ngx_module_link" ]; then +cat << END + +$0: error: Brotli module requires recent version of NGINX (1.9.11+). + +END + exit 1 +fi + +ngx_module_type=HTTP +ngx_module_name=ngx_http_brotli_static_module +ngx_module_incs= +ngx_module_deps= +ngx_module_srcs="$BROTLI_MODULE_SRC_DIR/ngx_http_brotli_static_module.c" +ngx_module_libs= +ngx_module_order= + +. auto/module + +have=NGX_HTTP_GZIP . auto/have +have=NGX_HTTP_BROTLI_STATIC . auto/have +have=NGX_HTTP_BROTLI_STATIC_MODULE . auto/have # deprecated diff --git a/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/ngx_http_brotli_static_module.c b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/ngx_http_brotli_static_module.c new file mode 100644 index 0000000..44f0cb0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-brotli-1.0.0~rc/static/ngx_http_brotli_static_module.c @@ -0,0 +1,323 @@ + +/* + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + * Copyright (C) Google Inc. + */ + +#include +#include +#include + +/* >> Configuration */ + +#define NGX_HTTP_BROTLI_STATIC_OFF 0 +#define NGX_HTTP_BROTLI_STATIC_ON 1 +#define NGX_HTTP_BROTLI_STATIC_ALWAYS 2 + +typedef struct { + ngx_uint_t enable; +} configuration_t; + +static ngx_conf_enum_t kBrotliStaticEnum[] = { + {ngx_string("off"), NGX_HTTP_BROTLI_STATIC_OFF}, + {ngx_string("on"), NGX_HTTP_BROTLI_STATIC_ON}, + {ngx_string("always"), NGX_HTTP_BROTLI_STATIC_ALWAYS}, + {ngx_null_string, 0}}; + +/* << Configuration */ + +/* >> Forward declarations */ + +static ngx_int_t handler(ngx_http_request_t* req); +static void* create_conf(ngx_conf_t* root_cfg); +static char* merge_conf(ngx_conf_t* root_cfg, void* parent, void* child); +static ngx_int_t init(ngx_conf_t* root_cfg); + +/* << Forward declarations*/ + +/* >> Module definition */ + +static ngx_command_t kCommands[] = { + {ngx_string("brotli_static"), + NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF | NGX_HTTP_LOC_CONF | + NGX_CONF_TAKE1, + ngx_conf_set_enum_slot, NGX_HTTP_LOC_CONF_OFFSET, + offsetof(configuration_t, enable), &kBrotliStaticEnum}, + ngx_null_command}; + +static ngx_http_module_t kModuleContext = { + NULL, /* preconfiguration */ + init, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + create_conf, /* create location configuration */ + merge_conf /* merge location configuration */ +}; + +ngx_module_t ngx_http_brotli_static_module = { + NGX_MODULE_V1, + &kModuleContext, /* module context */ + kCommands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING}; + +/* << Module definition*/ + +static const u_char kContentEncoding[] = "Content-Encoding"; +static /* const */ char kEncoding[] = "br"; +static const size_t kEncodingLen = 2; +static /* const */ u_char kSuffix[] = ".br"; +static const size_t kSuffixLen = 3; + +static ngx_int_t check_accept_encoding(ngx_http_request_t* req) { + ngx_table_elt_t* accept_encoding_entry; + ngx_str_t* accept_encoding; + u_char* cursor; + u_char* end; + u_char before; + u_char after; + + accept_encoding_entry = req->headers_in.accept_encoding; + if (accept_encoding_entry == NULL) return NGX_DECLINED; + accept_encoding = &accept_encoding_entry->value; + + cursor = accept_encoding->data; + end = cursor + accept_encoding->len; + while (1) { + u_char digit; + /* It would be an idiotic idea to rely on compiler to produce performant + binary, that is why we just do -1 at every call site. */ + cursor = ngx_strcasestrn(cursor, kEncoding, kEncodingLen - 1); + if (cursor == NULL) return NGX_DECLINED; + before = (cursor == accept_encoding->data) ? ' ' : cursor[-1]; + cursor += kEncodingLen; + after = (cursor >= end) ? ' ' : *cursor; + if (before != ',' && before != ' ') continue; + if (after != ',' && after != ' ' && after != ';') continue; + + /* Check for ";q=0[.[0[0[0]]]]" */ + while (*cursor == ' ') cursor++; + if (*(cursor++) != ';') break; + while (*cursor == ' ') cursor++; + if (*(cursor++) != 'q') break; + while (*cursor == ' ') cursor++; + if (*(cursor++) != '=') break; + while (*cursor == ' ') cursor++; + if (*(cursor++) != '0') break; + if (*(cursor++) != '.') return NGX_DECLINED; /* ;q=0, */ + digit = *(cursor++); + if (digit < '0' || digit > '9') return NGX_DECLINED; /* ;q=0., */ + if (digit > '0') break; + digit = *(cursor++); + if (digit < '0' || digit > '9') return NGX_DECLINED; /* ;q=0.0, */ + if (digit > '0') break; + digit = *(cursor++); + if (digit < '0' || digit > '9') return NGX_DECLINED; /* ;q=0.00, */ + if (digit > '0') break; + return NGX_DECLINED; /* ;q=0.000 */ + } + return NGX_OK; +} + +/* Test if this request is allowed to have the brotli response. */ +static ngx_int_t check_eligility(ngx_http_request_t* req) { + if (req != req->main) return NGX_DECLINED; + if (check_accept_encoding(req) != NGX_OK) return NGX_DECLINED; + req->gzip_tested = 1; + req->gzip_ok = 0; + return NGX_OK; +} + +static ngx_int_t handler(ngx_http_request_t* req) { + configuration_t* cfg; + ngx_int_t rc; + u_char* last; + ngx_str_t path; + size_t root; + ngx_log_t* log; + ngx_http_core_loc_conf_t* location_cfg; + ngx_open_file_info_t file_info; + ngx_table_elt_t* content_encoding_entry; + ngx_buf_t* buf; + ngx_chain_t out; + + /* Only GET and HEAD requensts are supported. */ + if (!(req->method & (NGX_HTTP_GET | NGX_HTTP_HEAD))) return NGX_DECLINED; + + /* Only files are supported. */ + if (req->uri.data[req->uri.len - 1] == '/') return NGX_DECLINED; + + /* Get configuration and check if module is disabled. */ + cfg = ngx_http_get_module_loc_conf(req, ngx_http_brotli_static_module); + if (cfg->enable == NGX_HTTP_BROTLI_STATIC_OFF) return NGX_DECLINED; + + if (cfg->enable == NGX_HTTP_BROTLI_STATIC_ALWAYS) { + /* Ignore request properties (e.g. Accept-Encoding). */ + } else { + /* NGX_HTTP_BROTLI_STATIC_ON */ + rc = check_eligility(req); + if (rc != NGX_OK) return NGX_DECLINED; + } + + /* Get path and append the suffix. */ + last = ngx_http_map_uri_to_path(req, &path, &root, kSuffixLen); + if (last == NULL) return NGX_HTTP_INTERNAL_SERVER_ERROR; + /* +1 for reinstating the terminating 0. */ + ngx_cpystrn(last, kSuffix, kSuffixLen + 1); + path.len += kSuffixLen; + + log = req->connection->log; + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http filename: \"%s\"", + path.data); + + /* Prepare to read the file. */ + location_cfg = ngx_http_get_module_loc_conf(req, ngx_http_core_module); + ngx_memzero(&file_info, sizeof(ngx_open_file_info_t)); + file_info.read_ahead = location_cfg->read_ahead; + file_info.directio = location_cfg->directio; + file_info.valid = location_cfg->open_file_cache_valid; + file_info.min_uses = location_cfg->open_file_cache_min_uses; + file_info.errors = location_cfg->open_file_cache_errors; + file_info.events = location_cfg->open_file_cache_events; + rc = ngx_http_set_disable_symlinks(req, location_cfg, &path, &file_info); + if (rc != NGX_OK) return NGX_HTTP_INTERNAL_SERVER_ERROR; + + /* Try to fetch file and process errors. */ + rc = ngx_open_cached_file(location_cfg->open_file_cache, &path, &file_info, + req->pool); + if (rc != NGX_OK) { + ngx_uint_t level; + switch (file_info.err) { + case 0: + return NGX_HTTP_INTERNAL_SERVER_ERROR; + + case NGX_ENOENT: + case NGX_ENOTDIR: + case NGX_ENAMETOOLONG: + return NGX_DECLINED; + +#if (NGX_HAVE_OPENAT) + case NGX_EMLINK: + case NGX_ELOOP: +#endif + case NGX_EACCES: + level = NGX_LOG_ERR; + break; + + default: + level = NGX_LOG_CRIT; + break; + } + ngx_log_error(level, log, file_info.err, "%s \"%s\" failed", + file_info.failed, path.data); + return NGX_DECLINED; + } + + if (cfg->enable == NGX_HTTP_BROTLI_STATIC_ON) { + req->gzip_vary = 1; + } + + /* So far so good. */ + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, log, 0, "http static fd: %d", + file_info.fd); + + /* Only files are supported. */ + if (file_info.is_dir) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, log, 0, "http dir"); + return NGX_DECLINED; + } +#if !(NGX_WIN32) + if (!file_info.is_file) { + ngx_log_error(NGX_LOG_CRIT, log, 0, "\"%s\" is not a regular file", + path.data); + return NGX_HTTP_NOT_FOUND; + } +#endif + + /* Prepare request push the body. */ + req->root_tested = !req->error_page; + rc = ngx_http_discard_request_body(req); + if (rc != NGX_OK) return rc; + log->action = "sending response to client"; + req->headers_out.status = NGX_HTTP_OK; + req->headers_out.content_length_n = file_info.size; + req->headers_out.last_modified_time = file_info.mtime; + rc = ngx_http_set_etag(req); + if (rc != NGX_OK) return NGX_HTTP_INTERNAL_SERVER_ERROR; + rc = ngx_http_set_content_type(req); + if (rc != NGX_OK) return NGX_HTTP_INTERNAL_SERVER_ERROR; + + /* Set "Content-Encoding" header. */ + content_encoding_entry = ngx_list_push(&req->headers_out.headers); + if (content_encoding_entry == NULL) return NGX_HTTP_INTERNAL_SERVER_ERROR; + content_encoding_entry->hash = 1; + ngx_str_set(&content_encoding_entry->key, kContentEncoding); + ngx_str_set(&content_encoding_entry->value, kEncoding); + req->headers_out.content_encoding = content_encoding_entry; + + /* Setup response body. */ + buf = ngx_pcalloc(req->pool, sizeof(ngx_buf_t)); + if (buf == NULL) return NGX_HTTP_INTERNAL_SERVER_ERROR; + buf->file = ngx_pcalloc(req->pool, sizeof(ngx_file_t)); + if (buf->file == NULL) return NGX_HTTP_INTERNAL_SERVER_ERROR; + buf->file_pos = 0; + buf->file_last = file_info.size; + buf->in_file = buf->file_last ? 1 : 0; + buf->last_buf = (req == req->main) ? 1 : 0; + buf->last_in_chain = 1; + buf->file->fd = file_info.fd; + buf->file->name = path; + buf->file->log = log; + buf->file->directio = file_info.is_directio; + out.buf = buf; + out.next = NULL; + + /* Push the response header. */ + rc = ngx_http_send_header(req); + if (rc == NGX_ERROR || rc > NGX_OK || req->header_only) { + return rc; + } + + /* Push the response body. */ + return ngx_http_output_filter(req, &out); +} + +static void* create_conf(ngx_conf_t* root_cfg) { + configuration_t* cfg; + cfg = ngx_palloc(root_cfg->pool, sizeof(configuration_t)); + if (cfg == NULL) return NULL; + cfg->enable = NGX_CONF_UNSET_UINT; + return cfg; +} + +static char* merge_conf(ngx_conf_t* root_cfg, void* parent, void* child) { + configuration_t* prev = parent; + configuration_t* cfg = child; + ngx_conf_merge_uint_value(cfg->enable, prev->enable, + NGX_HTTP_BROTLI_STATIC_OFF); + return NGX_CONF_OK; +} + +static ngx_int_t init(ngx_conf_t* root_cfg) { + ngx_http_core_main_conf_t* core_cfg; + ngx_http_handler_pt* handler_slot; + core_cfg = ngx_http_conf_get_module_main_conf(root_cfg, ngx_http_core_module); + handler_slot = + ngx_array_push(&core_cfg->phases[NGX_HTTP_CONTENT_PHASE].handlers); + if (handler_slot == NULL) return NGX_ERROR; + *handler_slot = handler; + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.astylerc b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.astylerc new file mode 100644 index 0000000..3c009b3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.astylerc @@ -0,0 +1,22 @@ +# astylerc +align-pointer=name +align-reference=name +break-after-logical +#indent=spaces=2 +max-code-length=120 +style=google +suffix=none + +# Indent +indent-preproc-block + +# Padding +pad-header +unpad-paren + +# Formatting: +add-brackets +#convert-tabs + +# Output: +formatted \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.format.sh b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.format.sh new file mode 100755 index 0000000..75209eb --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.format.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Search in the script folder +pushd "$(dirname $0)" >/dev/null +CWD="$(pwd -P)" +popd >/dev/null +FILES='ngx_cache_purge_module.c' + +# The file format in accordance with the style defined in .astylerc +astyle -v --options='.astylerc' ${FILES} || (echo 'astyle failed'; exit 1); + +# To correct this, the issuance dos2unix on each file +# sometimes adds in Windows as a string-endins (\r\n). +dos2unix --quiet ${FILES} || (echo 'dos2unix failed'; exit 2); \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.gitattributes b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.gitattributes new file mode 100644 index 0000000..9b27d9f --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.gitattributes @@ -0,0 +1 @@ +*.t linguist-language=Text \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.travis.yml b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.travis.yml new file mode 100644 index 0000000..3714921 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/.travis.yml @@ -0,0 +1,49 @@ +sudo: required +os: linux +dist: trusty +language: c +compiler: + - gcc + - clang +cache: + apt: true + directories: + - download-cache +env: + global: + - JOBS=4 + - NGINX_PREFIX=/opt/nginx + matrix: + - NGINX_VERSION=1.18.0 + - NGINX_VERSION=1.19.2 + +before_install: + - mkdir --parents download-cache + - sudo apt-get update -qq + - sudo apt-get install -qq zlib1g-dev libpcre3-dev cpanminus + # Get OpenSSL 1.0.2 from Ubuntu Xenial + # https://packages.ubuntu.com/xenial-updates/libssl1.0.0 + - test -f download-cache/libssl1.0.0_1.0.2g-1ubuntu4.16_amd64.deb || wget -O download-cache/libssl1.0.0_1.0.2g-1ubuntu4.17_amd64.deb "http://de.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.0.0_1.0.2g-1ubuntu4.17_amd64.deb" + # https://packages.ubuntu.com/xenial/libssl-dev + - test -f download-cache/libssl-dev_1.0.2g-1ubuntu4.16_amd64.deb || wget -O download-cache/libssl-dev_1.0.2g-1ubuntu4.17_amd64.deb "http://de.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.0.2g-1ubuntu4.17_amd64.deb" + - sudo dpkg -i download-cache/libssl*_amd64.deb + # Test::Nginx + - git clone https://github.com/openresty/test-nginx.git test-nginx + - cd test-nginx/ && sudo cpanm . && cd .. + # NGINX source + - test -f download-cache/nginx-$NGINX_VERSION.tar.gz || wget -O download-cache/nginx-$NGINX_VERSION.tar.gz http://nginx.org/download/nginx-$NGINX_VERSION.tar.gz + +install: + - tar -xzf download-cache/nginx-${NGINX_VERSION}.tar.gz + - cd nginx-${NGINX_VERSION}/ + - ./configure --prefix=${NGINX_PREFIX} --with-debug --with-http_ssl_module --add-module=${PWD}/.. + - make -j${JOBS} + - sudo make install + - cd .. + - export PATH="${NGINX_PREFIX}/sbin:$PATH" +# - export LD_LIBRARY_PATH=${LD_LIBRARY_PATH} + +script: + - nginx -V + - ldd $(which nginx) + - prove t diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/CHANGES b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/CHANGES new file mode 100644 index 0000000..7495742 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/CHANGES @@ -0,0 +1,103 @@ +2020-06-27 VERSION 2.5.1 + * fix: empty key check - it coredumps when cache key is empty, Tuğrul Topuz + * fix: purge report calloc fix - Report template has not cache file path but it's length is use in buffer memory allocation, Tuğrul Topuz + +2018-08-04 VERSION 2.5 + * feat/docs: cache_purge_response_type directive, selecting response type (html|json|xml|text) + * break: changed status of HTTP code 404 (Not Found) to 412 (Precondition Failed) + * fix: remove path information of response body (#4, 3a8c08a, #11) + +2020-06-27 VERSION 2.4.3 + * fix: empty key check - it coredumps when cache key is empty, Tuğrul Topuz + +2017-09-28 VERSION 2.4.2 + * fix: segfault in call to `ngx_read_file` of partial key purge, Frankie Dintino + * fix: segfault in `cplcf->conf->purge_all` with separate location syntax, Frankie Dintino + +2017-02-21 VERSION 2.4.1 + * Fix compatibility with nginx-1.11.6+, Sułowicz Paweł + +2016-11-20 VERSION 2.4 + * Fix compatibility with nginx-1.7.12+. + * explain the purge logic + * feat(purge all): Include option to purge all the cached files + This option can be slow if a lot of content is cached, or if the + storage used for the cache is slow. But you really should be using + RAM as your cache storage. + * feat(partial keys): Support partial keys to purge multiple keys. + Put an '*' at the end of your purge cache URL. + e.g: + proxy_cache_key $scheme$host$uri$is_args$args$cookie_JSESSIONID; + curl -X PURGE https://example.com/pass* + This will remove every cached page whose key cache starting with: + httpsexample.com/pass* + Be careful not passing any value for the values after the $uri, or put + it at the end of your cache key. + * Convert a config file to build a dynamic module + +2014-12-23 VERSION 2.3 + * Fix compatibility with nginx-1.7.9+. + +2014-12-02 VERSION 2.2 + * Fix compatibility with nginx-1.7.8+. + +2014-05-19 + * Fix build on Solaris with SunCC (Solaris Studio). + Reported by Jussi Sallinen. + +2013-03-19 VERSION 2.1 + * When enabled, cache purge will now catch all requests with + PURGE (or specified) method, even if cache isn't configured. + Previously, it would pass such requests to the upstream. + +2012-12-07 VERSION 2.0 + * Add alternative "same location" syntax. + From CloudFlare. + +2012-07-02 VERSION 1.6 + * Fix compatibility with nginx-1.3.2+. + Reported by MagicBear, patch from Ruslan Ermilov. + +2011-12-20 VERSION 1.5 + * Fix on-disk cache size calculation. + Since the initial release, recorded on-disk cache size was + decreased twice for purged content (once during cache purge + and once during subsequent cache update). + This resulted in recorded on-disk cache size being much + smaller than in reality, which could lead to on-disk cache + outgrowing defined "max_size" parameter. + Patch from Pyry Hakulinen. + +2011-10-05 VERSION 1.4 + * Add AIO support. + Requested by Emin Hasanov. + +2011-05-03 VERSION 1.3 + * Fix compatibility with nginx-1.0.1. + Reported by Sergey A. Osokin and Markus Linnala. + +2010-08-29 + * Fix compatibility with nginx-0.8.0 and versions older than + nginx-0.7.60. + +2010-08-11 VERSION 1.2 + * Fix various build scenarios with disabled upstream modules. + Reported by Johan Bergstroem. + + * Add ability to purge content from SCGI's cache. + Requested by Johan Bergstroem. + +2010-06-08 VERSION 1.1 + * Fix compatibility with nginx-0.8.40+. + + * Add ability to purge content from uWSGI's cache. + +2010-01-10 VERSION 1.0 + * Initial module release. + +2009-11-17 + * Fix patch compatibility with nginx-0.8.11+. + Reported by Bing Ran. + +2009-08-11 + * Initial patch release. diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE new file mode 100644 index 0000000..0047538 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/LICENSE @@ -0,0 +1,26 @@ +Copyright (c) 2009-2014, FRiCKLE +Copyright (c) 2009-2014, Piotr Sikora +All rights reserved. + +This project was fully funded by yo.se. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/README.md b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/README.md new file mode 100644 index 0000000..e3d92b4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/README.md @@ -0,0 +1,283 @@ +About +===== +`ngx_cache_purge` is `nginx` module which adds ability to purge content from +`FastCGI`, `proxy`, `SCGI` and `uWSGI` caches. A purge operation removes the +content with the same cache key as the purge request has. + + +Sponsors +======== +Work on the original patch was fully funded by [yo.se](http://yo.se). + + +Status +====== +This module is production-ready. + + +Configuration directives (same location syntax) +=============================================== +fastcgi_cache_purge +------------------- +* **syntax**: `fastcgi_cache_purge on|off| [purge_all] [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `FastCGI`'s cache. + + +proxy_cache_purge +----------------- +* **syntax**: `proxy_cache_purge on|off| [purge_all] [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `proxy`'s cache. + + +scgi_cache_purge +---------------- +* **syntax**: `scgi_cache_purge on|off| [purge_all] [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `SCGI`'s cache. + + +uwsgi_cache_purge +----------------- +* **syntax**: `uwsgi_cache_purge on|off| [purge_all] [from all| [.. ]]` +* **default**: `none` +* **context**: `http`, `server`, `location` + +Allow purging of selected pages from `uWSGI`'s cache. + + +Configuration directives (separate location syntax) +=================================================== +fastcgi_cache_purge +------------------- +* **syntax**: `fastcgi_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `FastCGI`'s cache. + + +proxy_cache_purge +----------------- +* **syntax**: `proxy_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `proxy`'s cache. + + +scgi_cache_purge +---------------- +* **syntax**: `scgi_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `SCGI`'s cache. + + +uwsgi_cache_purge +----------------- +* **syntax**: `uwsgi_cache_purge zone_name key` +* **default**: `none` +* **context**: `location` + +Sets area and key used for purging selected pages from `uWSGI`'s cache. + +Configuration directives (Optional) +=================================================== + +cache_purge_response_type +----------------- +* **syntax**: `cache_purge_response_type html|json|xml|text` +* **default**: `html` +* **context**: `http`, `server`, `location` + +Sets a response type of purging result. + + + +Partial Keys +============ +Sometimes it's not possible to pass the exact key cache to purge a page. For example; when the content of a cookie or the params are part of the key. +You can specify a partial key adding an asterisk at the end of the URL. + + curl -X PURGE /page* + +The asterisk must be the last character of the key, so you **must** put the $uri variable at the end. + + + +Sample configuration (same location syntax) +=========================================== + 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"; + proxy_cache_purge PURGE from 127.0.0.1; + } + } + } + + +Sample configuration (same location syntax - purge all cached files) +==================================================================== + 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"; + proxy_cache_purge PURGE purge_all from 127.0.0.1 192.168.0.0/8; + } + } + } + + +Sample configuration (separate location syntax) +=============================================== + 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"; + } + + location ~ /purge(/.*) { + allow 127.0.0.1; + deny all; + proxy_cache tmpcache; + proxy_cache_key "$1$is_args$args"; + } + } + } + +Sample configuration (Optional) +=============================================== + http { + proxy_cache_path /tmp/cache keys_zone=tmpcache:10m; + + cache_purge_response_type text; + + server { + + cache_purge_response_type json; + + location / { #json + proxy_pass http://127.0.0.1:8000; + proxy_cache tmpcache; + proxy_cache_key "$uri$is_args$args"; + } + + location ~ /purge(/.*) { #xml + allow 127.0.0.1; + deny all; + proxy_cache tmpcache; + proxy_cache_key "$1$is_args$args"; + cache_purge_response_type xml; + } + + location ~ /purge2(/.*) { # json + allow 127.0.0.1; + deny all; + proxy_cache tmpcache; + proxy_cache_key "$1$is_args$args"; + } + } + + server { + + location / { #text + proxy_pass http://127.0.0.1:8000; + proxy_cache tmpcache; + proxy_cache_key "$uri$is_args$args"; + } + + location ~ /purge(/.*) { #text + allow 127.0.0.1; + deny all; + proxy_cache tmpcache; + proxy_cache_key "$1$is_args$args"; + } + + location ~ /purge2(/.*) { #html + allow 127.0.0.1; + deny all; + proxy_cache tmpcache; + proxy_cache_key "$1$is_args$args"; + cache_purge_response_type html; + } + } + } + + + +Solve problems +============== +* Enabling [`gzip_vary`](https://nginx.org/r/gzip_vary) can lead to different results when clearing, when enabling it, you may have problems clearing the cache. For reliable operation, you can disable [`gzip_vary`](https://nginx.org/r/gzip_vary) inside the location [#20](https://github.com/nginx-modules/ngx_cache_purge/issues/20). + + +Testing +======= +`ngx_cache_purge` comes with complete test suite based on [Test::Nginx](http://github.com/agentzh/test-nginx). + +You can test it by running: + +`$ prove` + + +License +======= + Copyright (c) 2009-2014, FRiCKLE + Copyright (c) 2009-2014, Piotr Sikora + All rights reserved. + + This project was fully funded by yo.se. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +See also +======== +- [ngx_slowfs_cache](http://github.com/FRiCKLE/ngx_slowfs_cache). +- http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#purger +- http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_cache_purge +- https://github.com/wandenberg/nginx-selective-cache-purge-module +- https://github.com/wandenberg/nginx-sorted-querystring-module +- https://github.com/ledgetech/ledge +- [Faking Surrogate Cache-Keys for Nginx Plus](https://www.innoq.com/en/blog/faking-surrogate-cache-keys-for-nginx-plus/) ([gist](https://gist.github.com/titpetric/2f142e89eaa0f36ba4e4383b16d61474)) +- [Delete NGINX cached md5 items with a PURGE with wildcard support](https://gist.github.com/nosun/0cfb58d3164f829e2f027fd37b338ede) diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/config b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/config new file mode 100644 index 0000000..b900680 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/config @@ -0,0 +1,31 @@ +if [ "$HTTP_PROXY" = "YES" ]; then + have=NGX_HTTP_PROXY . auto/have +fi + +if [ "$HTTP_FASTCGI" = "YES" ]; then + have=NGX_HTTP_FASTCGI . auto/have +fi + +if [ "$HTTP_SCGI" = "YES" ]; then + have=NGX_HTTP_SCGI . auto/have +fi + +if [ "$HTTP_UWSGI" = "YES" ]; then + have=NGX_HTTP_UWSGI . auto/have +fi + +ngx_addon_name=ngx_http_cache_purge_module +CACHE_PURGE_SRCS="$ngx_addon_dir/ngx_cache_purge_module.c" + +if [ -n "$ngx_module_link" ]; then + ngx_module_type=HTTP + ngx_module_name="$ngx_addon_name" + ngx_module_srcs="$CACHE_PURGE_SRCS" + + . auto/module +else + HTTP_MODULES="$HTTP_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $CACHE_PURGE_SRCS" +fi + +have=NGX_CACHE_PURGE_MODULE . auto/have diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/changelog b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/changelog new file mode 100644 index 0000000..9e03744 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/changelog @@ -0,0 +1,74 @@ +libnginx-mod-http-cache-purge (1:2.5.3-3) unstable; urgency=medium + + * d/control: update my email to janmojzis@debian.org + * d/copyright: update my email to janmojzis@debian.org + * d/control: bump Standards-Version: 4.7.2, no changes + * d/copyright: bump debian/* copyright year + * d/watch: use more generic template + + -- Jan Mojžíš Fri, 11 Apr 2025 14:26:56 +0200 + +libnginx-mod-http-cache-purge (1:2.5.3-2) unstable; urgency=medium + + * d/changelog fix closed bug number 1019003 -> 1055742 (Closes: 1055742) + + -- Jan Mojžíš Fri, 21 Jun 2024 19:34:05 +0200 + +libnginx-mod-http-cache-purge (1:2.5.3-1) unstable; urgency=medium + + * switch to a new upstream + https://github.com/nginx-modules/ngx_cache_purge + (Closes: 1072836) (Closes: 1055742) + * d/p/dynamic-module.patch remove, fixed in upstream + * d/p/segfault-1.11.6.patch remove, fixed in upstream + * d/t/purgetest added + * d/copyright: bump my copyright year + * d/gbp.conf: add [pull] track-missing = True + * d/control: bump Standards-Version: 4.7.0, no changes + + -- Jan Mojžíš Fri, 21 Jun 2024 13:36:53 +0200 + +libnginx-mod-http-cache-purge (1:2.3-6) unstable; urgency=medium + + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + + -- Jan Mojžíš Sat, 07 Oct 2023 15:31:25 +0200 + +libnginx-mod-http-cache-purge (1:2.3-5) unstable; urgency=medium + + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Tue, 27 Jun 2023 23:16:35 +0200 + +libnginx-mod-http-cache-purge (1:2.3-4) unstable; urgency=medium + + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/gbb.conf: switched to debian branch main (debian-branch = main) + * d/copyright: bump my copyright year + * d/copyright: reformat text to be compatible with 'cme update dpkg-copyright' + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 12:56:14 +0100 + +libnginx-mod-http-cache-purge (1:2.3-3) unstable; urgency=medium + + * d/copyright: fixed typo (empty line ngx_cache_purge_module.c) + + -- Jan Mojžíš Fri, 09 Dec 2022 14:50:48 +0100 + +libnginx-mod-http-cache-purge (1:2.3-2) experimental; urgency=medium + + * d/control: added Multi-Arch: foreign + * d/copyright: add Igor Sysoev + Nginx, Inc. + + -- Jan Mojžíš Mon, 05 Dec 2022 21:15:13 +0100 + +libnginx-mod-http-cache-purge (1:2.3-1) experimental; urgency=medium + + * Initial release. (Closes: 1024213) + * Additional info: The separate package libnginx-mod-http-cache-purge ships + newest version of ngx_cache_purge (Closes: 911099) + + -- Jan Mojžíš Wed, 30 Nov 2022 14:46:45 +0100 diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/control b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/control new file mode 100644 index 0000000..3936731 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/control @@ -0,0 +1,23 @@ +Source: libnginx-mod-http-cache-purge +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jan Mojžíš , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, +Standards-Version: 4.7.2 +Homepage: https://github.com/FRiCKLE/ngx_cache_purge +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-cache-purge.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-cache-purge +Rules-Requires-Root: no + +Package: libnginx-mod-http-cache-purge +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: Purge content from Nginx caches + Cache Purge module adds purging capabilities to Nginx. It allows purging + content from caches used by all of Nginx proxy modules, like FastCGI, Proxy, + SCGI and uWSGI. diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/copyright b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/copyright new file mode 100644 index 0000000..a0ef36d --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/copyright @@ -0,0 +1,36 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ngx_cache_purge +Upstream-Contact: FRiCKLE +Source: https://github.com/FRiCKLE/ngx_cache_purge + +Files: * +Copyright: 2009-2014, Piotr Sikora + 2009-2014, FRiCKLE +License: BSD-2-clause + +Files: debian/* +Copyright: 2022, Miao Wang + 2022-2025, Jan Mojzis +License: BSD-2-clause + +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/gbp.conf b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/gbp.conf new file mode 100644 index 0000000..97cd209 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/gbp.conf @@ -0,0 +1,12 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = True +sign-tags = True + +[import-orig] +merge-mode = replace + +[pull] +track-missing = True diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/rules b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/rules new file mode 100755 index 0000000..d8309f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/source/format b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/control b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/control new file mode 100644 index 0000000..dd4e1a3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/control @@ -0,0 +1,13 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, + +Tests: purgetest +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/generic b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/purgetest b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/purgetest new file mode 100644 index 0000000..1574080 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/tests/purgetest @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +cat < "/etc/nginx/sites-enabled/default" +proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; +proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; + +server { + listen 127.0.0.1:80 default_server; + + location /proxy { + proxy_pass \$scheme://127.0.0.1:\$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key \$uri\$is_args\$args; + proxy_cache_valid 3m; + add_header X-Cache-Status \$upstream_cache_status; + } + + location ~ /purge(/.*) { + proxy_cache_purge test_cache \$1\$is_args\$args; + } + + location = /etc/passwd { + root /; + } +} +EOF + +nginx -t +invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; } + +curl --fail -s -o /dev/null -w "GET key: %{http_code}\n" http://127.0.0.1/proxy/passwd +curl --fail -s -o /dev/null -w "PURGE existing key: %{http_code}\n" -X PURGE http://127.0.0.1/purge/proxy/passwd +curl -s -o /dev/null -w "PURGE non-existing key: %{http_code}\n" -X PURGE http://127.0.0.1/purge/proxy/passwd diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/upstream/metadata b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/upstream/metadata new file mode 100644 index 0000000..ca2631c --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/FRiCKLE/ngx_cache_purge/issues +Bug-Submit: https://github.com/FRiCKLE/ngx_cache_purge/issues/new +Repository-Browse: https://github.com/FRiCKLE/ngx_cache_purge \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/watch b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/watch new file mode 100644 index 0000000..11bd9bf --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/nginx-modules/ngx_cache_purge/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/ngx_cache_purge_module.c b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/ngx_cache_purge_module.c new file mode 100644 index 0000000..251d3fe --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/ngx_cache_purge_module.c @@ -0,0 +1,2163 @@ +/* + * Copyright (c) 2009-2014, FRiCKLE + * Copyright (c) 2009-2014, Piotr Sikora + * All rights reserved. + * + * This project was fully funded by yo.se. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include + + +#ifndef nginx_version + #error This module cannot be build against an unknown nginx version. +#endif + +#define NGX_REPONSE_TYPE_HTML 1 +#define NGX_REPONSE_TYPE_XML 2 +#define NGX_REPONSE_TYPE_JSON 3 +#define NGX_REPONSE_TYPE_TEXT 4 + +static const char ngx_http_cache_purge_content_type_json[] = "application/json"; +static const char ngx_http_cache_purge_content_type_html[] = "text/html"; +static const char ngx_http_cache_purge_content_type_xml[] = "text/xml"; +static const char ngx_http_cache_purge_content_type_text[] = "text/plain"; + +static size_t ngx_http_cache_purge_content_type_json_size = sizeof(ngx_http_cache_purge_content_type_json); +static size_t ngx_http_cache_purge_content_type_html_size = sizeof(ngx_http_cache_purge_content_type_html); +static size_t ngx_http_cache_purge_content_type_xml_size = sizeof(ngx_http_cache_purge_content_type_xml); +static size_t ngx_http_cache_purge_content_type_text_size = sizeof(ngx_http_cache_purge_content_type_text); + +static const char ngx_http_cache_purge_body_templ_json[] = "{\"Key\": \"%s\"}"; +static const char ngx_http_cache_purge_body_templ_html[] = "Successful purge

Successful purge

Key : %s

"; +static const char ngx_http_cache_purge_body_templ_xml[] = ""; +static const char ngx_http_cache_purge_body_templ_text[] = "Key:%s\n"; + +static size_t ngx_http_cache_purge_body_templ_json_size = sizeof(ngx_http_cache_purge_body_templ_json); +static size_t ngx_http_cache_purge_body_templ_html_size = sizeof(ngx_http_cache_purge_body_templ_html); +static size_t ngx_http_cache_purge_body_templ_xml_size = sizeof(ngx_http_cache_purge_body_templ_xml); +static size_t ngx_http_cache_purge_body_templ_text_size = sizeof(ngx_http_cache_purge_body_templ_text); + +#if (NGX_HTTP_CACHE) + +typedef struct { + ngx_flag_t enable; + ngx_str_t method; + ngx_flag_t purge_all; + ngx_array_t *access; /* array of ngx_in_cidr_t */ + ngx_array_t *access6; /* array of ngx_in6_cidr_t */ +} ngx_http_cache_purge_conf_t; + +typedef struct { +# if (NGX_HTTP_FASTCGI) + ngx_http_cache_purge_conf_t fastcgi; +# endif /* NGX_HTTP_FASTCGI */ +# if (NGX_HTTP_PROXY) + ngx_http_cache_purge_conf_t proxy; +# endif /* NGX_HTTP_PROXY */ +# if (NGX_HTTP_SCGI) + ngx_http_cache_purge_conf_t scgi; +# endif /* NGX_HTTP_SCGI */ +# if (NGX_HTTP_UWSGI) + ngx_http_cache_purge_conf_t uwsgi; +# endif /* NGX_HTTP_UWSGI */ + + ngx_http_cache_purge_conf_t *conf; + ngx_http_handler_pt handler; + ngx_http_handler_pt original_handler; + + ngx_uint_t resptype; /* response content-type */ +} ngx_http_cache_purge_loc_conf_t; + +# if (NGX_HTTP_FASTCGI) +char *ngx_http_fastcgi_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) +char *ngx_http_proxy_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) +char *ngx_http_scgi_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_scgi_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) +char *ngx_http_uwsgi_cache_purge_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +ngx_int_t ngx_http_uwsgi_cache_purge_handler(ngx_http_request_t *r); +# endif /* NGX_HTTP_UWSGI */ + +char *ngx_http_cache_purge_response_type_conf(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static ngx_int_t +ngx_http_purge_file_cache_noop(ngx_tree_ctx_t *ctx, ngx_str_t *path); +static ngx_int_t +ngx_http_purge_file_cache_delete_file(ngx_tree_ctx_t *ctx, ngx_str_t *path); + +ngx_int_t ngx_http_cache_purge_access_handler(ngx_http_request_t *r); +ngx_int_t ngx_http_cache_purge_access(ngx_array_t *a, ngx_array_t *a6, + struct sockaddr *s); + +ngx_int_t ngx_http_cache_purge_send_response(ngx_http_request_t *r); +# if (nginx_version >= 1007009) +ngx_int_t ngx_http_cache_purge_cache_get(ngx_http_request_t *r, + ngx_http_upstream_t *u, ngx_http_file_cache_t **cache); +# endif /* nginx_version >= 1007009 */ +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); +void ngx_http_cache_purge_handler(ngx_http_request_t *r); + +ngx_int_t ngx_http_file_cache_purge(ngx_http_request_t *r); + + +void ngx_http_cache_purge_all(ngx_http_request_t *r, ngx_http_file_cache_t *cache); +void ngx_http_cache_purge_partial(ngx_http_request_t *r, ngx_http_file_cache_t *cache); +ngx_int_t ngx_http_cache_purge_is_partial(ngx_http_request_t *r); + +char *ngx_http_cache_purge_conf(ngx_conf_t *cf, + ngx_http_cache_purge_conf_t *cpcf); + +void *ngx_http_cache_purge_create_loc_conf(ngx_conf_t *cf); +char *ngx_http_cache_purge_merge_loc_conf(ngx_conf_t *cf, + void *parent, void *child); + +static ngx_command_t ngx_http_cache_purge_module_commands[] = { + +# if (NGX_HTTP_FASTCGI) + { + ngx_string("fastcgi_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_fastcgi_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL + }, +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) + { + ngx_string("proxy_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_proxy_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL + }, +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) + { + ngx_string("scgi_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_scgi_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL + }, +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) + { + ngx_string("uwsgi_cache_purge"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE, + ngx_http_uwsgi_cache_purge_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL + }, +# endif /* NGX_HTTP_UWSGI */ + + + { ngx_string("cache_purge_response_type"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, + ngx_http_cache_purge_response_type_conf, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL }, + + ngx_null_command +}; + +static ngx_http_module_t ngx_http_cache_purge_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server 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 = { + NGX_MODULE_V1, + &ngx_http_cache_purge_module_ctx, /* module context */ + ngx_http_cache_purge_module_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + +# if (NGX_HTTP_FASTCGI) +extern ngx_module_t ngx_http_fastcgi_module; + +# if (nginx_version >= 1007009) + +typedef struct { + ngx_array_t caches; /* ngx_http_file_cache_t * */ +} ngx_http_fastcgi_main_conf_t; + +# endif /* nginx_version >= 1007009 */ + +# if (nginx_version >= 1007008) + +typedef struct { + ngx_array_t *flushes; + ngx_array_t *lengths; + ngx_array_t *values; + ngx_uint_t number; + ngx_hash_t hash; +} ngx_http_fastcgi_params_t; + +# endif /* nginx_version >= 1007008 */ + +typedef struct { + ngx_http_upstream_conf_t upstream; + + ngx_str_t index; + +# if (nginx_version >= 1007008) + ngx_http_fastcgi_params_t params; + ngx_http_fastcgi_params_t params_cache; +# else + ngx_array_t *flushes; + ngx_array_t *params_len; + ngx_array_t *params; +# endif /* nginx_version >= 1007008 */ + + ngx_array_t *params_source; + ngx_array_t *catch_stderr; + + ngx_array_t *fastcgi_lengths; + ngx_array_t *fastcgi_values; + +# if (nginx_version >= 8040) && (nginx_version < 1007008) + ngx_hash_t headers_hash; + ngx_uint_t header_params; +# endif /* nginx_version >= 8040 && nginx_version < 1007008 */ + +# if (nginx_version >= 1001004) + ngx_flag_t keep_conn; +# endif /* nginx_version >= 1001004 */ + + ngx_http_complex_value_t cache_key; + +# if (NGX_PCRE) + ngx_regex_t *split_regex; + ngx_str_t split_name; +# endif /* NGX_PCRE */ +} ngx_http_fastcgi_loc_conf_t; + +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_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_fastcgi_loc_conf_t *flcf; + ngx_str_t *value; +# if (nginx_version >= 1007009) + ngx_http_complex_value_t cv; +# endif /* nginx_version >= 1007009 */ + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->fastcgi.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->fastcgi); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + flcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_fastcgi_module); + +# if (nginx_version >= 1007009) + if (flcf->upstream.cache > 0) +# else + if (flcf->upstream.cache != NGX_CONF_UNSET_PTR + && flcf->upstream.cache != NULL) +# endif /* nginx_version >= 1007009 */ + { + return "is incompatible with \"fastcgi_cache\""; + } + + if (flcf->upstream.upstream || flcf->fastcgi_lengths) { + return "is incompatible with \"fastcgi_pass\""; + } + + if (flcf->upstream.store > 0 +# if (nginx_version < 1007009) + || flcf->upstream.store_lengths +# endif /* nginx_version >= 1007009 */ + ) { + return "is incompatible with \"fastcgi_store\""; + } + + value = cf->args->elts; + + /* set fastcgi_cache part */ +# if (nginx_version >= 1007009) + + flcf->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) { + + flcf->upstream.cache_value = ngx_palloc(cf->pool, + sizeof(ngx_http_complex_value_t)); + if (flcf->upstream.cache_value == NULL) { + return NGX_CONF_ERROR; + } + + *flcf->upstream.cache_value = cv; + + } else { + + flcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_fastcgi_module); + if (flcf->upstream.cache_zone == NULL) { + return NGX_CONF_ERROR; + } + } + +# else + + flcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_fastcgi_module); + if (flcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + +# endif /* nginx_version >= 1007009 */ + + /* set fastcgi_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &flcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->fastcgi.enable = 0; + cplcf->conf = &cplcf->fastcgi; + clcf->handler = ngx_http_fastcgi_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_fastcgi_cache_purge_handler(ngx_http_request_t *r) { + ngx_http_file_cache_t *cache; + ngx_http_fastcgi_loc_conf_t *flcf; + ngx_http_cache_purge_loc_conf_t *cplcf; +# if (nginx_version >= 1007009) + ngx_http_fastcgi_main_conf_t *fmcf; + ngx_int_t rc; +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_upstream_create(r) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); + + r->upstream->conf = &flcf->upstream; + +# if (nginx_version >= 1007009) + + fmcf = ngx_http_get_module_main_conf(r, ngx_http_fastcgi_module); + + r->upstream->caches = &fmcf->caches; + + rc = ngx_http_cache_purge_cache_get(r, r->upstream, &cache); + if (rc != NGX_OK) { + return rc; + } + +# else + + cache = flcf->upstream.cache->data; + +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_cache_purge_init(r, cache, &flcf->cache_key) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* Purge-all option */ + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + if (cplcf->conf->purge_all) { + ngx_http_cache_purge_all(r, cache); + } else { + if (ngx_http_cache_purge_is_partial(r)) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache purge with partial enabled"); + + ngx_http_cache_purge_partial(r, cache); + } + } + +# if (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) +extern ngx_module_t ngx_http_proxy_module; + +typedef struct { + ngx_str_t key_start; + ngx_str_t schema; + ngx_str_t host_header; + ngx_str_t port; + ngx_str_t uri; +} ngx_http_proxy_vars_t; + +# if (nginx_version >= 1007009) + +typedef struct { + ngx_array_t caches; /* ngx_http_file_cache_t * */ +} ngx_http_proxy_main_conf_t; + +# endif /* nginx_version >= 1007009 */ + +# if (nginx_version >= 1007008) + +typedef struct { + ngx_array_t *flushes; + ngx_array_t *lengths; + ngx_array_t *values; + ngx_hash_t hash; +} ngx_http_proxy_headers_t; + +# endif /* nginx_version >= 1007008 */ + +typedef struct { + ngx_http_upstream_conf_t upstream; + +# if (nginx_version >= 1007008) + ngx_array_t *body_flushes; + ngx_array_t *body_lengths; + ngx_array_t *body_values; + ngx_str_t body_source; + + ngx_http_proxy_headers_t headers; + ngx_http_proxy_headers_t headers_cache; +# else + ngx_array_t *flushes; + ngx_array_t *body_set_len; + ngx_array_t *body_set; + ngx_array_t *headers_set_len; + ngx_array_t *headers_set; + ngx_hash_t headers_set_hash; +# endif /* nginx_version >= 1007008 */ + + ngx_array_t *headers_source; +# if (nginx_version < 8040) + ngx_array_t *headers_names; +# endif /* nginx_version < 8040 */ + + ngx_array_t *proxy_lengths; + ngx_array_t *proxy_values; + + ngx_array_t *redirects; +# if (nginx_version >= 1001015) + ngx_array_t *cookie_domains; + ngx_array_t *cookie_paths; +# endif /* nginx_version >= 1001015 */ +# if (nginx_version >= 1019003) + ngx_array_t *cookie_flags; +# endif /* nginx_version >= 1019003 */ +# if (nginx_version < 1007008) + ngx_str_t body_source; +# endif /* nginx_version < 1007008 */ + +# if (nginx_version >= 1011006) + ngx_http_complex_value_t *method; +# else + ngx_str_t method; +# endif /* nginx_version >= 1011006 */ + ngx_str_t location; + ngx_str_t url; + + ngx_http_complex_value_t cache_key; + + ngx_http_proxy_vars_t vars; + + ngx_flag_t redirect; + +# if (nginx_version >= 1001004) + ngx_uint_t http_version; +# endif /* nginx_version >= 1001004 */ + + ngx_uint_t headers_hash_max_size; + ngx_uint_t headers_hash_bucket_size; + +# if (NGX_HTTP_SSL) +# if (nginx_version >= 1005006) + ngx_uint_t ssl; + ngx_uint_t ssl_protocols; + ngx_str_t ssl_ciphers; +# endif /* nginx_version >= 1005006 */ +# if (nginx_version >= 1007000) + ngx_uint_t ssl_verify_depth; + ngx_str_t ssl_trusted_certificate; + ngx_str_t ssl_crl; +# endif /* nginx_version >= 1007000 */ +# if ((nginx_version >= 1007008) && (nginx_version < 1021000)) + ngx_str_t ssl_certificate; + ngx_str_t ssl_certificate_key; + ngx_array_t *ssl_passwords; +# endif /* nginx_version >= 1007008 && nginx_version < 1021000 */ +# if (nginx_version >= 1019004) + ngx_array_t *ssl_conf_commands; +# endif /*nginx_version >= 1019004 */ +# endif +} ngx_http_proxy_loc_conf_t; + +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_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_proxy_loc_conf_t *plcf; + ngx_str_t *value; +# if (nginx_version >= 1007009) + ngx_http_complex_value_t cv; +# endif /* nginx_version >= 1007009 */ + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->proxy.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->proxy); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + plcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_proxy_module); + +# if (nginx_version >= 1007009) + if (plcf->upstream.cache > 0) +# else + if (plcf->upstream.cache != NGX_CONF_UNSET_PTR + && plcf->upstream.cache != NULL) +# endif /* nginx_version >= 1007009 */ + { + return "is incompatible with \"proxy_cache\""; + } + + if (plcf->upstream.upstream || plcf->proxy_lengths) { + return "is incompatible with \"proxy_pass\""; + } + + if (plcf->upstream.store > 0 +# if (nginx_version < 1007009) + || plcf->upstream.store_lengths +# endif /* nginx_version >= 1007009 */ + ) { + return "is incompatible with \"proxy_store\""; + } + + value = cf->args->elts; + + /* set proxy_cache part */ +# if (nginx_version >= 1007009) + + plcf->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) { + + plcf->upstream.cache_value = ngx_palloc(cf->pool, + sizeof(ngx_http_complex_value_t)); + if (plcf->upstream.cache_value == NULL) { + return NGX_CONF_ERROR; + } + + *plcf->upstream.cache_value = cv; + + } else { + + plcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_proxy_module); + if (plcf->upstream.cache_zone == NULL) { + return NGX_CONF_ERROR; + } + } + +# else + + plcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_proxy_module); + if (plcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + +# endif /* nginx_version >= 1007009 */ + + /* set proxy_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &plcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->proxy.enable = 0; + cplcf->conf = &cplcf->proxy; + clcf->handler = ngx_http_proxy_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_proxy_cache_purge_handler(ngx_http_request_t *r) { + ngx_http_file_cache_t *cache; + ngx_http_proxy_loc_conf_t *plcf; + ngx_http_cache_purge_loc_conf_t *cplcf; +# if (nginx_version >= 1007009) + ngx_http_proxy_main_conf_t *pmcf; + ngx_int_t rc; +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_upstream_create(r) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + plcf = ngx_http_get_module_loc_conf(r, ngx_http_proxy_module); + + r->upstream->conf = &plcf->upstream; + +# if (nginx_version >= 1007009) + + pmcf = ngx_http_get_module_main_conf(r, ngx_http_proxy_module); + + r->upstream->caches = &pmcf->caches; + + rc = ngx_http_cache_purge_cache_get(r, r->upstream, &cache); + if (rc != NGX_OK) { + return rc; + } + +# else + + cache = plcf->upstream.cache->data; + +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_cache_purge_init(r, cache, &plcf->cache_key) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* Purge-all option */ + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + if (cplcf->conf->purge_all) { + ngx_http_cache_purge_all(r, cache); + } else { + if (ngx_http_cache_purge_is_partial(r)) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache purge with partial enabled"); + + ngx_http_cache_purge_partial(r, cache); + } + } + +# if (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) +extern ngx_module_t ngx_http_scgi_module; + +# if (nginx_version >= 1007009) + +typedef struct { + ngx_array_t caches; /* ngx_http_file_cache_t * */ +} ngx_http_scgi_main_conf_t; + +# endif /* nginx_version >= 1007009 */ + +# if (nginx_version >= 1007008) + +typedef struct { + ngx_array_t *flushes; + ngx_array_t *lengths; + ngx_array_t *values; + ngx_uint_t number; + ngx_hash_t hash; +} ngx_http_scgi_params_t; + +# endif /* nginx_version >= 1007008 */ + +typedef struct { + ngx_http_upstream_conf_t upstream; + +# if (nginx_version >= 1007008) + ngx_http_scgi_params_t params; + ngx_http_scgi_params_t params_cache; + ngx_array_t *params_source; +# else + ngx_array_t *flushes; + ngx_array_t *params_len; + ngx_array_t *params; + ngx_array_t *params_source; + + ngx_hash_t headers_hash; + ngx_uint_t header_params; +# endif /* nginx_version >= 1007008 */ + + ngx_array_t *scgi_lengths; + ngx_array_t *scgi_values; + + ngx_http_complex_value_t cache_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_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_scgi_loc_conf_t *slcf; + ngx_str_t *value; +# if (nginx_version >= 1007009) + ngx_http_complex_value_t cv; +# endif /* nginx_version >= 1007009 */ + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->scgi.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->scgi); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + slcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_scgi_module); + +# if (nginx_version >= 1007009) + if (slcf->upstream.cache > 0) +# else + if (slcf->upstream.cache != NGX_CONF_UNSET_PTR + && slcf->upstream.cache != NULL) +# endif /* nginx_version >= 1007009 */ + { + return "is incompatible with \"scgi_cache\""; + } + + if (slcf->upstream.upstream || slcf->scgi_lengths) { + return "is incompatible with \"scgi_pass\""; + } + + if (slcf->upstream.store > 0 +# if (nginx_version < 1007009) + || slcf->upstream.store_lengths +# endif /* nginx_version >= 1007009 */ + ) { + return "is incompatible with \"scgi_store\""; + } + + value = cf->args->elts; + + /* set scgi_cache part */ +# if (nginx_version >= 1007009) + + slcf->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) { + + slcf->upstream.cache_value = ngx_palloc(cf->pool, + sizeof(ngx_http_complex_value_t)); + if (slcf->upstream.cache_value == NULL) { + return NGX_CONF_ERROR; + } + + *slcf->upstream.cache_value = cv; + + } else { + + slcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_scgi_module); + if (slcf->upstream.cache_zone == NULL) { + return NGX_CONF_ERROR; + } + } + +# else + + slcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_scgi_module); + if (slcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + +# endif /* nginx_version >= 1007009 */ + + /* set scgi_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &slcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->scgi.enable = 0; + cplcf->conf = &cplcf->scgi; + clcf->handler = ngx_http_scgi_cache_purge_handler; + + return NGX_CONF_OK; +} + +ngx_int_t +ngx_http_scgi_cache_purge_handler(ngx_http_request_t *r) { + ngx_http_file_cache_t *cache; + ngx_http_scgi_loc_conf_t *slcf; + ngx_http_cache_purge_loc_conf_t *cplcf; +# if (nginx_version >= 1007009) + ngx_http_scgi_main_conf_t *smcf; + ngx_int_t rc; +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_upstream_create(r) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + slcf = ngx_http_get_module_loc_conf(r, ngx_http_scgi_module); + + r->upstream->conf = &slcf->upstream; + +# if (nginx_version >= 1007009) + + smcf = ngx_http_get_module_main_conf(r, ngx_http_scgi_module); + + r->upstream->caches = &smcf->caches; + + rc = ngx_http_cache_purge_cache_get(r, r->upstream, &cache); + if (rc != NGX_OK) { + return rc; + } + +# else + + cache = slcf->upstream.cache->data; + +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_cache_purge_init(r, cache, &slcf->cache_key) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* Purge-all option */ + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + if (cplcf->conf->purge_all) { + ngx_http_cache_purge_all(r, cache); + } else { + if (ngx_http_cache_purge_is_partial(r)) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache purge with partial enabled"); + + ngx_http_cache_purge_partial(r, cache); + } + } + +# if (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) +extern ngx_module_t ngx_http_uwsgi_module; + +# if (nginx_version >= 1007009) + +typedef struct { + ngx_array_t caches; /* ngx_http_file_cache_t * */ +} ngx_http_uwsgi_main_conf_t; + +# endif /* nginx_version >= 1007009 */ + +# if (nginx_version >= 1007008) + +typedef struct { + ngx_array_t *flushes; + ngx_array_t *lengths; + ngx_array_t *values; + ngx_uint_t number; + ngx_hash_t hash; +} ngx_http_uwsgi_params_t; + +# endif /* nginx_version >= 1007008 */ + +typedef struct { + ngx_http_upstream_conf_t upstream; + +# if (nginx_version >= 1007008) + ngx_http_uwsgi_params_t params; + ngx_http_uwsgi_params_t params_cache; + ngx_array_t *params_source; +# else + ngx_array_t *flushes; + ngx_array_t *params_len; + ngx_array_t *params; + ngx_array_t *params_source; + + ngx_hash_t headers_hash; + ngx_uint_t header_params; +# endif /* nginx_version >= 1007008 */ + + ngx_array_t *uwsgi_lengths; + ngx_array_t *uwsgi_values; + + ngx_http_complex_value_t cache_key; + + ngx_str_t uwsgi_string; + + ngx_uint_t modifier1; + ngx_uint_t modifier2; + +# if (NGX_HTTP_SSL) +# if (nginx_version >= 1005008) + ngx_uint_t ssl; + ngx_uint_t ssl_protocols; + ngx_str_t ssl_ciphers; +# endif /* nginx_version >= 1005008 */ +# if (nginx_version >= 1007000) + ngx_uint_t ssl_verify_depth; + ngx_str_t ssl_trusted_certificate; + ngx_str_t ssl_crl; +# endif /* nginx_version >= 1007000 */ +# if ((nginx_version >= 1007008) && (nginx_version < 1021000)) + ngx_str_t ssl_certificate; + ngx_str_t ssl_certificate_key; + ngx_array_t *ssl_passwords; +# endif /* nginx_version >= 1007008 && nginx_version < 1021000 */ +# if (nginx_version >= 1019004) + ngx_array_t *ssl_conf_commands; +# endif /*nginx_version >= 1019004 */ +# endif +} ngx_http_uwsgi_loc_conf_t; + +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_cache_purge_loc_conf_t *cplcf; + ngx_http_core_loc_conf_t *clcf; + ngx_http_uwsgi_loc_conf_t *ulcf; + ngx_str_t *value; +# if (nginx_version >= 1007009) + ngx_http_complex_value_t cv; +# endif /* nginx_version >= 1007009 */ + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->uwsgi.enable != NGX_CONF_UNSET) { + return "is duplicate"; + } + + if (cf->args->nelts != 3) { + return ngx_http_cache_purge_conf(cf, &cplcf->uwsgi); + } + + if (cf->cmd_type & (NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF)) { + return "(separate location syntax) is not allowed here"; + } + + ulcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_uwsgi_module); + +# if (nginx_version >= 1007009) + if (ulcf->upstream.cache > 0) +# else + if (ulcf->upstream.cache != NGX_CONF_UNSET_PTR + && ulcf->upstream.cache != NULL) +# endif /* nginx_version >= 1007009 */ + { + return "is incompatible with \"uwsgi_cache\""; + } + + if (ulcf->upstream.upstream || ulcf->uwsgi_lengths) { + return "is incompatible with \"uwsgi_pass\""; + } + + if (ulcf->upstream.store > 0 +# if (nginx_version < 1007009) + || ulcf->upstream.store_lengths +# endif /* nginx_version >= 1007009 */ + ) { + return "is incompatible with \"uwsgi_store\""; + } + + value = cf->args->elts; + + /* set uwsgi_cache part */ +# if (nginx_version >= 1007009) + + ulcf->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) { + + ulcf->upstream.cache_value = ngx_palloc(cf->pool, + sizeof(ngx_http_complex_value_t)); + if (ulcf->upstream.cache_value == NULL) { + return NGX_CONF_ERROR; + } + + *ulcf->upstream.cache_value = cv; + + } else { + + ulcf->upstream.cache_zone = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_uwsgi_module); + if (ulcf->upstream.cache_zone == NULL) { + return NGX_CONF_ERROR; + } + } + +# else + + ulcf->upstream.cache = ngx_shared_memory_add(cf, &value[1], 0, + &ngx_http_uwsgi_module); + if (ulcf->upstream.cache == NULL) { + return NGX_CONF_ERROR; + } + +# endif /* nginx_version >= 1007009 */ + + /* set uwsgi_cache_key part */ + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value[2]; + ccv.complex_value = &ulcf->cache_key; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_CONF_ERROR; + } + + /* set handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + cplcf->uwsgi.enable = 0; + cplcf->conf = &cplcf->uwsgi; + clcf->handler = ngx_http_uwsgi_cache_purge_handler; + + return NGX_CONF_OK; +} + + +ngx_int_t +ngx_http_uwsgi_cache_purge_handler(ngx_http_request_t *r) { + ngx_http_file_cache_t *cache; + ngx_http_uwsgi_loc_conf_t *ulcf; + ngx_http_cache_purge_loc_conf_t *cplcf; +# if (nginx_version >= 1007009) + ngx_http_uwsgi_main_conf_t *umcf; + ngx_int_t rc; +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_upstream_create(r) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + ulcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); + + r->upstream->conf = &ulcf->upstream; + +# if (nginx_version >= 1007009) + + umcf = ngx_http_get_module_main_conf(r, ngx_http_uwsgi_module); + + r->upstream->caches = &umcf->caches; + + rc = ngx_http_cache_purge_cache_get(r, r->upstream, &cache); + if (rc != NGX_OK) { + return rc; + } + +# else + + cache = ulcf->upstream.cache->data; + +# endif /* nginx_version >= 1007009 */ + + if (ngx_http_cache_purge_init(r, cache, &ulcf->cache_key) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* Purge-all option */ + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + if (cplcf->conf->purge_all) { + ngx_http_cache_purge_all(r, cache); + } else { + if (ngx_http_cache_purge_is_partial(r)) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache purge with partial enabled"); + + ngx_http_cache_purge_partial(r, cache); + } + } + +# if (nginx_version >= 8011) + r->main->count++; +# endif + + ngx_http_cache_purge_handler(r); + + return NGX_DONE; +} +# endif /* NGX_HTTP_UWSGI */ + + +char * +ngx_http_cache_purge_response_type_conf(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_cache_purge_loc_conf_t *cplcf; + ngx_str_t *value; + + cplcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_cache_purge_module); + + /* check for duplicates / collisions */ + if (cplcf->resptype != NGX_CONF_UNSET_UINT && cf->cmd_type == NGX_HTTP_LOC_CONF ) { + return "is duplicate"; + } + + /* sanity check */ + if (cf->args->nelts < 2) { + return "is invalid paramter, ex) cache_purge_response_type (html|json|xml|text)"; + } + + if (cf->args->nelts > 2 ) { + return "is required only 1 option, ex) cache_purge_response_type (html|json|xml|text)"; + } + + value = cf->args->elts; + + if (ngx_strcmp(value[1].data, "html") != 0 && ngx_strcmp(value[1].data, "json") != 0 + && ngx_strcmp(value[1].data, "xml") != 0 && ngx_strcmp(value[1].data, "text") != 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\", expected" + " \"(html|json|xml|text)\" keyword", &value[1]); + return NGX_CONF_ERROR; + } + + if (cf->cmd_type == NGX_HTTP_MODULE) { + return "(separate server or location syntax) is not allowed here"; + } + + if (ngx_strcmp(value[1].data, "html") == 0) { + cplcf->resptype = NGX_REPONSE_TYPE_HTML; + } else if (ngx_strcmp(value[1].data, "xml") == 0) { + cplcf->resptype = NGX_REPONSE_TYPE_XML; + } else if (ngx_strcmp(value[1].data, "json") == 0) { + cplcf->resptype = NGX_REPONSE_TYPE_JSON; + } else if (ngx_strcmp(value[1].data, "text") == 0) { + cplcf->resptype = NGX_REPONSE_TYPE_TEXT; + } + + return NGX_CONF_OK; +} + +static ngx_int_t +ngx_http_purge_file_cache_noop(ngx_tree_ctx_t *ctx, ngx_str_t *path) { + return NGX_OK; +} + +static ngx_int_t +ngx_http_purge_file_cache_delete_file(ngx_tree_ctx_t *ctx, ngx_str_t *path) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ctx->log, 0, + "http file cache delete: \"%s\"", path->data); + + if (ngx_delete_file(path->data) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno, + ngx_delete_file_n " \"%s\" failed", path->data); + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_purge_file_cache_delete_partial_file(ngx_tree_ctx_t *ctx, ngx_str_t *path) { + u_char *key_partial; + u_char *key_in_file; + ngx_uint_t len; + ngx_flag_t remove_file = 0; + + key_partial = ctx->data; + len = ngx_strlen(key_partial); + + /* if key_partial is empty always match, because is a '*' */ + if (len == 0) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, ctx->log, 0, + "empty key_partial, forcing deletion"); + remove_file = 1; + } else { + ngx_file_t file; + + ngx_memzero(&file, sizeof(ngx_file_t)); + file.offset = file.sys_offset = 0; + file.fd = ngx_open_file(path->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, + NGX_FILE_DEFAULT_ACCESS); + if (file.fd == -1) { + return NGX_OK; + } + file.log = ctx->log; + + /* I don't know if it's a good idea to use the ngx_cycle pool for this, + but the request is not available here */ + key_in_file = ngx_pcalloc(ngx_cycle->pool, sizeof(u_char) * (len + 1)); + + /* KEY: /proxy/passwd */ + /* since we don't need the "KEY: " ignore 5 + 1 extra u_char from last + intro */ + /* Optimization: we don't need to read the full key only the n chars + included in key_partial */ + ngx_read_file(&file, key_in_file, sizeof(u_char) * len, + sizeof(ngx_http_file_cache_header_t) + sizeof(u_char) * 6); + ngx_close_file(file.fd); + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, ctx->log, 0, + "http cache file \"%s\" key read: \"%s\"", path->data, key_in_file); + + if (ngx_strncasecmp(key_in_file, key_partial, len) == 0) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, ctx->log, 0, + "match found, deleting file \"%s\"", path->data); + remove_file = 1; + } + } + + if (remove_file && ngx_delete_file(path->data) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_CRIT, ctx->log, ngx_errno, + ngx_delete_file_n " \"%s\" failed", path->data); + } + + return NGX_OK; +} + +ngx_int_t +ngx_http_cache_purge_access_handler(ngx_http_request_t *r) { + ngx_http_cache_purge_loc_conf_t *cplcf; + + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + + if (r->method_name.len != cplcf->conf->method.len + || (ngx_strncmp(r->method_name.data, cplcf->conf->method.data, + r->method_name.len))) { + return cplcf->original_handler(r); + } + + if ((cplcf->conf->access || cplcf->conf->access6) + && ngx_http_cache_purge_access(cplcf->conf->access, + cplcf->conf->access6, + r->connection->sockaddr) != NGX_OK) { + return NGX_HTTP_FORBIDDEN; + } + + if (cplcf->handler == NULL) { + return NGX_HTTP_NOT_FOUND; + } + + return cplcf->handler(r); +} + +ngx_int_t +ngx_http_cache_purge_access(ngx_array_t *access, ngx_array_t *access6, + struct sockaddr *s) { + in_addr_t inaddr; + ngx_in_cidr_t *a; + ngx_uint_t i; +# if (NGX_HAVE_INET6) + struct in6_addr *inaddr6; + ngx_in6_cidr_t *a6; + u_char *p; + ngx_uint_t n; +# endif /* NGX_HAVE_INET6 */ + + switch (s->sa_family) { + case AF_INET: + if (access == NULL) { + return NGX_DECLINED; + } + + inaddr = ((struct sockaddr_in *) s)->sin_addr.s_addr; + +# if (NGX_HAVE_INET6) +ipv4: +# endif /* NGX_HAVE_INET6 */ + + a = access->elts; + for (i = 0; i < access->nelts; i++) { + if ((inaddr & a[i].mask) == a[i].addr) { + return NGX_OK; + } + } + + return NGX_DECLINED; + +# if (NGX_HAVE_INET6) + case AF_INET6: + inaddr6 = &((struct sockaddr_in6 *) s)->sin6_addr; + p = inaddr6->s6_addr; + + if (access && IN6_IS_ADDR_V4MAPPED(inaddr6)) { + inaddr = p[12] << 24; + inaddr += p[13] << 16; + inaddr += p[14] << 8; + inaddr += p[15]; + inaddr = htonl(inaddr); + + goto ipv4; + } + + if (access6 == NULL) { + return NGX_DECLINED; + } + + a6 = access6->elts; + for (i = 0; i < access6->nelts; i++) { + for (n = 0; n < 16; n++) { + if ((p[n] & a6[i].mask.s6_addr[n]) != a6[i].addr.s6_addr[n]) { + goto next; + } + } + + return NGX_OK; + +next: + continue; + } + + return NGX_DECLINED; +# endif /* NGX_HAVE_INET6 */ + } + + return NGX_DECLINED; +} + +ngx_int_t +ngx_http_cache_purge_send_response(ngx_http_request_t *r) { + ngx_chain_t out; + ngx_buf_t *b; + ngx_str_t *key; + ngx_int_t rc; + size_t len; + + size_t body_len; + size_t resp_tmpl_len; + u_char *buf; + u_char *buf_keydata; + u_char *p; + const char *resp_ct; + size_t resp_ct_size; + const char *resp_body; + size_t resp_body_size; + + ngx_http_cache_purge_loc_conf_t *cplcf; + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + + key = r->cache->keys.elts; + + buf_keydata = ngx_pcalloc(r->pool, key[0].len+1); + if (buf_keydata == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + p = ngx_cpymem(buf_keydata, key[0].data, key[0].len); + if (p == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + switch(cplcf->resptype) { + + case NGX_REPONSE_TYPE_JSON: + resp_ct = ngx_http_cache_purge_content_type_json; + resp_ct_size = ngx_http_cache_purge_content_type_json_size; + resp_body = ngx_http_cache_purge_body_templ_json; + resp_body_size = ngx_http_cache_purge_body_templ_json_size; + break; + + case NGX_REPONSE_TYPE_XML: + resp_ct = ngx_http_cache_purge_content_type_xml; + resp_ct_size = ngx_http_cache_purge_content_type_xml_size; + resp_body = ngx_http_cache_purge_body_templ_xml; + resp_body_size = ngx_http_cache_purge_body_templ_xml_size; + break; + + case NGX_REPONSE_TYPE_TEXT: + resp_ct = ngx_http_cache_purge_content_type_text; + resp_ct_size = ngx_http_cache_purge_content_type_text_size; + resp_body = ngx_http_cache_purge_body_templ_text; + resp_body_size = ngx_http_cache_purge_body_templ_text_size; + break; + + default: + case NGX_REPONSE_TYPE_HTML: + resp_ct = ngx_http_cache_purge_content_type_html; + resp_ct_size = ngx_http_cache_purge_content_type_html_size; + resp_body = ngx_http_cache_purge_body_templ_html; + resp_body_size = ngx_http_cache_purge_body_templ_html_size; + break; + } + + body_len = resp_body_size - 2 - 1; + r->headers_out.content_type.len = resp_ct_size - 1; + r->headers_out.content_type.data = (u_char *) resp_ct; + + resp_tmpl_len = body_len + key[0].len ; + + buf = ngx_pcalloc(r->pool, resp_tmpl_len); + if (buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + p = ngx_snprintf(buf, resp_tmpl_len, resp_body , buf_keydata); + if (p == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + len = body_len + key[0].len; + + r->headers_out.status = NGX_HTTP_OK; + r->headers_out.content_length_n = len; + + if (r->method == NGX_HTTP_HEAD) { + rc = ngx_http_send_header(r); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + } + + b = ngx_create_temp_buf(r->pool, len); + if (b == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + + out.buf = b; + out.next = NULL; + + b->last = ngx_cpymem(b->last, buf, resp_tmpl_len); + b->last_buf = 1; + + rc = ngx_http_send_header(r); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + return ngx_http_output_filter(r, &out); +} + +# if (nginx_version >= 1007009) + +/* + * Based on: ngx_http_upstream.c/ngx_http_upstream_cache_get + * Copyright (C) Igor Sysoev + * Copyright (C) Nginx, Inc. + */ +ngx_int_t +ngx_http_cache_purge_cache_get(ngx_http_request_t *r, ngx_http_upstream_t *u, + ngx_http_file_cache_t **cache) { + ngx_str_t *name, val; + ngx_uint_t i; + ngx_http_file_cache_t **caches; + + if (u->conf->cache_zone) { + *cache = u->conf->cache_zone->data; + return NGX_OK; + } + + if (ngx_http_complex_value(r, u->conf->cache_value, &val) != NGX_OK) { + return NGX_ERROR; + } + + if (val.len == 0 + || (val.len == 3 && ngx_strncmp(val.data, "off", 3) == 0)) { + return NGX_DECLINED; + } + + caches = u->caches->elts; + + for (i = 0; i < u->caches->nelts; i++) { + name = &caches[i]->shm_zone->shm.name; + + if (name->len == val.len + && ngx_strncmp(name->data, val.data, val.len) == 0) { + *cache = caches[i]; + return NGX_OK; + } + } + + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "cache \"%V\" not found", &val); + + return NGX_ERROR; +} + +# endif /* nginx_version >= 1007009 */ + +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_cache_t *c; + ngx_str_t *key; + ngx_int_t rc; + + rc = ngx_http_discard_request_body(r); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + c = ngx_pcalloc(r->pool, sizeof(ngx_http_cache_t)); + if (c == NULL) { + return NGX_ERROR; + } + + rc = ngx_array_init(&c->keys, r->pool, 1, sizeof(ngx_str_t)); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + key = ngx_array_push(&c->keys); + if (key == NULL) { + return NGX_ERROR; + } + + rc = ngx_http_complex_value(r, cache_key, key); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + r->cache = c; + c->body_start = ngx_pagesize; + c->file_cache = cache; + c->file.log = r->connection->log; + + ngx_http_file_cache_create_key(r); + + return NGX_OK; +} + +void +ngx_http_cache_purge_handler(ngx_http_request_t *r) { + ngx_http_cache_purge_loc_conf_t *cplcf; + ngx_int_t rc; + +# if (NGX_HAVE_FILE_AIO) + if (r->aio) { + return; + } +# endif + + cplcf = ngx_http_get_module_loc_conf(r, ngx_http_cache_purge_module); + rc = NGX_OK; + if (!cplcf->conf->purge_all && !ngx_http_cache_purge_is_partial(r)) { + rc = ngx_http_file_cache_purge(r); + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "http file cache purge: %i, \"%s\"", + rc, r->cache->file.name.data); + } + + switch (rc) { + case NGX_OK: + r->write_event_handler = ngx_http_request_empty_handler; + ngx_http_finalize_request(r, ngx_http_cache_purge_send_response(r)); + return; + case NGX_DECLINED: + ngx_http_finalize_request(r, NGX_HTTP_PRECONDITION_FAILED); + return; +# if (NGX_HAVE_FILE_AIO) + case NGX_AGAIN: + r->write_event_handler = ngx_http_cache_purge_handler; + return; +# endif + default: + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + } +} + +ngx_int_t +ngx_http_file_cache_purge(ngx_http_request_t *r) { + ngx_http_file_cache_t *cache; + ngx_http_cache_t *c; + + switch (ngx_http_file_cache_open(r)) { + case NGX_OK: + case NGX_HTTP_CACHE_STALE: +# if (nginx_version >= 8001) \ + || ((nginx_version < 8000) && (nginx_version >= 7060)) + case NGX_HTTP_CACHE_UPDATING: +# endif + break; + case NGX_DECLINED: + return NGX_DECLINED; +# if (NGX_HAVE_FILE_AIO) + case NGX_AGAIN: + return NGX_AGAIN; +# endif + default: + return NGX_ERROR; + } + + c = r->cache; + cache = c->file_cache; + + /* + * delete file from disk but *keep* in-memory node, + * because other requests might still point to it. + */ + + ngx_shmtx_lock(&cache->shpool->mutex); + + if (!c->node->exists) { + /* race between concurrent purges, backoff */ + ngx_shmtx_unlock(&cache->shpool->mutex); + return NGX_DECLINED; + } + +# if (nginx_version >= 1000001) + cache->sh->size -= c->node->fs_size; + c->node->fs_size = 0; +# else + cache->sh->size -= (c->node->length + cache->bsize - 1) / cache->bsize; + c->node->length = 0; +# endif + + c->node->exists = 0; +# if (nginx_version >= 8001) \ + || ((nginx_version < 8000) && (nginx_version >= 7060)) + c->node->updating = 0; +# endif + + ngx_shmtx_unlock(&cache->shpool->mutex); + + if (ngx_delete_file(c->file.name.data) == NGX_FILE_ERROR) { + /* entry in error log is enough, don't notice client */ + ngx_log_error(NGX_LOG_CRIT, r->connection->log, ngx_errno, + ngx_delete_file_n " \"%s\" failed", c->file.name.data); + } + + /* file deleted from cache */ + return NGX_OK; +} + + +void +ngx_http_cache_purge_all(ngx_http_request_t *r, ngx_http_file_cache_t *cache) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "purge_all http in %s", + cache->path->name.data); + + /* Walk the tree and remove all the files */ + ngx_tree_ctx_t tree; + tree.init_handler = NULL; + tree.file_handler = ngx_http_purge_file_cache_delete_file; + tree.pre_tree_handler = ngx_http_purge_file_cache_noop; + tree.post_tree_handler = ngx_http_purge_file_cache_noop; + tree.spec_handler = ngx_http_purge_file_cache_noop; + tree.data = NULL; + tree.alloc = 0; + tree.log = ngx_cycle->log; + + ngx_walk_tree(&tree, &cache->path->name); +} + +void +ngx_http_cache_purge_partial(ngx_http_request_t *r, ngx_http_file_cache_t *cache) { + ngx_log_debug(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "purge_partial http in %s", + cache->path->name.data); + + u_char *key_partial; + ngx_str_t *key; + ngx_http_cache_t *c; + ngx_uint_t len; + + c = r->cache; + key = c->keys.elts; + len = key[0].len; + + /* Only check the first key */ + key_partial = ngx_pcalloc(r->pool, sizeof(u_char) * len); + ngx_memcpy(key_partial, key[0].data, sizeof(u_char) * (len - 1)); + + /* Walk the tree and remove all the files matching key_partial */ + ngx_tree_ctx_t tree; + tree.init_handler = NULL; + tree.file_handler = ngx_http_purge_file_cache_delete_partial_file; + tree.pre_tree_handler = ngx_http_purge_file_cache_noop; + tree.post_tree_handler = ngx_http_purge_file_cache_noop; + tree.spec_handler = ngx_http_purge_file_cache_noop; + tree.data = key_partial; + tree.alloc = 0; + tree.log = ngx_cycle->log; + + ngx_walk_tree(&tree, &cache->path->name); +} + +ngx_int_t +ngx_http_cache_purge_is_partial(ngx_http_request_t *r) { + ngx_str_t *key; + ngx_http_cache_t *c; + + c = r->cache; + key = c->keys.elts; + + /* Only check the first key */ + return c->keys.nelts > 0 // number of array elements + && key[0].len > 0 // char length of the key + && key[0].data[key[0].len - 1] == '*'; // is the last char an asterix char? +} + +char * +ngx_http_cache_purge_conf(ngx_conf_t *cf, ngx_http_cache_purge_conf_t *cpcf) { + ngx_cidr_t cidr; + ngx_in_cidr_t *access; +# if (NGX_HAVE_INET6) + ngx_in6_cidr_t *access6; +# endif /* NGX_HAVE_INET6 */ + ngx_str_t *value; + ngx_int_t rc; + ngx_uint_t i; + ngx_uint_t from_position; + + from_position = 2; + + /* xxx_cache_purge on|off| [purge_all] [from all| [.. ]] */ + value = cf->args->elts; + + if (ngx_strcmp(value[1].data, "off") == 0) { + cpcf->enable = 0; + return NGX_CONF_OK; + + } else if (ngx_strcmp(value[1].data, "on") == 0) { + ngx_str_set(&cpcf->method, "PURGE"); + + } else { + cpcf->method = value[1]; + } + + if (cf->args->nelts < 4) { + cpcf->enable = 1; + return NGX_CONF_OK; + } + + /* We will purge all the keys */ + if (ngx_strcmp(value[from_position].data, "purge_all") == 0) { + cpcf->purge_all = 1; + from_position++; + } + + + /* sanity check */ + if (ngx_strcmp(value[from_position].data, "from") != 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\", expected" + " \"from\" keyword", &value[from_position]); + return NGX_CONF_ERROR; + } + + if (ngx_strcmp(value[from_position + 1].data, "all") == 0) { + cpcf->enable = 1; + return NGX_CONF_OK; + } + + for (i = (from_position + 1); i < cf->args->nelts; i++) { + rc = ngx_ptocidr(&value[i], &cidr); + + if (rc == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid parameter \"%V\"", &value[i]); + return NGX_CONF_ERROR; + } + + if (rc == NGX_DONE) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "low address bits of %V are meaningless", + &value[i]); + } + + switch (cidr.family) { + case AF_INET: + if (cpcf->access == NULL) { + cpcf->access = ngx_array_create(cf->pool, cf->args->nelts - (from_position + 1), + sizeof(ngx_in_cidr_t)); + if (cpcf->access == NULL) { + return NGX_CONF_ERROR; + } + } + + access = ngx_array_push(cpcf->access); + if (access == NULL) { + return NGX_CONF_ERROR; + } + + access->mask = cidr.u.in.mask; + access->addr = cidr.u.in.addr; + + break; + +# if (NGX_HAVE_INET6) + case AF_INET6: + if (cpcf->access6 == NULL) { + cpcf->access6 = ngx_array_create(cf->pool, cf->args->nelts - (from_position + 1), + sizeof(ngx_in6_cidr_t)); + if (cpcf->access6 == NULL) { + return NGX_CONF_ERROR; + } + } + + access6 = ngx_array_push(cpcf->access6); + if (access6 == NULL) { + return NGX_CONF_ERROR; + } + + access6->mask = cidr.u.in6.mask; + access6->addr = cidr.u.in6.addr; + + break; +# endif /* NGX_HAVE_INET6 */ + } + } + + cpcf->enable = 1; + + return NGX_CONF_OK; +} + +void +ngx_http_cache_purge_merge_conf(ngx_http_cache_purge_conf_t *conf, + ngx_http_cache_purge_conf_t *prev) { + if (conf->enable == NGX_CONF_UNSET) { + if (prev->enable == 1) { + conf->enable = prev->enable; + conf->method = prev->method; + conf->purge_all = prev->purge_all; + conf->access = prev->access; + conf->access6 = prev->access6; + } else { + conf->enable = 0; + } + } +} + +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 NULL; + } + + /* + * set by ngx_pcalloc(): + * + * conf->*.method = { 0, NULL } + * conf->*.access = NULL + * conf->*.access6 = NULL + * conf->handler = NULL + * conf->original_handler = NULL + */ + +# if (NGX_HTTP_FASTCGI) + conf->fastcgi.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_FASTCGI */ +# if (NGX_HTTP_PROXY) + conf->proxy.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_PROXY */ +# if (NGX_HTTP_SCGI) + conf->scgi.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_SCGI */ +# if (NGX_HTTP_UWSGI) + conf->uwsgi.enable = NGX_CONF_UNSET; +# endif /* NGX_HTTP_UWSGI */ + + conf->resptype = NGX_CONF_UNSET_UINT; + + conf->conf = NGX_CONF_UNSET_PTR; + + return conf; +} + +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; + ngx_http_core_loc_conf_t *clcf; +# if (NGX_HTTP_FASTCGI) + ngx_http_fastcgi_loc_conf_t *flcf; +# endif /* NGX_HTTP_FASTCGI */ +# if (NGX_HTTP_PROXY) + ngx_http_proxy_loc_conf_t *plcf; +# endif /* NGX_HTTP_PROXY */ +# if (NGX_HTTP_SCGI) + ngx_http_scgi_loc_conf_t *slcf; +# endif /* NGX_HTTP_SCGI */ +# if (NGX_HTTP_UWSGI) + ngx_http_uwsgi_loc_conf_t *ulcf; +# endif /* NGX_HTTP_UWSGI */ + + clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); + + ngx_conf_merge_uint_value(conf->resptype, prev->resptype, NGX_REPONSE_TYPE_HTML); + +# if (NGX_HTTP_FASTCGI) + ngx_http_cache_purge_merge_conf(&conf->fastcgi, &prev->fastcgi); + + if (conf->fastcgi.enable && clcf->handler != NULL) { + flcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_fastcgi_module); + + if (flcf->upstream.upstream || flcf->fastcgi_lengths) { + conf->conf = &conf->fastcgi; + conf->handler = flcf->upstream.cache + ? ngx_http_fastcgi_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_FASTCGI */ + +# if (NGX_HTTP_PROXY) + ngx_http_cache_purge_merge_conf(&conf->proxy, &prev->proxy); + + if (conf->proxy.enable && clcf->handler != NULL) { + plcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_proxy_module); + + if (plcf->upstream.upstream || plcf->proxy_lengths) { + conf->conf = &conf->proxy; + conf->handler = plcf->upstream.cache + ? ngx_http_proxy_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_PROXY */ + +# if (NGX_HTTP_SCGI) + ngx_http_cache_purge_merge_conf(&conf->scgi, &prev->scgi); + + if (conf->scgi.enable && clcf->handler != NULL) { + slcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_scgi_module); + + if (slcf->upstream.upstream || slcf->scgi_lengths) { + conf->conf = &conf->scgi; + conf->handler = slcf->upstream.cache + ? ngx_http_scgi_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_SCGI */ + +# if (NGX_HTTP_UWSGI) + ngx_http_cache_purge_merge_conf(&conf->uwsgi, &prev->uwsgi); + + if (conf->uwsgi.enable && clcf->handler != NULL) { + ulcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_uwsgi_module); + + if (ulcf->upstream.upstream || ulcf->uwsgi_lengths) { + conf->conf = &conf->uwsgi; + conf->handler = ulcf->upstream.cache + ? ngx_http_uwsgi_cache_purge_handler : NULL; + conf->original_handler = clcf->handler; + + clcf->handler = ngx_http_cache_purge_access_handler; + + return NGX_CONF_OK; + } + } +# endif /* NGX_HTTP_UWSGI */ + + ngx_conf_merge_ptr_value(conf->conf, prev->conf, NULL); + + if (conf->handler == NULL) { + conf->handler = prev->handler; + } + + if (conf->original_handler == NULL) { + conf->original_handler = prev->original_handler; + } + + return NGX_CONF_OK; +} + +#else /* !NGX_HTTP_CACHE */ + +static ngx_http_module_t ngx_http_cache_purge_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + NULL, /* create location configuration */ + NULL, /* merge location configuration */ +}; + +ngx_module_t ngx_http_cache_purge_module = { + NGX_MODULE_V1, + &ngx_http_cache_purge_module_ctx, /* module context */ + NULL, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + +#endif /* NGX_HTTP_CACHE */ diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t new file mode 100644 index 0000000..fefe9b8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1.t @@ -0,0 +1,136 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * (blocks() * 4 + 3 * 1); + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location ~ /purge(/.*) { + proxy_cache_purge test_cache $1$is_args$args; + } + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 2: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 3: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge/proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 4: purge from empty cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge/proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 5: get from source +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 6: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1_vars.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1_vars.t new file mode 100644 index 0000000..b9da04b --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy1_vars.t @@ -0,0 +1,138 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * (blocks() * 4 + 3 * 1); + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + set $cache test_cache; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache $cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location ~ /purge(/.*) { + proxy_cache_purge $cache $1$is_args$args; + } + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 2: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 3: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge/proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 4: purge from empty cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge/proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 5: get from source +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 6: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t new file mode 100644 index 0000000..4c7e19f --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2.t @@ -0,0 +1,349 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * (blocks() * 4 + 6 * 1); + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + proxy_cache_purge on; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + + if ($uri) { } + } + + location = /etc/passwd { + root /; + } +_EOC_ + +our $config_allowed = <<'_EOC_'; + proxy_cache_purge PURGE from 1.0.0.0/8 127.0.0.0/8 3.0.0.0/8; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location = /etc/passwd { + root /; + } +_EOC_ + +our $config_forbidden = <<'_EOC_'; + proxy_cache_purge PURGE from 1.0.0.0/8; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 2: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 3: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 4: purge from empty cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 5: get from source +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 6: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 7: purge from cache (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +PURGE /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 8: purge from empty cache (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +PURGE /proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 9: get from source (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 10: get from cache (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 11: purge from cache (PURGE not allowed) +--- http_config eval: $::http_config +--- config eval: $::config_forbidden +--- request +PURGE /proxy/passwd +--- error_code: 403 +--- response_headers +Content-Type: text/html +--- response_body_like: 403 Forbidden +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 12: get from cache (PURGE not allowed) +--- http_config eval: $::http_config +--- config eval: $::config_forbidden +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 13: no cache (PURGE allowed) +--- http_config eval: $::http_config +--- config + proxy_cache_purge PURGE from 1.0.0.0/8 127.0.0.0/8 3.0.0.0/8; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + } + + location = /etc/passwd { + root /; + } +--- request +PURGE /proxy/passwd +--- error_code: 404 +--- response_headers +Content-Type: text/html +--- response_body_like: 404 Not Found +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 14: no cache (PURGE not allowed) +--- http_config eval: $::http_config +--- config + proxy_cache_purge PURGE from 1.0.0.0/8; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + } + + location = /etc/passwd { + root /; + } +--- request +PURGE /proxy/passwd +--- error_code: 403 +--- response_headers +Content-Type: text/html +--- response_body_like: 403 Forbidden +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 15: multiple cache purge directives +--- http_config eval: $::http_config +--- config + fastcgi_cache_purge on; + proxy_cache_purge on; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + + if ($uri) { } + } + + location = /etc/passwd { + root /; + } +--- request +PURGE /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2_vars.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2_vars.t new file mode 100644 index 0000000..08e3e1e --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy2_vars.t @@ -0,0 +1,353 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * (blocks() * 4 + 6 * 1); + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + proxy_cache_purge on; + set $cache test_cache; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache $cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + + if ($uri) { } + } + + location = /etc/passwd { + root /; + } +_EOC_ + +our $config_allowed = <<'_EOC_'; + proxy_cache_purge PURGE from 1.0.0.0/8 127.0.0.0/8 3.0.0.0/8; + set $cache test_cache; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache $cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location = /etc/passwd { + root /; + } +_EOC_ + +our $config_forbidden = <<'_EOC_'; + proxy_cache_purge PURGE from 1.0.0.0/8; + set $cache test_cache; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache $cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 2: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 3: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 4: purge from empty cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 5: get from source +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 6: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 7: purge from cache (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +PURGE /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 8: purge from empty cache (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +PURGE /proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 9: get from source (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 10: get from cache (PURGE allowed) +--- http_config eval: $::http_config +--- config eval: $::config_allowed +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 11: purge from cache (PURGE not allowed) +--- http_config eval: $::http_config +--- config eval: $::config_forbidden +--- request +PURGE /proxy/passwd +--- error_code: 403 +--- response_headers +Content-Type: text/html +--- response_body_like: 403 Forbidden +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 12: get from cache (PURGE not allowed) +--- http_config eval: $::http_config +--- config eval: $::config_forbidden +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 5: < 1.7.9 + + + +=== TEST 13: no cache (PURGE allowed) +--- http_config eval: $::http_config +--- config + proxy_cache_purge PURGE from 1.0.0.0/8 127.0.0.0/8 3.0.0.0/8; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + } + + location = /etc/passwd { + root /; + } +--- request +PURGE /proxy/passwd +--- error_code: 404 +--- response_headers +Content-Type: text/html +--- response_body_like: 404 Not Found +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 14: no cache (PURGE not allowed) +--- http_config eval: $::http_config +--- config + proxy_cache_purge PURGE from 1.0.0.0/8; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + } + + location = /etc/passwd { + root /; + } +--- request +PURGE /proxy/passwd +--- error_code: 403 +--- response_headers +Content-Type: text/html +--- response_body_like: 403 Forbidden +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 + + + +=== TEST 15: multiple cache purge directives +--- http_config eval: $::http_config +--- config + fastcgi_cache_purge on; + proxy_cache_purge on; + set $cache test_cache; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache $cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + + if ($uri) { } + } + + location = /etc/passwd { + root /; + } +--- request +PURGE /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx: 4: < 1.7.9 diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy3.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy3.t new file mode 100644 index 0000000..c8d71d9 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy3.t @@ -0,0 +1,140 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => 32; + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + + proxy_cache_purge PURGE purge_all from 1.0.0.0/8 127.0.0.0/8 3.0.0.0/8; + } + + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare passwd +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 2: prepare shadow +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/shadow +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + + +=== TEST 3: get from cache passwd +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 4: get from cache shadow +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/shadow +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 5: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /proxy/any +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 6: get from empty cache passwd +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 7: get from empty cache shadow +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/shadow +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy4.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy4.t new file mode 100644 index 0000000..e4d2f30 --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/proxy4.t @@ -0,0 +1,168 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => 41; + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + + proxy_cache_purge PURGE from 1.0.0.0/8 127.0.0.0/8 3.0.0.0/8; + } + + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare passwd +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 2: prepare passwd2 +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd2 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 3: prepare shadow +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/shadow +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 4: get from cache passwd +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 5: get from cache passwd2 +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd2 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 6: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /proxy/pass* +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 7: get from empty cache passwd +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 8: get from empty cache passwd2 +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd2 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ + + +=== TEST 9: get from cache shadow +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/shadow +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ diff --git a/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/resptype1.t b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/resptype1.t new file mode 100644 index 0000000..816c3ff --- /dev/null +++ b/modules_deb/libnginx-mod-http-cache-purge-2.5.3/t/resptype1.t @@ -0,0 +1,245 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * (blocks() * 4 + 3 * 1); + +our $http_config = <<'_EOC_'; + proxy_cache_path /tmp/ngx_cache_purge_cache keys_zone=test_cache:10m; + proxy_temp_path /tmp/ngx_cache_purge_temp 1 2; +_EOC_ + +our $config = <<'_EOC_'; + + cache_purge_response_type json; + + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/etc/passwd; + proxy_cache test_cache; + proxy_cache_key $uri$is_args$args; + proxy_cache_valid 3m; + add_header X-Cache-Status $upstream_cache_status; + } + + location ~ /purge(/.*) { + proxy_cache_purge test_cache $1$is_args$args; + cache_purge_response_type html; + } + + location ~ /purge_json(/.*) { + proxy_cache_purge test_cache $1$is_args$args; + } + + location ~ /purge_xml(/.*) { + proxy_cache_purge test_cache $1$is_args$args; + cache_purge_response_type xml; + } + + location ~ /purge_text(/.*) { + proxy_cache_purge test_cache $1$is_args$args; + cache_purge_response_type text; + } + + + + location = /etc/passwd { + root /; + } +_EOC_ + +worker_connections(128); +no_shuffle(); +run_tests(); + +no_diff(); + +__DATA__ + +=== TEST 1: prepare +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 2: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 3: purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge/proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/html +--- response_body_like: Successful purge +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 4: purge from empty cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge/proxy/passwd +--- error_code: 412 +--- response_headers +Content-Type: text/html +--- response_body_like: 412 Precondition Failed +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + + +=== TEST 5: get from source +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: MISS +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + + + +=== TEST 6: get from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd +--- error_code: 200 +--- response_headers +Content-Type: text/plain +X-Cache-Status: HIT +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 5: < 0.8.3 or < 0.7.62 + +=== TEST 7-prepare: prepare purge +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd?t=7 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + +=== TEST 7: get a JSON response after purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge_json/proxy/passwd?t=7 +--- error_code: 200 +--- response_headers +Content-Type: application/json +--- response_body_like: {\"Key\": \"\/proxy\/passwd\?t=7\" +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + +=== TEST 8-prepare: prepare purge +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd?t=8 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + +=== TEST 8: get a XML response after purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge_xml/proxy/passwd?t=8 +--- error_code: 200 +--- response_headers +Content-Type: text/xml +--- response_body_like: \<\?xml version=\"1.0\" encoding=\"UTF-8\"\?><\!\[CDATA\[\/proxy\/passwd\?t=8\]\]><\/Key> +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + +=== TEST 9-prepare: prepare purge +--- http_config eval: $::http_config +--- config eval: $::config +--- request +GET /proxy/passwd?t=9 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: root +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + +=== TEST 9: get a TEXT response after purge from cache +--- http_config eval: $::http_config +--- config eval: $::config +--- request +PURGE /purge_text/proxy/passwd?t=9 +--- error_code: 200 +--- response_headers +Content-Type: text/plain +--- response_body_like: Key +--- timeout: 10 +--- no_error_log eval +qr/\[(warn|error|crit|alert|emerg)\]/ +--- skip_nginx2: 4: < 0.8.3 or < 0.7.62 + + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/.gitattributes b/modules_deb/libnginx-mod-http-echo-0.63/.gitattributes new file mode 100644 index 0000000..6fe6f35 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/.gitattributes @@ -0,0 +1 @@ +*.t linguist-language=Text diff --git a/modules_deb/libnginx-mod-http-echo-0.63/.gitignore b/modules_deb/libnginx-mod-http-echo-0.63/.gitignore new file mode 100644 index 0000000..a9948e4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/.gitignore @@ -0,0 +1,65 @@ +.libs +*.swp +*.slo +*.la +*.swo +*.lo +*.mobi +genmobi.sh +*~ +*.o +print.txt +.rsync +*.tar.gz +dist +build[789] +build +tags +update-readme +*.tmp +test/Makefile +test/blib +test.sh +t.sh +t/t.sh +test/t/servroot/ +releng +reset +*.t_ +reindex +src/location.h +src/filter.c +src/subrequest.h +src/sleep.h +src/util.c +src/echo.c +src/info.c +src/util.h +src/var.h +src/filter.h +src/sleep.c +src/var.c +src/timer.c +src/module.h +src/echo.h +src/info.h +src/foreach.c +src/location.c +src/timer.h +src/module.c +src/subrequest.c +src/handler.h +src/foreach.h +src/handler.c +nginx +*.html +ctags +t/servroot +all +buildroot/ +go +Changes +build1[0-9] +analyze +Makefile +*.plist diff --git a/modules_deb/libnginx-mod-http-echo-0.63/.travis.yml b/modules_deb/libnginx-mod-http-echo-0.63/.travis.yml new file mode 100644 index 0000000..7dda358 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/.travis.yml @@ -0,0 +1,48 @@ +sudo: required +dist: bionic + +os: linux + +language: c + +compiler: + - gcc + +env: + global: + - LUAJIT_PREFIX=/opt/luajit21 + - LUAJIT_LIB=$LUAJIT_PREFIX/lib + - LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 + - LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH + matrix: + - NGINX_VERSION=1.17.8 + - NGINX_VERSION=1.19.9 + +before_install: + - sudo apt-get install -qq -y cpanminus libgd-dev ca-certificates + - sudo cpanm -v --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1) + +install: + - wget http://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz && tar -xzf nginx-${NGINX_VERSION}.tar.gz + - git clone https://github.com/simpl/ngx_devel_kit.git + - git clone https://github.com/openresty/set-misc-nginx-module.git + - git clone https://github.com/openresty/xss-nginx-module.git + - git clone https://github.com/openresty/rds-json-nginx-module.git + - git clone https://github.com/openresty/headers-more-nginx-module.git + - git clone https://github.com/openresty/lua-nginx-module.git + - git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core + - git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache + - git clone https://github.com/openresty/nginx-eval-module.git + - git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git luajit2 + +script: + - cd luajit2/ + - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT -msse4.2' > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + - cd nginx-${NGINX_VERSION}/ + - ./configure --without-http_ssi_module --with-debug --with-select_module --with-poll_module --with-http_stub_status_module --with-http_image_filter_module --add-module=../ngx_devel_kit --add-module=../set-misc-nginx-module --add-module=../nginx-eval-module --add-module=../xss-nginx-module --add-module=../rds-json-nginx-module --add-module=../headers-more-nginx-module --add-module=../lua-nginx-module --add-module=.. > build.log 2>&1 || (cat build.log && exit 1) + - make -j2 > build.log 2>&1 || (cat build.log && exit 1) + - export PATH=$PATH:`pwd`/objs + - cd .. + - prove -I. -r t diff --git a/modules_deb/libnginx-mod-http-echo-0.63/LICENSE b/modules_deb/libnginx-mod-http-echo-0.63/LICENSE new file mode 100644 index 0000000..6feffbf --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/LICENSE @@ -0,0 +1,25 @@ +Copyright (C) 2009-2014, Yichun "agentzh" Zhang . +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-echo-0.63/README.markdown b/modules_deb/libnginx-mod-http-echo-0.63/README.markdown new file mode 100644 index 0000000..a6b25e3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/README.markdown @@ -0,0 +1,1851 @@ +Name +==== + +**ngx_echo** - Brings "echo", "sleep", "time", "exec" and more shell-style goodies to Nginx config file. + +*This module is not distributed with the Nginx source.* See [the installation instructions](#installation). + +Table of Contents +================= + +* [Name](#name) +* [Status](#status) +* [Version](#version) +* [Synopsis](#synopsis) +* [Description](#description) +* [Content Handler Directives](#content-handler-directives) + * [echo](#echo) + * [echo_duplicate](#echo_duplicate) + * [echo_flush](#echo_flush) + * [echo_sleep](#echo_sleep) + * [echo_blocking_sleep](#echo_blocking_sleep) + * [echo_reset_timer](#echo_reset_timer) + * [echo_read_request_body](#echo_read_request_body) + * [echo_location_async](#echo_location_async) + * [echo_location](#echo_location) + * [echo_subrequest_async](#echo_subrequest_async) + * [echo_subrequest](#echo_subrequest) + * [echo_foreach_split](#echo_foreach_split) + * [echo_end](#echo_end) + * [echo_request_body](#echo_request_body) + * [echo_exec](#echo_exec) + * [echo_status](#echo_status) +* [Filter Directives](#filter-directives) + * [echo_before_body](#echo_before_body) + * [echo_after_body](#echo_after_body) +* [Variables](#variables) + * [$echo_it](#echo_it) + * [$echo_timer_elapsed](#echo_timer_elapsed) + * [$echo_request_body](#echo_request_body) + * [$echo_request_method](#echo_request_method) + * [$echo_client_request_method](#echo_client_request_method) + * [$echo_client_request_headers](#echo_client_request_headers) + * [$echo_cacheable_request_uri](#echo_cacheable_request_uri) + * [$echo_request_uri](#echo_request_uri) + * [$echo_incr](#echo_incr) + * [$echo_response_status](#echo_response_status) +* [Installation](#installation) +* [Compatibility](#compatibility) +* [Modules that use this module for testing](#modules-that-use-this-module-for-testing) +* [Community](#community) + * [English Mailing List](#english-mailing-list) + * [Chinese Mailing List](#chinese-mailing-list) +* [Report Bugs](#report-bugs) +* [Source Repository](#source-repository) +* [Changes](#changes) +* [Test Suite](#test-suite) +* [TODO](#todo) +* [Getting involved](#getting-involved) +* [Author](#author) +* [Copyright & License](#copyright--license) +* [See Also](#see-also) + +Status +====== + +This module is production ready. + +Version +======= + +This document describes ngx_echo [v0.62](https://github.com/openresty/echo-nginx-module/tags) released on 2 July, 2020. + +Synopsis +======== + +```nginx + + location /hello { + echo "hello, world!"; + } +``` + +```nginx + + location /hello { + echo -n "hello, "; + echo "world!"; + } +``` + +```nginx + + location /timed_hello { + echo_reset_timer; + echo hello world; + echo "'hello world' takes about $echo_timer_elapsed sec."; + echo hiya igor; + echo "'hiya igor' takes about $echo_timer_elapsed sec."; + } +``` + +```nginx + + location /echo_with_sleep { + echo hello; + echo_flush; # ensure the client can see previous output immediately + echo_sleep 2.5; # in sec + echo world; + } +``` + +```nginx + + # in the following example, accessing /echo yields + # hello + # world + # blah + # hiya + # igor + location /echo { + echo_before_body hello; + echo_before_body world; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + echo_after_body hiya; + echo_after_body igor; + } + location /echo/more { + echo blah; + } +``` + +```nginx + + # the output of /main might be + # hello + # world + # took 0.000 sec for total. + # and the whole request would take about 2 sec to complete. + location /main { + echo_reset_timer; + + # subrequests in parallel + echo_location_async /sub1; + echo_location_async /sub2; + + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } +``` + +```nginx + + # the output of /main might be + # hello + # world + # took 3.003 sec for total. + # and the whole request would take about 3 sec to complete. + location /main { + echo_reset_timer; + + # subrequests in series (chained by CPS) + echo_location /sub1; + echo_location /sub2; + + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } +``` + +```nginx + + # Accessing /dup gives + # ------ END ------ + location /dup { + echo_duplicate 3 "--"; + echo_duplicate 1 " END "; + echo_duplicate 3 "--"; + echo; + } +``` + +```nginx + + # /bighello will generate 1000,000,000 hello's. + location /bighello { + echo_duplicate 1000_000_000 'hello'; + } +``` + +```nginx + + # echo back the client request + location /echoback { + echo_duplicate 1 $echo_client_request_headers; + echo "\r"; + + echo_read_request_body; + + echo_request_body; + } +``` + +```nginx + + # GET /multi will yields + # querystring: foo=Foo + # method: POST + # body: hi + # content length: 2 + # /// + # querystring: bar=Bar + # method: PUT + # body: hello + # content length: 5 + # /// + location /multi { + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -b 'hello'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } +``` + +```nginx + + # GET /merge?/foo.js&/bar/blah.js&/yui/baz.js will merge the .js resources together + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } +``` + +```nginx + + # accessing /if?val=abc yields the "hit" output + # while /if?val=bcd yields "miss": + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } +``` + +[Back to TOC](#table-of-contents) + +Description +=========== + +This module wraps lots of Nginx internal APIs for streaming input and output, parallel/sequential subrequests, timers and sleeping, as well as various meta data accessing. + +Basically it provides various utilities that help testing and debugging of other modules by trivially emulating different kinds of faked subrequest locations. + +People will also find it useful in real-world applications that need to + +1. serve static contents directly from memory (loading from the Nginx config file). +1. wrap the upstream response with custom header and footer (kinda like the [addition module](http://nginx.org/en/docs/http/ngx_http_addition_module.html) but with contents read directly from the config file and Nginx variables). +1. merge contents of various "Nginx locations" (i.e., subrequests) together in a single main request (using [echo_location](#echo_location) and its friends). + +This is a special dual-role module that can *lazily* serve as a content handler or register itself as an output filter only upon demand. By default, this module does not do anything at all. + +Technically, this module has also demonstrated the following techniques that might be helpful for module writers: + +1. Issue parallel subrequests directly from content handler. +1. Issue chained subrequests directly from content handler, by passing continuation along the subrequest chain. +1. Issue subrequests with all HTTP 1.1 methods and even an optional faked HTTP request body. +1. Interact with the Nginx event model directly from content handler using custom events and timers, and resume the content handler back if necessary. +1. Dual-role module that can (lazily) serve as a content handler or an output filter or both. +1. Nginx config file variable creation and interpolation. +1. Streaming output control using output_chain, flush and its friends. +1. Read client request body from the content handler, and returns back (asynchronously) to the content handler after completion. +1. Use Perl-based declarative [test suite](#test-suite) to drive the development of Nginx C modules. + +[Back to TOC](#table-of-contents) + +Content Handler Directives +========================== + +Use of the following directives register this module to the current Nginx location as a content handler. If you want to use another module, like the [standard proxy module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html), as the content handler, use the [filter directives](#filter-directives) provided by this module. + +All the content handler directives can be mixed together in a single Nginx location and they're supposed to run sequentially just as in the Bash scripting language. + +Every content handler directive supports variable interpolation in its arguments (if any). + +The MIME type set by the [standard default_type directive](http://nginx.org/en/docs/http/ngx_http_core_module.html#default_type) is respected by this module, as in: + +```nginx + + location /hello { + default_type text/plain; + echo hello; + } +``` + +Then on the client side: + +```bash + + $ curl -I 'http://localhost/echo' + HTTP/1.1 200 OK + Server: nginx/0.8.20 + Date: Sat, 17 Oct 2009 03:40:19 GMT + Content-Type: text/plain + Connection: keep-alive +``` + +Since the [v0.22](#v022) release, all of the directives are allowed in the [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s [if](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if) directive block, for instance: + +```nginx + + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } +``` + +[Back to TOC](#table-of-contents) + +echo +---- +**syntax:** *echo \[options\] <string>...* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Sends arguments joined by spaces, along with a trailing newline, out to the client. + +Note that the data might be buffered by Nginx's underlying buffer. To force the output data flushed immediately, use the [echo_flush](#echo_flush) command just after `echo`, as in + +```nginx + + echo hello world; + echo_flush; +``` + +When no argument is specified, *echo* emits the trailing newline alone, just like the *echo* command in shell. + +Variables may appear in the arguments. An example is + +```nginx + + echo The current request uri is $request_uri; +``` + +where [$request_uri](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri) is a variable exposed by the [ngx_http_core_module](http://nginx.org/en/docs/http/ngx_http_core_module.html). + +This command can be used multiple times in a single location configuration, as in + +```nginx + + location /echo { + echo hello; + echo world; + } +``` + +The output on the client side looks like this + +```bash + + $ curl 'http://localhost/echo' + hello + world +``` + +Special characters like newlines (`\n`) and tabs (`\t`) can be escaped using C-style escaping sequences. But a notable exception is the dollar sign (`$`). As of Nginx 0.8.20, there's still no clean way to escape this character. (A work-around might be to use a `$echo_dollor` variable that is always evaluated to the constant `$` character. This feature will possibly be introduced in a future version of this module.) + +As of the echo [v0.28](#v028) release, one can suppress the trailing newline character in the output by using the `-n` option, as in + +```nginx + + location /echo { + echo -n "hello, "; + echo "world"; + } +``` + +Accessing `/echo` gives + +```bash + + $ curl 'http://localhost/echo' + hello, world +``` + +Leading `-n` in variable values won't take effect and will be emitted literally, as in + +```nginx + + location /echo { + set $opt -n; + echo $opt "hello,"; + echo "world"; + } +``` + +This gives the following output + +```bash + + $ curl 'http://localhost/echo' + -n hello, + world +``` + +One can output leading `-n` literals and other options using the special `--` option like this + +```nginx + + location /echo { + echo -- -n is an option; + } +``` + +which yields + +```bash + + $ curl 'http://localhost/echo' + -n is an option +``` + +Use this form when you want to output anything leading with a dash (`-`). + +[Back to TOC](#table-of-contents) + +echo_duplicate +-------------- +**syntax:** *echo_duplicate <count> <string>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Outputs duplication of a string indicated by the second argument, using the count specified in the first argument. + +For instance, + +```nginx + + location /dup { + echo_duplicate 3 "abc"; + } +``` + +will lead to the output of `"abcabcabc"`. + +Underscores are allowed in the count number, just like in Perl. For example, to emit 1000,000,000 instances of `"hello, world"`: + +```nginx + + location /many_hellos { + echo_duplicate 1000_000_000 "hello, world"; + } +``` + +The `count` argument could be zero, but not negative. The second `string` argument could be an empty string ("") likewise. + +Unlike the [echo](#echo) directive, no trailing newline is appended to the result. So it's possible to "abuse" this directive as a no-trailing-newline version of [echo](#echo) by using "count" 1, as in + +```nginx + + location /echo_art { + echo_duplicate 2 '---'; + echo_duplicate 1 ' END '; # we don't want a trailing newline here + echo_duplicate 2 '---'; + echo; # we want a trailing newline here... + } +``` + +You get + +```bash + ------ END ------ +``` + +But use of the `-n` option in [echo](#echo) is more appropriate for this purpose. + +This directive was first introduced in [version 0.11](#v011). + +[Back to TOC](#table-of-contents) + +echo_flush +---------- +**syntax:** *echo_flush* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Forces the data potentially buffered by underlying Nginx output filters to send immediately to the client side via socket. + +Note that techically the command just emits a ngx_buf_t object with `flush` slot set to 1, so certain weird third-party output filter module could still block it before it reaches Nginx's (last) write filter. + +This directive does not take any argument. + +Consider the following example: + +```nginx + + location /flush { + echo hello; + + echo_flush; + + echo_sleep 1; + echo world; + } +``` + +Then on the client side, using curl to access `/flush`, you'll see the "hello" line immediately, but only after 1 second, the last "world" line. Without calling `echo_flush` in the example above, you'll most likely see no output until 1 second is elapsed due to the internal buffering of Nginx. + +This directive will fail to flush the output buffer in case of subrequests get involved. Consider the following example: + +```nginx + + location /main { + echo_location_async /sub; + echo hello; + echo_flush; + } + location /sub { + echo_sleep 1; + } +``` + +Then the client won't see "hello" appear even if `echo_flush` has been executed before the subrequest to `/sub` has actually started executing. The outputs of `/main` that are sent *after* [echo_location_async](#echo_location_async) will be postponed and buffered firmly. + +This does *not* apply to outputs sent before the subrequest initiated. For a modified version of the example given above: + +```nginx + + location /main { + echo hello; + echo_flush; + echo_location_async /sub; + } + location /sub { + echo_sleep 1; + } +``` + +The client will immediately see "hello" before `/sub` enters sleeping. + +See also [echo](#echo), [echo_sleep](#echo_sleep), and [echo_location_async](#echo_location_async). + +[Back to TOC](#table-of-contents) + +echo_sleep +---------- +**syntax:** *echo_sleep <seconds>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Sleeps for the time period specified by the argument, which is in seconds. + +This operation is non-blocking on server side, so unlike the [echo_blocking_sleep](#echo_blocking_sleep) directive, it won't block the whole Nginx worker process. + +The period might takes three digits after the decimal point and must be greater than 0.001. + +An example is + +```nginx + + location /echo_after_sleep { + echo_sleep 1.234; + echo resumed!; + } +``` + +Behind the scene, it sets up a per-request "sleep" ngx_event_t object, and adds a timer using that custom event to the Nginx event model and just waits for a timeout on that event. Because the "sleep" event is per-request, this directive can work in parallel subrequests. + +[Back to TOC](#table-of-contents) + +echo_blocking_sleep +------------------- +**syntax:** *echo_blocking_sleep <seconds>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +This is a blocking version of the [echo_sleep](#echo_sleep) directive. + +See the documentation of [echo_sleep](#echo_sleep) for more detail. + +Behind the curtain, it calls the ngx_msleep macro provided by the Nginx core which maps to usleep on POSIX-compliant systems. + +Note that this directive will block the current Nginx worker process completely while being executed, so never use it in production environment. + +[Back to TOC](#table-of-contents) + +echo_reset_timer +---------------- +**syntax:** *echo_reset_timer* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Reset the timer begin time to *now*, i.e., the time when this command is executed during request. + +The timer begin time is default to the starting time of the current request and can be overridden by this directive, potentially multiple times in a single location. For example: + +```nginx + + location /timed_sleep { + echo_sleep 0.03; + echo "$echo_timer_elapsed sec elapsed."; + + echo_reset_timer; + + echo_sleep 0.02; + echo "$echo_timer_elapsed sec elapsed."; + } +``` + +The output on the client side might be + +```bash + + $ curl 'http://localhost/timed_sleep' + 0.032 sec elapsed. + 0.020 sec elapsed. +``` + +The actual figures you get on your side may vary a bit due to your system's current activities. + +Invocation of this directive will force the underlying Nginx timer to get updated to the current system time (regardless the timer resolution specified elsewhere in the config file). Furthermore, references of the [$echo_timer_elapsed](#echo_timer_elapsed) variable will also trigger timer update forcibly. + +See also [echo_sleep](#echo_sleep) and [$echo_timer_elapsed](#echo_timer_elapsed). + +[Back to TOC](#table-of-contents) + +echo_read_request_body +---------------------- +**syntax:** *echo_read_request_body* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Explicitly reads request body so that the [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) variable will always have non-empty values (unless the body is so big that it has been saved by Nginx to a local temporary file). + +Note that this might not be the original client request body because the current request might be a subrequest with a "artificial" body specified by its parent. + +This directive does not generate any output itself, just like [echo_sleep](#echo_sleep). + +Here's an example for echo'ing back the original HTTP client request (both headers and body are included): + +```nginx + + location /echoback { + echo_duplicate 1 $echo_client_request_headers; + echo "\r"; + echo_read_request_body; + echo $request_body; + } +``` + +The content of `/echoback` looks like this on my side (I was using Perl's LWP utility to access this location on the server): + +```bash + + $ (echo hello; echo world) | lwp-request -m POST 'http://localhost/echoback' + POST /echoback HTTP/1.1 + TE: deflate,gzip;q=0.3 + Connection: TE, close + Host: localhost + User-Agent: lwp-request/5.818 libwww-perl/5.820 + Content-Length: 12 + Content-Type: application/x-www-form-urlencoded + + hello + world +``` + +Because `/echoback` is the main request, [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) holds the original client request body. + +Before Nginx 0.7.56, it makes no sense to use this directive because [$request_body](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_body) was first introduced in Nginx 0.7.58. + +This directive itself was first introduced in the echo module's [v0.14 release](#v014). + +[Back to TOC](#table-of-contents) + +echo_location_async +------------------- +**syntax:** *echo_location_async <location> [<url_args>]* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Issue GET subrequest to the location specified (first argument) with optional url arguments specified in the second argument. + +As of Nginx 0.8.20, the `location` argument does *not* support named location, due to a limitation in the `ngx_http_subrequest` function. The same is true for its brother, the [echo_location](#echo_location) directive. + +A very simple example is + +```nginx + + location /main { + echo_location_async /sub; + echo world; + } + location /sub { + echo hello; + } +``` + +Accessing `/main` gets + +```bash + + hello + world +``` + +Calling multiple locations in parallel is also possible: + +```nginx + + location /main { + echo_reset_timer; + echo_location_async /sub1; + echo_location_async /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; # sleeps 2 sec + echo hello; + } + location /sub2 { + echo_sleep 1; # sleeps 1 sec + echo world; + } +``` + +Accessing `/main` yields + +```bash + + $ time curl 'http://localhost/main' + hello + world + took 0.000 sec for total. + + real 0m2.006s + user 0m0.000s + sys 0m0.004s +``` + +You can see that the main handler `/main` does *not* wait the subrequests `/sub1` and `/sub2` to complete and quickly goes on, hence the "0.000 sec" timing result. The whole request, however takes approximately 2 sec in total to complete because `/sub1` and `/sub2` run in parallel (or "concurrently" to be more accurate). + +If you use [echo_blocking_sleep](#echo_blocking_sleep) in the previous example instead, then you'll get the same output, but with 3 sec total response time, because "blocking sleep" blocks the whole Nginx worker process. + +Locations can also take an optional querystring argument, for instance + +```nginx + + location /main { + echo_location_async /sub 'foo=Foo&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +``` + +Accessing `/main` yields + +```bash + + $ curl 'http://localhost/main' + Foo Bar +``` + +Querystrings is *not* allowed to be concatenated onto the `location` argument with "?" directly, for example, `/sub?foo=Foo&bar=Bar` is an invalid location, and shouldn't be fed as the first argument to this directive. + +Technically speaking, this directive is an example that Nginx content handler issues one or more subrequests directly. AFAIK, the [fancyindex module](https://connectical.com/projects/ngx-fancyindex/wiki) also does such kind of things ;) + +Nginx named locations like `@foo` is *not* supported here. + +This directive is logically equivalent to the GET version of [echo_subrequest_async](#echo_subrequest_async). For example, + +```nginx + + echo_location_async /foo 'bar=Bar'; +``` + +is logically equivalent to + +```nginx + + echo_subrequest_async GET /foo -q 'bar=Bar'; +``` + +But calling this directive is slightly faster than calling [echo_subrequest_async](#echo_subrequest_async) using `GET` because we don't have to parse the HTTP method names like `GET` and options like `-q`. + +This directive is first introduced in [version 0.09](#v009) of this module and requires at least Nginx 0.7.46. + +[Back to TOC](#table-of-contents) + +echo_location +------------- +**syntax:** *echo_location <location> [<url_args>]* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Just like the [echo_location_async](#echo_location_async) directive, but `echo_location` issues subrequests *in series* rather than in parallel. That is, the content handler directives following this directive won't be executed until the subrequest issued by this directive completes. + +The final response body is almost always equivalent to the case when [echo_location_async](#echo_location_async) is used instead, only if timing variables is used in the outputs. + +Consider the following example: + +```nginx + + location /main { + echo_reset_timer; + echo_location /sub1; + echo_location /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 2; + echo hello; + } + location /sub2 { + echo_sleep 1; + echo world; + } +``` + +The location `/main` above will take for total 3 sec to complete (compared to 2 sec if [echo_location_async](#echo_location_async) is used instead here). Here's the result in action on my machine: + +```bash + + $ curl 'http://localhost/main' + hello + world + took 3.003 sec for total. + + real 0m3.027s + user 0m0.020s + sys 0m0.004s +``` + +This directive is logically equivalent to the GET version of [echo_subrequest](#echo_subrequest). For example, + +```nginx + + echo_location /foo 'bar=Bar'; +``` + +is logically equivalent to + +```nginx + + echo_subrequest GET /foo -q 'bar=Bar'; +``` + +But calling this directive is slightly faster than calling [echo_subrequest](#echo_subrequest) using `GET` because we don't have to parse the HTTP method names like `GET` and options like `-q`. + +Behind the scene, it creates an `ngx_http_post_subrequest_t` object as a *continuation* and passes it into the `ngx_http_subrequest` function call. Nginx will later reopen this "continuation" in the subrequest's `ngx_http_finalize_request` function call. We resumes the execution of the parent-request's content handler and starts to run the next directive (command) if any. + +Nginx named locations like `@foo` is *not* supported here. + +This directive was first introduced in the [release v0.12](#v012). + +See also [echo_location_async](#echo_location_async) for more details about the meaning of the arguments. + +[Back to TOC](#table-of-contents) + +echo_subrequest_async +--------------------- +**syntax:** *echo_subrequest_async <HTTP_method> <location> [-q <url_args>] [-b <request_body>] [-f <request_body_path>]* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Initiate an asynchronous subrequest using HTTP method, an optional url arguments (or querystring) and an optional request body which can be defined as a string or as a path to a file which contains the body. + +This directive is very much like a generalized version of the [echo_location_async](#echo_location_async) directive. + +Here's a small example demonstrating its usage: + +```nginx + + location /multi { + # body defined as string + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + # body defined as path to a file, relative to nginx prefix path if not absolute + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -f '/tmp/hello.txt'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } +``` + +Then on the client side: + +```bash + + $ echo -n hello > /tmp/hello.txt + $ curl 'http://localhost/multi' + querystring: foo=Foo + method: POST + body: hi + content length: 2 + /// + querystring: bar=Bar + method: PUT + body: hello + content length: 5 + /// +``` + +Here's more funny example using the standard [proxy module](#httpproxymodule) to handle the subrequest: + +```nginx + + location /main { + echo_subrequest_async POST /sub -b 'hello, world'; + } + location /sub { + proxy_pass $scheme://127.0.0.1:$server_port/proxied; + } + location /proxied { + echo "method: $echo_request_method."; + + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo_read_request_body; + + echo "body: $echo_request_body."; + } +``` + +Then on the client side, we can see that + +```bash + + $ curl 'http://localhost/main' + method: POST. + body: hello, world. +``` + +Nginx named locations like `@foo` is *not* supported here. + +This directive takes several options: + + + -q Specify the URL arguments (or URL querystring) for the subrequest. + + -f Specify the path for the file whose content will be serve as the + subrequest's request body. + + -b Specify the request body data + + +This directive was first introduced in the [release v0.15](#v015). + +The `-f` option to define a file path for the body was introduced in the [release v0.35](#v035). + +See also the [echo_subrequest](#echo_subrequest) and [echo_location_async](#echo_location_async) directives. + +[Back to TOC](#table-of-contents) + +echo_subrequest +--------------- +**syntax:** *echo_subrequest <HTTP_method> <location> [-q <url_args>] [-b <request_body>] [-f <request_body_path>]* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +This is the synchronous version of the [echo_subrequest_async](#echo_subrequest_async) directive. And just like [echo_location](#echo_location), it does not block the Nginx worker process (while [echo_blocking_sleep](#echo_blocking_sleep) does), rather, it uses continuation to pass control along the subrequest chain. + +See [echo_subrequest_async](#echo_subrequest_async) for more details. + +Nginx named locations like `@foo` is *not* supported here. + +This directive was first introduced in the [release v0.15](#v015). + +[Back to TOC](#table-of-contents) + +echo_foreach_split +------------------ +**syntax:** *echo_foreach_split <delimiter> <string>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Split the second argument `string` using the delimiter specified in the first argument, and then iterate through the resulting items. For instance: + +```nginx + + location /loop { + echo_foreach_split ',' $arg_list; + echo "item: $echo_it"; + echo_end; + } +``` + +Accessing /main yields + +```bash + + $ curl 'http://localhost/loop?list=cat,dog,mouse' + item: cat + item: dog + item: mouse +``` + +As seen in the previous example, this directive should always be accompanied by an [echo_end](#echo_end) directive. + +Parallel `echo_foreach_split` loops are allowed, but nested ones are currently forbidden. + +The `delimiter` argument could contain *multiple* arbitrary characters, like + +```nginx + + # this outputs "cat\ndog\nmouse\n" + echo_foreach_split -- '-a-' 'cat-a-dog-a-mouse'; + echo $echo_it; + echo_end; +``` + +Logically speaking, this looping structure is just the `foreach` loop combined with a `split` function call in Perl (using the previous example): + +```perl + + foreach (split ',', $arg_list) { + print "item $_\n"; + } +``` + +People will also find it useful in merging multiple `.js` or `.css` resources into a whole. Here's an example: + +```nginx + + location /merge { + default_type 'text/javascript'; + + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } +``` + +Then accessing /merge to merge the `.js` resources specified in the query string: + +```bash + + $ curl 'http://localhost/merge?/foo/bar.js&/yui/blah.js&/baz.js' +``` + +One can also use third-party Nginx cache module to cache the merged response generated by the `/merge` location in the previous example. + +This directive was first introduced in the [release v0.17](#v017). + +[Back to TOC](#table-of-contents) + +echo_end +-------- +**syntax:** *echo_end* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +This directive is used to terminate the body of looping and conditional control structures like [echo_foreach_split](#echo_foreach_split). + +This directive was first introduced in the [release v0.17](#v017). + +[Back to TOC](#table-of-contents) + +echo_request_body +----------------- +**syntax:** *echo_request_body* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Outputs the contents of the request body previous read. + +Behind the scene, it's implemented roughly like this: + +```C + + if (r->request_body && r->request_body->bufs) { + return ngx_http_output_filter(r, r->request_body->bufs); + } +``` + +Unlike the [$echo_request_body](#echo_request_body) and $request_body variables, this directive will show the whole request body even if some parts or all parts of it are saved in temporary files on the disk. + +It is a "no-op" if no request body has been read yet. + +This directive was first introduced in the [release v0.18](#v018). + +See also [echo_read_request_body](#echo_read_request_body) and the [chunkin module](http://github.com/agentzh/chunkin-nginx-module). + +[Back to TOC](#table-of-contents) + +echo_exec +--------- +**syntax:** *echo_exec <location> [<query_string>]* + +**syntax:** *echo_exec <named_location>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *content* + +Does an internal redirect to the location specified. An optional query string can be specified for normal locations, as in + +```nginx + + location /foo { + echo_exec /bar weight=5; + } + location /bar { + echo $arg_weight; + } +``` + +Or equivalently + +```nginx + + location /foo { + echo_exec /bar?weight=5; + } + location /bar { + echo $arg_weight; + } +``` + +Named locations are also supported. Here's an example: + +```nginx + + location /foo { + echo_exec @bar; + } + location @bar { + # you'll get /foo rather than @bar + # due to a potential bug in nginx. + echo $echo_request_uri; + } +``` + +But query string (if any) will always be ignored for named location redirects due to a limitation in the `ngx_http_named_location` function. + +Never try to echo things before the `echo_exec` directive or you won't see the proper response of the location you want to redirect to. Because any echoing will cause the original location handler to send HTTP headers before the redirection happens. + +Technically speaking, this directive exposes the Nginx internal API functions `ngx_http_internal_redirect` and `ngx_http_named_location`. + +This directive was first introduced in the [v0.21 release](#v021). + +[Back to TOC](#table-of-contents) + +echo_status +----------- +**syntax:** *echo_status <status-num>* + +**default:** *echo_status 200* + +**context:** *location, location if* + +**phase:** *content* + +Specify the default response status code. Default to `200`. This directive is declarative and the relative order with other echo-like directives is not important. + +Here is an example, + +```nginx + + location = /bad { + echo_status 404; + echo "Something is missing..."; + } +``` + +then we get a response like this: + + + HTTP/1.1 404 Not Found + Server: nginx/1.2.1 + Date: Sun, 24 Jun 2012 03:58:18 GMT + Content-Type: text/plain + Transfer-Encoding: chunked + Connection: keep-alive + + Something is missing... + + +This directive was first introduced in the `v0.40` release. + +[Back to TOC](#table-of-contents) + +Filter Directives +================= + +Use of the following directives trigger the filter registration of this module. By default, no filter will be registered by this module. + +Every filter directive supports variable interpolation in its arguments (if any). + +[Back to TOC](#table-of-contents) + +echo_before_body +---------------- +**syntax:** *echo_before_body \[options\] \[argument\]...* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *output filter* + +It's the filter version of the [echo](#echo) directive, and prepends its output to the beginning of the original outputs generated by the underlying content handler. + +An example is + +```nginx + + location /echo { + echo_before_body hello; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + } + location /echo/more { + echo world + } +``` + +Accessing `/echo` from the client side yields + +```bash + + hello + world +``` + +In the previous sample, we borrow the [standard proxy module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html) to serve as the underlying content handler that generates the "main contents". + +Multiple instances of this filter directive are also allowed, as in: + +```nginx + + location /echo { + echo_before_body hello; + echo_before_body world; + echo !; + } +``` + +On the client side, the output is like + +```bash + + $ curl 'http://localhost/echo' + hello + world + ! +``` + +In this example, we also use the [content handler directives](#content-handler-directives) provided by this module as the underlying content handler. + +This directive also supports the `-n` and `--` options like the [echo](#echo) directive. + +This directive can be mixed with its brother directive [echo_after_body](#echo_after_body). + +[Back to TOC](#table-of-contents) + +echo_after_body +--------------- +**syntax:** *echo_after_body \[argument\]...* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *output filter* + +It's very much like the [echo_before_body](#echo_before_body) directive, but *appends* its output to the end of the original outputs generated by the underlying content handler. + +Here's a simple example: + +```nginx + + location /echo { + echo_after_body hello; + proxy_pass http://127.0.0.1:$server_port$request_uri/more; + } + location /echo/more { + echo world + } +``` + +Accessing `/echo` from the client side yields + + + world + hello + + +Multiple instances are allowed, as in: + +```nginx + + location /echo { + echo_after_body hello; + echo_after_body world; + echo i; + echo say; + } +``` + +The output on the client side while accessing the `/echo` location looks like + + + i + say + hello + world + + +This directive also supports the `-n` and `--` options like the [echo](#echo) directive. + +This directive can be mixed with its brother directive [echo_before_body](#echo_before_body). + +[Back to TOC](#table-of-contents) + +Variables +========= + +[Back to TOC](#table-of-contents) + +$echo_it +-------- + +This is a "topic variable" used by [echo_foreach_split](#echo_foreach_split), just like the `$_` variable in Perl. + +[Back to TOC](#table-of-contents) + +$echo_timer_elapsed +------------------- + +This variable holds the seconds elapsed since the start of the current request (might be a subrequest though) or the last invocation of the [echo_reset_timer](#echo_reset_timer) command. + +The timing result takes three digits after the decimal point. + +References of this variable will force the underlying Nginx timer to update to the current system time, regardless the timer resolution settings elsewhere in the config file, just like the [echo_reset_timer](#echo_reset_timer) directive. + +[Back to TOC](#table-of-contents) + +$echo_request_body +------------------ + +Evaluates to the current (sub)request's request body previously read if no part of the body has been saved to a temporary file. To always show the request body even if it's very large, use the [echo_request_body](#echo_request_body) directive. + +[Back to TOC](#table-of-contents) + +$echo_request_method +-------------------- + +Evaluates to the HTTP request method of the current request (it can be a subrequest). + +Behind the scene, it just takes the string data stored in `r->method_name`. + +Compare it to the [$echo_client_request_method](#echo_client_request_method) variable. + +At least for Nginx 0.8.20 and older, the [$request_method](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_method) variable provided by the [http core module](http://nginx.org/en/docs/http/ngx_http_core_module.html) is actually doing what our [$echo_client_request_method](#echo_client_request_method) is doing. + +This variable was first introduced in our [v0.15 release](#v015). + +[Back to TOC](#table-of-contents) + +$echo_client_request_method +--------------------------- + +Always evaluates to the main request's HTTP method even if the current request is a subrequest. + +Behind the scene, it just takes the string data stored in `r->main->method_name`. + +Compare it to the [$echo_request_method](#echo_request_method) variable. + +This variable was first introduced in our [v0.15 release](#v015). + +[Back to TOC](#table-of-contents) + +$echo_client_request_headers +---------------------------- + +Evaluates to the original client request's headers. + +Just as the name suggests, it will always take the main request (or the client request) even if it's currently executed in a subrequest. + +A simple example is below: + +```nginx + + location /echoback { + echo "headers are:" + echo $echo_client_request_headers; + } +``` + +Accessing `/echoback` yields + +```bash + + $ curl 'http://localhost/echoback' + headers are + GET /echoback HTTP/1.1 + User-Agent: curl/7.18.2 (i486-pc-linux-gnu) libcurl/7.18.2 OpenSSL/0.9.8g + Host: localhost:1984 + Accept: */* +``` + +Behind the scene, it recovers `r->main->header_in` (or the large header buffers, if any) on the C level and does not construct the headers itself by traversing parsed results in the request object. + +This varible is always evaluated to an empty value in HTTP/2 requests for now due to the current implementation. + +This variable was first introduced in [version 0.15](#v015). + +[Back to TOC](#table-of-contents) + +$echo_cacheable_request_uri +--------------------------- + +Evaluates to the parsed form of the URI (usually led by `/`) of the current (sub-)request. Unlike the [$echo_request_uri](#echo_request_uri) variable, it is cacheable. + +See [$echo_request_uri](#echo_request_uri) for more details. + +This variable was first introduced in [version 0.17](#v017). + +[Back to TOC](#table-of-contents) + +$echo_request_uri +----------------- + +Evaluates to the parsed form of the URI (usually led by `/`) of the current (sub-)request. Unlike the [$echo_cacheable_request_uri](#echo_cacheable_request_uri) variable, it is *not* cacheable. + +This is quite different from the [$request_uri](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_request_uri) variable exported by the [ngx_http_core_module](http://nginx.org/en/docs/http/ngx_http_core_module.html), because `$request_uri` is the *unparsed* form of the current request's URI. + +This variable was first introduced in [version 0.17](#v017). + +[Back to TOC](#table-of-contents) + +$echo_incr +---------- + +It is a counter that always generate the current counting number, starting from 1. The counter is always associated with the main request even if it is accessed within a subrequest. + +Consider the following example + +```Nginx + + location /main { + echo "main pre: $echo_incr"; + echo_location_async /sub; + echo_location_async /sub; + echo "main post: $echo_incr"; + } + location /sub { + echo "sub: $echo_incr"; + } +``` + +Accessing `/main` yields + + main pre: 1 + sub: 3 + sub: 4 + main post: 2 + +This directive was first introduced in the [v0.18 release](#v018). + +[Back to TOC](#table-of-contents) + +$echo_response_status +--------------------- + +Evaluates to the status code of the current (sub)request, null if not any. + +Behind the scene, it's just the textual representation of `r->headers_out->status`. + +This directive was first introduced in the [v0.23 release](#v023). + +[Back to TOC](#table-of-contents) + +Installation +============ + +You're recommended to install this module (as well as the Nginx core and many other goodies) via the [OpenResty bundle](http://openresty.org). See [the detailed instructions](http://openresty.org/#Installation) for downloading and installing OpenResty into your system. This is the easiest and most safe way to set things up. + +Alternatively, you can install this module manually with the Nginx source: + +Grab the nginx source code from [nginx.org](http://nginx.org/), for example, +the version 1.11.2 (see [nginx compatibility](#compatibility)), and then build the source with this module: + +```bash + + $ wget 'http://nginx.org/download/nginx-1.11.2.tar.gz' + $ tar -xzvf nginx-1.11.2.tar.gz + $ cd nginx-1.11.2/ + + # Here we assume you would install you nginx under /opt/nginx/. + $ ./configure --prefix=/opt/nginx \ + --add-module=/path/to/echo-nginx-module + + $ make -j2 + $ make install +``` + +Download the latest version of the release tarball of this module from [echo-nginx-module file list](https://github.com/openresty/echo-nginx-module/tags). + +Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the +`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) +directive, for example, + +```nginx +load_module /path/to/modules/ngx_http_echo_module.so; +``` + +Also, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org). + +[Back to TOC](#table-of-contents) + +Compatibility +============= + +The following versions of Nginx should work with this module: + +* **1.16.x** +* **1.15.x** (last tested: 1.15.8) +* **1.14.x** +* **1.13.x** (last tested: 1.13.6) +* **1.12.x** +* **1.11.x** (last tested: 1.11.2) +* **1.10.x** +* **1.9.x** (last tested: 1.9.15) +* **1.8.x** +* **1.7.x** (last tested: 1.7.10) +* **1.6.x** +* **1.5.x** (last tested: 1.5.12) +* **1.4.x** (last tested: 1.4.4) +* **1.3.x** (last tested: 1.3.7) +* **1.2.x** (last tested: 1.2.9) +* **1.1.x** (last tested: 1.1.5) +* **1.0.x** (last tested: 1.0.11) +* **0.9.x** (last tested: 0.9.4) +* **0.8.x** (last tested: 0.8.54) +* **0.7.x >= 0.7.21** (last tested: 0.7.68) + +In particular, + +* the directive [echo_location_async](#echo_location_async) and its brother [echo_subrequest_async](#echo_subrequest_async) do *not* work with **0.7.x < 0.7.46**. +* the [echo_after_body](#echo_after_body) directive does *not* work at all with nginx **< 0.8.7**. +* the [echo_sleep](#echo_sleep) directive cannot be used after [echo_location](#echo_location) or [echo_subrequest](#echo_subrequest) for nginx **< 0.8.11**. + +Earlier versions of Nginx like 0.6.x and 0.5.x will *not* work at all. + +If you find that any particular version of Nginx above 0.7.21 does not work with this module, please consider [reporting a bug](#report-bugs). + +[Back to TOC](#table-of-contents) + +Modules that use this module for testing +======================================== + +The following modules take advantage of this `echo` module in their test suite: + +* The [memc](http://github.com/openresty/memc-nginx-module) module that supports almost the whole memcached TCP protocol. +* The [chunkin](http://github.com/agentzh/chunkin-nginx-module) module that adds HTTP 1.1 chunked input support to Nginx. +* The [headers_more](http://github.com/openresty/headers-more-nginx-module) module that allows you to add, set, and clear input and output headers under the conditions that you specify. +* The `echo` module itself. + +Please mail me other modules that use `echo` in any form and I'll add them to the list above :) + +[Back to TOC](#table-of-contents) + +Community +========= + +[Back to TOC](#table-of-contents) + +English Mailing List +-------------------- + +The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers. + +[Back to TOC](#table-of-contents) + +Chinese Mailing List +-------------------- + +The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers. + +[Back to TOC](#table-of-contents) + +Report Bugs +=========== + +Although a lot of effort has been put into testing and code tuning, there must be some serious bugs lurking somewhere in this module. So whenever you are bitten by any quirks, please don't hesitate to + +1. create a ticket on the [issue tracking interface](https://github.com/openresty/echo-nginx-module/issues) provided by GitHub, +1. or send a bug report, questions, or even patches to the [OpenResty Community](#community). + +[Back to TOC](#table-of-contents) + +Source Repository +================= + +Available on github at [openresty/echo-nginx-module](https://github.com/openresty/echo-nginx-module). + +[Back to TOC](#table-of-contents) + +Changes +======= + +The changes of every release of this module can be obtained from the OpenResty bundle's change logs: + + + +[Back to TOC](#table-of-contents) + +Test Suite +========== + +This module comes with a Perl-driven test suite. The [test cases](https://github.com/openresty/echo-nginx-module/tree/master/t/) are +[declarative](https://github.com/openresty/echo-nginx-module/blob/master/t/echo.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. + +To run it on your side: + +```bash + + $ PATH=/path/to/your/nginx-with-echo-module:$PATH prove -r t +``` + +You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. + +Because a single nginx server (by default, `localhost:1984`) is used across all the test scripts (`.t` files), it's meaningless to run the test suite in parallel by specifying `-jN` when invoking the `prove` utility. + +Some parts of the test suite requires standard modules [proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html), [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) and [SSI](http://nginx.org/en/docs/http/ngx_http_ssi_module.html) to be enabled as well when building Nginx. + +[Back to TOC](#table-of-contents) + +TODO +==== + +* Fix the [echo_after_body](#echo_after_body) directive in subrequests. +* Add directives *echo_read_client_request_body* and *echo_request_headers*. +* Add new directive *echo_log* to use Nginx's logging facility directly from the config file and specific loglevel can be specified, as in + +```nginx + + echo_log debug "I am being called."; +``` + +* Add support for options `-h` and `-t` to [echo_subrequest_async](#echo_subrequest_async) and [echo_subrequest](#echo_subrequest). For example + +```nginx + + echo_subrequest POST /sub -q 'foo=Foo&bar=Bar' -b 'hello' -t 'text/plan' -h 'X-My-Header: blah blah' +``` + +* Add options to control whether a subrequest should inherit cached variables from its parent request (i.e. the current request that is calling the subrequest in question). Currently none of the subrequests issued by this module inherit the cached variables from the parent request. +* Add new variable *$echo_active_subrequests* to show `r->main->count - 1`. +* Add the *echo_file* and *echo_cached_file* directives. +* Add new varaible *$echo_request_headers* to accompany the existing [$echo_client_request_headers](#echo_client_request_headers) variable. +* Add new directive *echo_foreach*, as in + +```nginx + + echo_foreach 'cat' 'dog' 'mouse'; + echo_location_async "/animals/$echo_it"; + echo_end; +``` + +* Add new directive *echo_foreach_range*, as in + +```nginx + + echo_foreach_range '[1..100]' '[a-zA-z0-9]'; + echo_location_async "/item/$echo_it"; + echo_end; +``` + +* Add new directive *echo_repeat*, as in + +```nginx + + echo_repeat 10 $i { + echo "Page $i"; + echo_location "/path/to/page/$i"; + } +``` + +This is just another way of saying + +```nginx + + echo_foreach_range $i [1..10]; + echo "Page $i"; + echo_location "/path/to/page/$i"; + echo_end; +``` + +Thanks Marcus Clyne for providing this idea. + +* Add new variable $echo_random which always returns a random non-negative integer with the lower/upper limit specified by the new directives `echo_random_min` and `echo_random_max`. For example, + +```nginx + + echo_random_min 10 + echo_random_max 200 + echo "random number: $echo_random"; +``` + +Thanks Marcus Clyne for providing this idea. + +[Back to TOC](#table-of-contents) + +Getting involved +================ + +You'll be very welcomed to submit patches to the [author](#author) or just ask for a commit bit to the [source repository](#source-repository) on GitHub. + +[Back to TOC](#table-of-contents) + +Author +====== + +Yichun "agentzh" Zhang (章亦春) *<agentzh@gmail.com>*, OpenResty Inc. + +This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. + +[Back to TOC](#table-of-contents) + +Copyright & License +=================== + +Copyright (c) 2009-2018, Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. + +This module is licensed under the terms of the BSD license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[Back to TOC](#table-of-contents) + +See Also +======== + +* The original [blog post](http://agentzh.blogspot.com/2009/10/hacking-on-nginx-echo-module.html) about this module's initial development. +* The standard [addition filter module](http://nginx.org/en/docs/http/ngx_http_addition_module.html). +* The standard [proxy module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html). +* The [OpenResty](http://openresty.org) bundle. + +[Back to TOC](#table-of-contents) + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/config b/modules_deb/libnginx-mod-http-echo-0.63/config new file mode 100644 index 0000000..4bf0f00 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/config @@ -0,0 +1,63 @@ +ngx_addon_name=ngx_http_echo_module + +ECHO_SRCS=" \ + $ngx_addon_dir/src/ngx_http_echo_module.c \ + $ngx_addon_dir/src/ngx_http_echo_util.c \ + $ngx_addon_dir/src/ngx_http_echo_timer.c \ + $ngx_addon_dir/src/ngx_http_echo_var.c \ + $ngx_addon_dir/src/ngx_http_echo_handler.c \ + $ngx_addon_dir/src/ngx_http_echo_filter.c \ + $ngx_addon_dir/src/ngx_http_echo_sleep.c \ + $ngx_addon_dir/src/ngx_http_echo_location.c \ + $ngx_addon_dir/src/ngx_http_echo_echo.c \ + $ngx_addon_dir/src/ngx_http_echo_request_info.c \ + $ngx_addon_dir/src/ngx_http_echo_subrequest.c \ + $ngx_addon_dir/src/ngx_http_echo_foreach.c \ + " + +ECHO_DEPS=" \ + $ngx_addon_dir/src/ddebug.h \ + $ngx_addon_dir/src/ngx_http_echo_module.h \ + $ngx_addon_dir/src/ngx_http_echo_handler.h \ + $ngx_addon_dir/src/ngx_http_echo_util.h \ + $ngx_addon_dir/src/ngx_http_echo_sleep.h \ + $ngx_addon_dir/src/ngx_http_echo_filter.h \ + $ngx_addon_dir/src/ngx_http_echo_var.h \ + $ngx_addon_dir/src/ngx_http_echo_location.h \ + $ngx_addon_dir/src/ngx_http_echo_echo.h \ + $ngx_addon_dir/src/ngx_http_echo_request_info.h \ + $ngx_addon_dir/src/ngx_http_echo_subrequest.h \ + $ngx_addon_dir/src/ngx_http_echo_foreach.h \ + " + +# nginx 1.17.0+ unconditionally enables the postpone filter +if [ ! -z "$HTTP_POSTPONE" ]; then + # nginx won't have HTTP_POSTPONE_FILTER_MODULE & HTTP_POSTPONE_FILTER_SRCS + # defined since 1.9.11 + if [ -z "$HTTP_POSTPONE_FILTER_MODULE" ]; then + HTTP_POSTPONE_FILTER_MODULE=ngx_http_postpone_filter_module + HTTP_POSTPONE_FILTER_SRCS=src/http/ngx_http_postpone_filter_module.c + fi + + # This module depends upon the postpone filter being activated + if [ "$HTTP_POSTPONE" != YES ]; then + HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_POSTPONE_FILTER_MODULE" + HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS" + HTTP_POSTPONE=YES + fi +fi + +if [ -n "$ngx_module_link" ]; then + ngx_module_type=HTTP_AUX_FILTER + ngx_module_name=$ngx_addon_name + ngx_module_incs= + ngx_module_deps="$ECHO_DEPS" + ngx_module_srcs="$ECHO_SRCS" + ngx_module_libs= + + . auto/module +else + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ECHO_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ECHO_DEPS" +fi diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/changelog b/modules_deb/libnginx-mod-http-echo-0.63/debian/changelog new file mode 100644 index 0000000..1e6c923 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/changelog @@ -0,0 +1,53 @@ +libnginx-mod-http-echo (1:0.63-7) unstable; urgency=medium + + * d/control: update my email to janmojzis@debian.org + * d/copyright: update my email to janmojzis@debian.org + * d/control: bump Standards-Version: 4.7.2, no changes + * d/copyright: bump debian/* copyright year + * d/watch: use more generic template + + -- Jan Mojžíš Fri, 11 Apr 2025 14:26:58 +0200 + +libnginx-mod-http-echo (1:0.63-6) unstable; urgency=medium + + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + + -- Jan Mojžíš Sat, 07 Oct 2023 15:31:26 +0200 + +libnginx-mod-http-echo (1:0.63-5) unstable; urgency=medium + + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Tue, 27 Jun 2023 23:16:36 +0200 + +libnginx-mod-http-echo (1:0.63-4) unstable; urgency=medium + + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/gbb.conf: added + * d/copyright: bump my copyright year + * d/copyright: reformat text to be compatible with 'cme update dpkg-copyright' + * d/fix.scanned.copyright: added, fixes upstream author name parsing + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 15:03:42 +0100 + +libnginx-mod-http-echo (1:0.63-3) unstable; urgency=medium + + * No source change upload to unstable. + + -- Jan Mojžíš Fri, 09 Dec 2022 14:36:45 +0100 + +libnginx-mod-http-echo (1:0.63-2) experimental; urgency=medium + + * d/control: added Multi-Arch: foreign + * d/copyright: update, add Igor Sysoev + + -- Jan Mojžíš Mon, 05 Dec 2022 21:14:02 +0100 + +libnginx-mod-http-echo (1:0.63-1) experimental; urgency=medium + + * Initial release. (Closes: 1024153) + + -- Jan Mojžíš Wed, 30 Nov 2022 14:46:48 +0100 diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/control b/modules_deb/libnginx-mod-http-echo-0.63/debian/control new file mode 100644 index 0000000..e7cfde3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/control @@ -0,0 +1,36 @@ +Source: libnginx-mod-http-echo +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jan Mojžíš , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, +Standards-Version: 4.7.2 +Homepage: https://github.com/agentzh/echo-nginx-module +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-echo.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-echo +Rules-Requires-Root: no + +Package: libnginx-mod-http-echo +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: Bring echo and more shell style goodies to Nginx + Echo module wraps lots of Nginx internal APIs for streaming input and output, + parallel/sequential subrequests, timers and sleeping, as well as various meta + data accessing. + . + Basically it provides various utilities that help testing and debugging of + other modules by trivially emulating different kinds of faked subrequest + locations. + . + People will also find it useful in real-world applications that need to: + . + 1. Serve static contents directly from memory. + 2. Wrap the upstream response with custom header and footer (kinda like the + addition module but with contents read directly from the config file and + Nginx variables). + 3. Merge contents of various "Nginx locations" (i.e., subrequests) together in + a single main request (using echo_location and its friends). diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/copyright b/modules_deb/libnginx-mod-http-echo-0.63/debian/copyright new file mode 100644 index 0000000..061d047 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/copyright @@ -0,0 +1,71 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: echo-nginx-module +Upstream-Contact: Yichun "agentzh" Zhang +Source: https://github.com/agentzh/echo-nginx-module + +Files: * +Copyright: 2009-2018, Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. + 2009-2014, Yichun "agentzh" Zhang . +License: BSD-2-clause + +Files: README.markdown +Copyright: 2009-2018, Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. +License: BSD-2-clause + +Files: config +Copyright: 2009-2018, Yichun "agentzh" Zhang . +License: BSD-2-clause + +Files: debian/* +Copyright: 2022, Miao Wang + 2022-2025, Jan Mojzis +License: BSD-2-clause + +Files: src/* +Copyright: 2009-2018, Yichun "agentzh" Zhang . +License: BSD-2-clause + +Files: src/ngx_http_echo_handler.c + src/ngx_http_echo_module.c + src/ngx_http_echo_module.h + src/ngx_http_echo_request_info.c + src/ngx_http_echo_sleep.c + src/ngx_http_echo_subrequest.c + src/ngx_http_echo_util.c + src/ngx_http_echo_util.h +Copyright: Yichun Zhang (agentzh) +License: BSD-2-clause + +Files: t/* +Copyright: 2009-2018, Yichun "agentzh" Zhang . +License: BSD-2-clause + +Files: util/* +Copyright: 2009-2018, Yichun "agentzh" Zhang . +License: BSD-2-clause + +License: BSD-2-clause + All rights reserved. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/fix.scanned.copyright b/modules_deb/libnginx-mod-http-echo-0.63/debian/fix.scanned.copyright new file mode 100644 index 0000000..b25e244 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/fix.scanned.copyright @@ -0,0 +1,2 @@ +# fixes upstream author name parsing +! copyright Files:~/.*/ Copyright=~"s/(Zhang)\s\(.*x\{6625\}\)/$1\ (章亦春)/" diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/gbp.conf b/modules_deb/libnginx-mod-http-echo-0.63/debian/gbp.conf new file mode 100644 index 0000000..d9f01a6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/gbp.conf @@ -0,0 +1,9 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = False +sign-tags = True + +[import-orig] +merge-mode = replace diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/rules b/modules_deb/libnginx-mod-http-echo-0.63/debian/rules new file mode 100755 index 0000000..d8309f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/source/format b/modules_deb/libnginx-mod-http-echo-0.63/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/control b/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/control new file mode 100644 index 0000000..b95c6ff --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/control @@ -0,0 +1,13 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, + +Tests: helloworld +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/generic b/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/helloworld b/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/helloworld new file mode 100644 index 0000000..c66b2dc --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/tests/helloworld @@ -0,0 +1,32 @@ +#!/bin/sh +set -e + +cat < "/etc/nginx/sites-enabled/default" +server { + listen 80 default_server; + + location /helloworld { + echo "hello world"; + } +} +EOF + +exp="hello world +response_code: 200" + +nginx -t +invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; } + +out=`curl --fail -w "response_code: %{http_code}\n" http://127.0.0.1/helloworld` + +if [ x"${out}" != x"${exp}" ]; then + echo "output:" + echo "=====================" + echo "${out}" + echo "=====================" + echo "expected output:" + echo "=====================" + echo "${exp}" + echo "=====================" + exit 1 +fi diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/upstream/metadata b/modules_deb/libnginx-mod-http-echo-0.63/debian/upstream/metadata new file mode 100644 index 0000000..81ba6ec --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/agentzh/echo-nginx-module/issues +Bug-Submit: https://github.com/agentzh/echo-nginx-module/issues/new +Repository-Browse: https://github.com/agentzh/echo-nginx-module \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-echo-0.63/debian/watch b/modules_deb/libnginx-mod-http-echo-0.63/debian/watch new file mode 100644 index 0000000..55febdb --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/agentzh/echo-nginx-module/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h new file mode 100644 index 0000000..a92d7a7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ddebug.h @@ -0,0 +1,114 @@ +#ifndef DDEBUG_H +#define DDEBUG_H + +#include +#include +#include + +#if defined(DDEBUG) && (DDEBUG) + +# if (NGX_HAVE_VARIADIC_MACROS) + +# define dd(...) fprintf(stderr, "echo *** %s: ", __func__); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, " at %s line %d.\n", __FILE__, __LINE__) + +# else + +#include +#include + +#include + +static ngx_inline void +dd(const char * fmt, ...) { +} + +# endif + +# if DDEBUG > 1 + +# define dd_enter() dd_enter_helper(r, __func__) + +static ngx_inline void +dd_enter_helper(ngx_http_request_t *r, const char *func) { + ngx_http_posted_request_t *pr; + + fprintf(stderr, ">enter %s %.*s %.*s?%.*s c:%d m:%p r:%p ar:%p pr:%p", + func, + (int) r->method_name.len, r->method_name.data, + (int) r->uri.len, r->uri.data, + (int) r->args.len, r->args.data, + 0/*(int) r->main->count*/, r->main, + r, r->connection->data, r->parent); + + if (r->posted_requests) { + fprintf(stderr, " posted:"); + + for (pr = r->posted_requests; pr; pr = pr->next) { + fprintf(stderr, "%p,", pr); + } + } + + fprintf(stderr, "\n"); +} + +# else + +# define dd_enter() + +# endif + +#else + +# if (NGX_HAVE_VARIADIC_MACROS) + +# define dd(...) + +# define dd_enter() + +# else + +#include + +static ngx_inline void +dd(const char * fmt, ...) { +} + +static ngx_inline void +dd_enter() { +} + +# endif + +#endif + +#if defined(DDEBUG) && (DDEBUG) + +#define dd_check_read_event_handler(r) \ + dd("r->read_event_handler = %s", \ + r->read_event_handler == ngx_http_block_reading ? \ + "ngx_http_block_reading" : \ + r->read_event_handler == ngx_http_test_reading ? \ + "ngx_http_test_reading" : \ + r->read_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#define dd_check_write_event_handler(r) \ + dd("r->write_event_handler = %s", \ + r->write_event_handler == ngx_http_handler ? \ + "ngx_http_handler" : \ + r->write_event_handler == ngx_http_core_run_phases ? \ + "ngx_http_core_run_phases" : \ + r->write_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#else + +#define dd_check_read_event_handler(r) +#define dd_check_write_event_handler(r) + +#endif + +#endif /* DDEBUG_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c new file mode 100644 index 0000000..f5789f5 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.c @@ -0,0 +1,342 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_echo_echo.h" +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_filter.h" + +#include + +static ngx_buf_t ngx_http_echo_space_buf; + +static ngx_buf_t ngx_http_echo_newline_buf; + + +ngx_int_t +ngx_http_echo_echo_init(ngx_conf_t *cf) +{ + static u_char space_str[] = " "; + static u_char newline_str[] = "\n"; + + dd("global init..."); + + ngx_memzero(&ngx_http_echo_space_buf, sizeof(ngx_buf_t)); + + ngx_http_echo_space_buf.memory = 1; + + ngx_http_echo_space_buf.start = + ngx_http_echo_space_buf.pos = + space_str; + + ngx_http_echo_space_buf.end = + ngx_http_echo_space_buf.last = + space_str + sizeof(space_str) - 1; + + ngx_memzero(&ngx_http_echo_newline_buf, sizeof(ngx_buf_t)); + + ngx_http_echo_newline_buf.memory = 1; + + ngx_http_echo_newline_buf.start = + ngx_http_echo_newline_buf.pos = + newline_str; + + ngx_http_echo_newline_buf.end = + ngx_http_echo_newline_buf.last = + newline_str + sizeof(newline_str) - 1; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_echo_sync(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ + ngx_buf_t *buf; + ngx_chain_t *cl = NULL; /* the head of the chain link */ + + buf = ngx_calloc_buf(r->pool); + if (buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + buf->sync = 1; + + cl = ngx_alloc_chain_link(r->pool); + if (cl == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + cl->buf = buf; + cl->next = NULL; + + return ngx_http_echo_send_chain_link(r, ctx, cl); +} + + +ngx_int_t +ngx_http_echo_exec_echo(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args, + ngx_flag_t in_filter, ngx_array_t *opts) +{ + ngx_uint_t i; + + ngx_buf_t *space_buf; + ngx_buf_t *newline_buf; + ngx_buf_t *buf; + + ngx_str_t *computed_arg; + ngx_str_t *computed_arg_elts; + ngx_str_t *opt; + + ngx_chain_t *cl = NULL; /* the head of the chain link */ + ngx_chain_t **ll = &cl; /* always point to the address of the last link */ + + dd_enter(); + + if (computed_args == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + computed_arg_elts = computed_args->elts; + for (i = 0; i < computed_args->nelts; i++) { + computed_arg = &computed_arg_elts[i]; + + if (computed_arg->len == 0) { + buf = NULL; + + } else { + buf = ngx_calloc_buf(r->pool); + if (buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + buf->start = buf->pos = computed_arg->data; + buf->last = buf->end = computed_arg->data + + computed_arg->len; + + buf->memory = 1; + } + + if (cl == NULL) { + cl = ngx_alloc_chain_link(r->pool); + if (cl == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + cl->buf = buf; + cl->next = NULL; + ll = &cl->next; + + } else { + /* append a space first */ + *ll = ngx_alloc_chain_link(r->pool); + + if (*ll == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + space_buf = ngx_calloc_buf(r->pool); + + if (space_buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* nginx clears buf flags at the end of each request handling, + * so we have to make a clone here. */ + *space_buf = ngx_http_echo_space_buf; + + (*ll)->buf = space_buf; + (*ll)->next = NULL; + + ll = &(*ll)->next; + + /* then append the buf only if it's non-empty */ + if (buf) { + *ll = ngx_alloc_chain_link(r->pool); + if (*ll == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + (*ll)->buf = buf; + (*ll)->next = NULL; + + ll = &(*ll)->next; + } + } + } /* end for */ + + if (cl && cl->buf == NULL) { + cl = cl->next; + } + + if (opts && opts->nelts > 0) { + opt = opts->elts; + /* FIXME handle other unrecognized options here */ + if (opt[0].len == 1 && opt[0].data[0] == 'n') { + goto done; + } + } + + /* append the newline character */ + + newline_buf = ngx_calloc_buf(r->pool); + + if (newline_buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + *newline_buf = ngx_http_echo_newline_buf; + + if (cl == NULL) { + cl = ngx_alloc_chain_link(r->pool); + + if (cl == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + cl->buf = newline_buf; + cl->next = NULL; + /* ll = &cl->next; */ + + } else { + *ll = ngx_alloc_chain_link(r->pool); + + if (*ll == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + (*ll)->buf = newline_buf; + (*ll)->next = NULL; + /* ll = &(*ll)->next; */ + } + +done: + + if (cl == NULL || cl->buf == NULL) { + return NGX_OK; + } + + if (in_filter) { + return ngx_http_echo_next_body_filter(r, cl); + } + + return ngx_http_echo_send_chain_link(r, ctx, cl); +} + + +ngx_int_t +ngx_http_echo_exec_echo_flush(ngx_http_request_t *r, ngx_http_echo_ctx_t *ctx) +{ + return ngx_http_send_special(r, NGX_HTTP_FLUSH); +} + + +ngx_int_t +ngx_http_echo_exec_echo_request_body(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ + ngx_buf_t *b; + ngx_chain_t *out, *cl, **ll; + + if (r->request_body == NULL || r->request_body->bufs == NULL) { + return NGX_OK; + } + + out = NULL; + ll = &out; + + for (cl = r->request_body->bufs; cl; cl = cl->next) { + if (ngx_buf_special(cl->buf)) { + /* we do not want to create zero-size bufs */ + continue; + } + + *ll = ngx_alloc_chain_link(r->pool); + if (*ll == NULL) { + return NGX_ERROR; + } + + b = ngx_alloc_buf(r->pool); + if (b == NULL) { + return NGX_ERROR; + } + + (*ll)->buf = b; + (*ll)->next = NULL; + + ngx_memcpy(b, cl->buf, sizeof(ngx_buf_t)); + b->tag = (ngx_buf_tag_t) &ngx_http_echo_exec_echo_request_body; + b->last_buf = 0; + b->last_in_chain = 0; + + ll = &(*ll)->next; + } + + if (out == NULL) { + return NGX_OK; + } + + return ngx_http_echo_send_chain_link(r, ctx, out); +} + + +ngx_int_t +ngx_http_echo_exec_echo_duplicate(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_str_t *computed_arg; + ngx_str_t *computed_arg_elts; + ssize_t i, count; + ngx_str_t *str; + u_char *p; + ngx_int_t rc; + ngx_buf_t *buf; + ngx_chain_t *cl; + + dd_enter(); + + computed_arg_elts = computed_args->elts; + + computed_arg = &computed_arg_elts[0]; + + count = ngx_http_echo_atosz(computed_arg->data, computed_arg->len); + + if (count == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "invalid size specified: \"%V\"", computed_arg); + + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + str = &computed_arg_elts[1]; + + if (count == 0 || str->len == 0) { + rc = ngx_http_echo_send_header_if_needed(r, ctx); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + return NGX_OK; + } + + buf = ngx_create_temp_buf(r->pool, count * str->len); + if (buf == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + p = buf->pos; + for (i = 0; i < count; i++) { + p = ngx_copy(p, str->data, str->len); + } + buf->last = p; + + cl = ngx_alloc_chain_link(r->pool); + if (cl == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + cl->next = NULL; + cl->buf = buf; + + return ngx_http_echo_send_chain_link(r, ctx, cl); +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.h new file mode 100644 index 0000000..896f1ed --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_echo.h @@ -0,0 +1,25 @@ +#ifndef ECHO_ECHO_H +#define ECHO_ECHO_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_echo_init(ngx_conf_t *cf); + +ngx_int_t ngx_http_echo_exec_echo_sync(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); + +ngx_int_t ngx_http_echo_exec_echo(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args, + ngx_flag_t in_filter, ngx_array_t *opts); + +ngx_int_t ngx_http_echo_exec_echo_request_body(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); + +ngx_int_t ngx_http_echo_exec_echo_flush(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); + +ngx_int_t ngx_http_echo_exec_echo_duplicate(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +#endif /* ECHO_ECHO_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.c new file mode 100644 index 0000000..689b52e --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.c @@ -0,0 +1,282 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_echo_filter.h" +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_echo.h" + +#include + + + +ngx_http_output_header_filter_pt ngx_http_echo_next_header_filter; + +ngx_http_output_body_filter_pt ngx_http_echo_next_body_filter; + +static ngx_int_t ngx_http_echo_header_filter(ngx_http_request_t *r); + +static ngx_int_t ngx_http_echo_body_filter(ngx_http_request_t *r, + ngx_chain_t *in); + +/* filter handlers */ +static ngx_int_t ngx_http_echo_exec_filter_cmds(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *cmds, ngx_uint_t *iterator); + + +static volatile ngx_cycle_t *ngx_http_echo_prev_cycle = NULL; + + +ngx_int_t +ngx_http_echo_filter_init(ngx_conf_t *cf) +{ + int multi_http_blocks; + ngx_http_echo_main_conf_t *emcf; + + emcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_echo_module); + + if (ngx_http_echo_prev_cycle != ngx_cycle) { + ngx_http_echo_prev_cycle = ngx_cycle; + multi_http_blocks = 0; + + } else { + multi_http_blocks = 1; + } + + if (multi_http_blocks || emcf->requires_filter) { + dd("top header filter: %ld", + (unsigned long) ngx_http_top_header_filter); + + ngx_http_echo_next_header_filter = ngx_http_top_header_filter; + ngx_http_top_header_filter = ngx_http_echo_header_filter; + + dd("top body filter: %ld", (unsigned long) ngx_http_top_body_filter); + + ngx_http_echo_next_body_filter = ngx_http_top_body_filter; + ngx_http_top_body_filter = ngx_http_echo_body_filter; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_echo_header_filter(ngx_http_request_t *r) +{ + ngx_http_echo_loc_conf_t *conf; + ngx_http_echo_ctx_t *ctx; + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo header filter, uri \"%V?%V\"", &r->uri, &r->args); + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + /* XXX we should add option to insert contents for responses + * of non-200 status code here... */ + /* + if (r->headers_out.status != NGX_HTTP_OK) { + if (ctx != NULL) { + ctx->skip_filter = 1; + } + return ngx_http_echo_next_header_filter(r); + } + */ + + conf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); + if (conf->before_body_cmds == NULL && conf->after_body_cmds == NULL) { + if (ctx != NULL) { + ctx->skip_filter = 1; + } + return ngx_http_echo_next_header_filter(r); + } + + if (ctx == NULL) { + ctx = ngx_http_echo_create_ctx(r); + if (ctx == NULL) { + return NGX_ERROR; + } + + ngx_http_set_ctx(r, ctx, ngx_http_echo_module); + } + + /* enable streaming here (use chunked encoding) */ + ngx_http_clear_content_length(r); + ngx_http_clear_accept_ranges(r); + + return ngx_http_echo_next_header_filter(r); +} + + +static ngx_int_t +ngx_http_echo_body_filter(ngx_http_request_t *r, ngx_chain_t *in) +{ + ngx_http_echo_ctx_t *ctx; + ngx_int_t rc; + ngx_http_echo_loc_conf_t *conf; + unsigned last; + ngx_chain_t *cl; + ngx_buf_t *b; + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo body filter, uri \"%V?%V\"", &r->uri, &r->args); + + if (in == NULL || r->header_only) { + return ngx_http_echo_next_body_filter(r, in); + } + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + if (ctx == NULL || ctx->skip_filter) { + return ngx_http_echo_next_body_filter(r, in); + } + + conf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); + + if (!ctx->before_body_sent) { + ctx->before_body_sent = 1; + + if (conf->before_body_cmds != NULL) { + rc = ngx_http_echo_exec_filter_cmds(r, ctx, conf->before_body_cmds, + &ctx->next_before_body_cmd); + if (rc != NGX_OK) { + return NGX_ERROR; + } + } + } + + if (conf->after_body_cmds == NULL) { + ctx->skip_filter = 1; + return ngx_http_echo_next_body_filter(r, in); + } + + last = 0; + + for (cl = in; cl; cl = cl->next) { + dd("cl %p, special %d", cl, ngx_buf_special(cl->buf)); + + if (cl->buf->last_buf || cl->buf->last_in_chain) { + cl->buf->last_buf = 0; + cl->buf->last_in_chain = 0; + cl->buf->sync = 1; + last = 1; + } + } + + dd("in %p, last %d", in, (int) last); + + if (in) { + rc = ngx_http_echo_next_body_filter(r, in); + +#if 0 + if (rc == NGX_AGAIN) { + return NGX_ERROR; + } +#endif + + dd("next filter returns %d, last %d", (int) rc, (int) last); + + if (rc == NGX_ERROR || rc > NGX_OK || !last) { + return rc; + } + } + + dd("exec filter cmds for after body cmds"); + + rc = ngx_http_echo_exec_filter_cmds(r, ctx, conf->after_body_cmds, + &ctx->next_after_body_cmd); + if (rc == NGX_ERROR || rc > NGX_OK) { + dd("FAILED: exec filter cmds for after body cmds"); + return NGX_ERROR; + } + + ctx->skip_filter = 1; + + dd("after body cmds executed...terminating..."); + + /* XXX we can NOT use + * ngx_http_send_special(r, NGX_HTTP_LAST) here + * because we should bypass the upstream filters. */ + + b = ngx_calloc_buf(r->pool); + if (b == NULL) { + return NGX_ERROR; + } + + if (r == r->main && !r->post_action) { + b->last_buf = 1; + + } else { + b->sync = 1; + b->last_in_chain = 1; + } + + cl = ngx_alloc_chain_link(r->pool); + if (cl == NULL) { + return NGX_ERROR; + } + + cl->next = NULL; + cl->buf = b; + + return ngx_http_echo_next_body_filter(r, cl); +} + + +static ngx_int_t +ngx_http_echo_exec_filter_cmds(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *cmds, ngx_uint_t *iterator) +{ + ngx_int_t rc; + ngx_array_t *opts = NULL; + ngx_array_t *computed_args = NULL; + ngx_http_echo_cmd_t *cmd; + ngx_http_echo_cmd_t *cmd_elts; + + for (cmd_elts = cmds->elts; *iterator < cmds->nelts; (*iterator)++) { + cmd = &cmd_elts[*iterator]; + + /* evaluate arguments for the current cmd (if any) */ + if (cmd->args) { + computed_args = ngx_array_create(r->pool, cmd->args->nelts, + sizeof(ngx_str_t)); + if (computed_args == NULL) { + return NGX_ERROR; + } + + opts = ngx_array_create(r->pool, 1, sizeof(ngx_str_t)); + if (opts == NULL) { + return NGX_ERROR; + } + + rc = ngx_http_echo_eval_cmd_args(r, cmd, computed_args, opts); + + if (rc != NGX_OK) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "Failed to evaluate arguments for " + "the directive."); + return rc; + } + } + + /* do command dispatch based on the opcode */ + switch (cmd->opcode) { + case echo_opcode_echo_before_body: + case echo_opcode_echo_after_body: + dd("exec echo_before_body or echo_after_body..."); + + rc = ngx_http_echo_exec_echo(r, ctx, computed_args, + 1 /* in filter */, opts); + + if (rc == NGX_ERROR || rc > NGX_OK) { + return rc; + } + + break; + default: + break; + } + } + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.h new file mode 100644 index 0000000..ea5115d --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_filter.h @@ -0,0 +1,15 @@ +#ifndef ECHO_FILTER_H +#define ECHO_FILTER_H + +#include "ngx_http_echo_module.h" + + +extern ngx_http_output_header_filter_pt ngx_http_echo_next_header_filter; + +extern ngx_http_output_body_filter_pt ngx_http_echo_next_body_filter; + + +ngx_int_t ngx_http_echo_filter_init (ngx_conf_t *cf); + +#endif /* ECHO_FILTER_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c new file mode 100644 index 0000000..a4a2b54 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.c @@ -0,0 +1,183 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_echo_foreach.h" +#include "ngx_http_echo_util.h" + +#include + + +ngx_int_t +ngx_http_echo_it_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + ngx_http_echo_ctx_t *ctx; + ngx_uint_t i; + ngx_array_t *choices; + ngx_str_t *choice_elts, *choice; + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + if (ctx && ctx->foreach != NULL) { + + choices = ctx->foreach->choices; + i = ctx->foreach->next_choice; + + if (i < choices->nelts) { + choice_elts = choices->elts; + choice = &choice_elts[i]; + + v->len = choice->len; + v->data = choice->data; + v->valid = 1; + v->no_cacheable = 1; + v->not_found = 0; + + return NGX_OK; + } + } + + v->not_found = 1; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_echo_foreach_split(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_http_echo_loc_conf_t *elcf; + ngx_str_t *delimiter, *compound; + u_char *pos, *last, *end; + ngx_str_t *choice; + ngx_str_t *computed_arg_elts; + ngx_array_t *cmds; + ngx_http_echo_cmd_t *cmd; + ngx_http_echo_cmd_t *cmd_elts; + + if (ctx->foreach != NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "Nested echo_foreach not supported yet."); + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + if (computed_args->nelts < 2) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "echo_foreach should take at least two arguments. " + "(if your delimiter starts with \"-\", preceding it " + "with a \"--\".)"); + + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + computed_arg_elts = computed_args->elts; + + compound = &computed_arg_elts[1]; + + dd("HEY coumpound len: %u", (int) compound->len); + + ctx->foreach = ngx_palloc(r->pool, sizeof(ngx_http_echo_foreach_ctx_t)); + + if (ctx->foreach == NULL) { + return NGX_ERROR; + } + + ctx->foreach->cmd_index = ctx->next_handler_cmd; + + ctx->foreach->next_choice = 0; + + ctx->foreach->choices = ngx_array_create(r->pool, 10, sizeof(ngx_str_t)); + if (ctx->foreach->choices == NULL) { + return NGX_ERROR; + } + + delimiter = &computed_arg_elts[0]; + + pos = compound->data; + end = compound->data + compound->len; + + while ((last = ngx_http_echo_strlstrn(pos, end, delimiter->data, + delimiter->len - 1)) != NULL) + { + dd("entered the loop"); + + if (last == pos) { + dd("!!! len == 0"); + pos = last + delimiter->len; + continue; + } + + choice = ngx_array_push(ctx->foreach->choices); + if (choice == NULL) { + return NGX_ERROR; + } + + choice->data = pos; + choice->len = last - pos; + pos = last + delimiter->len; + } + + if (pos < end) { + choice = ngx_array_push(ctx->foreach->choices); + if (choice == NULL) { + return NGX_ERROR; + } + + choice->data = pos; + choice->len = end - pos; + } + + if (ctx->foreach->choices->nelts == 0) { + /* skip the foreach body entirely */ + elcf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); + cmds = elcf->handler_cmds; + cmd_elts = cmds->elts; + for (/* void */; ctx->next_handler_cmd < cmds->nelts; + ctx->next_handler_cmd++) + { + cmd = &cmd_elts[ctx->next_handler_cmd + 1]; + if (cmd->opcode == echo_opcode_echo_end) { + return NGX_OK; + } + } + + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_echo_end(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ + if (ctx->foreach == NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "Found a echo_end that has no corresponding echo_foreach " + "before it."); + return NGX_ERROR; + } + + ctx->foreach->next_choice++; + + if (ctx->foreach->next_choice >= ctx->foreach->choices->nelts) { + /* TODO We need to explicitly free the foreach ctx from + * the pool */ + ctx->foreach = NULL; + + return NGX_OK; + } + + dd("echo_end: ++ next_choice (total: %u): %u", + (unsigned) ctx->foreach->choices->nelts, + (unsigned) ctx->foreach->next_choice); + + /* the main handler dispatcher loop will increment + * ctx->next_handler_cmd for us anyway. */ + ctx->next_handler_cmd = ctx->foreach->cmd_index; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.h new file mode 100644 index 0000000..49592f4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_foreach.h @@ -0,0 +1,16 @@ +#ifndef ECHO_FOREACH_H +#define ECHO_FOREACH_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_exec_echo_foreach_split(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +ngx_int_t ngx_http_echo_exec_echo_end(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); + +ngx_int_t ngx_http_echo_it_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +#endif /* ECHO_FOREACH_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c new file mode 100644 index 0000000..120c8b0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.c @@ -0,0 +1,433 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_echo_filter.h" +#include "ngx_http_echo_handler.h" +#include "ngx_http_echo_echo.h" +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_sleep.h" +#include "ngx_http_echo_var.h" +#include "ngx_http_echo_timer.h" +#include "ngx_http_echo_location.h" +#include "ngx_http_echo_subrequest.h" +#include "ngx_http_echo_request_info.h" +#include "ngx_http_echo_foreach.h" + +#include +#include + + +void +ngx_http_echo_wev_handler(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_http_echo_ctx_t *ctx; + + dd("wev handler"); + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + if (ctx == NULL) { + ngx_http_finalize_request(r, NGX_ERROR); + return; + } + + dd("waiting: %d, done: %d", (int) ctx->waiting, (int) ctx->done); + + if (ctx->waiting && ! ctx->done) { + + if (r == r->connection->data && r->postponed) { + + if (r->postponed->request) { + r->connection->data = r->postponed->request; + +#if defined(nginx_version) && nginx_version >= 8012 + ngx_http_post_request(r->postponed->request, NULL); +#else + ngx_http_post_request(r->postponed->request); +#endif + + } else { + ngx_http_echo_flush_postponed_outputs(r); + } + } + + return; + } + + ctx->done = 0; + + ctx->next_handler_cmd++; + + rc = ngx_http_echo_run_cmds(r); + + dd("rc: %d", (int) rc); + + if (rc == NGX_ERROR || rc == NGX_DONE) { + ngx_http_finalize_request(r, rc); + return; + } + + if (rc == NGX_AGAIN) { + dd("mark busy %d for %.*s", (int) ctx->next_handler_cmd, + (int) r->uri.len, + r->uri.data); + + ctx->waiting = 1; + ctx->done = 0; + + } else { + dd("mark ready %d", (int) ctx->next_handler_cmd); + ctx->waiting = 0; + ctx->done = 1; + + dd("finalizing with rc %d", (int) rc); + + dd("finalize request %.*s with %d", (int) r->uri.len, r->uri.data, + (int) rc); + + ngx_http_finalize_request(r, rc); + } +} + + +ngx_int_t +ngx_http_echo_handler(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_http_echo_ctx_t *ctx; + + dd("subrequest in memory: %d", (int) r->subrequest_in_memory); + + rc = ngx_http_echo_run_cmds(r); + + dd("run cmds returned %d", (int) rc); + + if (rc == NGX_ERROR + || rc == NGX_OK + || rc == NGX_DONE + || rc == NGX_DECLINED) + { + return rc; + } + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { + if (ctx && r->header_sent) { + return NGX_ERROR; + } + + return rc; + } + + /* rc == NGX_AGAIN */ + +#if defined(nginx_version) && nginx_version >= 8011 + r->main->count++; +#endif + + dd("%d", r->connection->destroyed); + dd("%d", r->done); + + if (ctx) { + dd("mark busy %d for %.*s", (int) ctx->next_handler_cmd, + (int) r->uri.len, + r->uri.data); + + ctx->waiting = 1; + ctx->done = 0; + } + + return NGX_DONE; +} + + +ngx_int_t +ngx_http_echo_run_cmds(ngx_http_request_t *r) +{ + ngx_http_echo_loc_conf_t *elcf; + ngx_http_echo_ctx_t *ctx; + ngx_int_t rc; + ngx_array_t *cmds; + ngx_array_t *computed_args = NULL; + ngx_http_echo_cmd_t *cmd; + ngx_http_echo_cmd_t *cmd_elts; + ngx_array_t *opts = NULL; + + elcf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); + cmds = elcf->handler_cmds; + if (cmds == NULL) { + return NGX_DECLINED; + } + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + if (ctx == NULL) { + ctx = ngx_http_echo_create_ctx(r); + if (ctx == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + ngx_http_set_ctx(r, ctx, ngx_http_echo_module); + } + + dd("exec handler: %.*s: %i", (int) r->uri.len, r->uri.data, + (int) ctx->next_handler_cmd); + + cmd_elts = cmds->elts; + + for (; ctx->next_handler_cmd < cmds->nelts; ctx->next_handler_cmd++) { + + cmd = &cmd_elts[ctx->next_handler_cmd]; + + /* evaluate arguments for the current cmd (if any) */ + if (cmd->args) { + computed_args = ngx_array_create(r->pool, cmd->args->nelts, + sizeof(ngx_str_t)); + + if (computed_args == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + opts = ngx_array_create(r->pool, 1, sizeof(ngx_str_t)); + + if (opts == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + rc = ngx_http_echo_eval_cmd_args(r, cmd, computed_args, opts); + if (rc != NGX_OK) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "Failed to evaluate arguments for " + "the directive."); + return rc; + } + } + + if (computed_args == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + /* do command dispatch based on the opcode */ + + switch (cmd->opcode) { + + case echo_opcode_echo_sync: + rc = ngx_http_echo_exec_echo_sync(r, ctx); + break; + + case echo_opcode_echo: + /* XXX moved the following code to a separate + * function */ + dd("found echo opcode"); + rc = ngx_http_echo_exec_echo(r, ctx, computed_args, + 0 /* in filter */, opts); + break; + + case echo_opcode_echo_request_body: + rc = ngx_http_echo_exec_echo_request_body(r, ctx); + break; + + case echo_opcode_echo_location_async: + if (!r->request_body) { + /* we require reading the request body before doing + * subrequests */ + + ctx->next_handler_cmd--; /* re-run the current cmd */ + goto read_request_body; + } + + dd("found opcode echo location async..."); + rc = ngx_http_echo_exec_echo_location_async(r, ctx, + computed_args); + break; + + case echo_opcode_echo_location: + if (!r->request_body) { + /* we require reading the request body before doing + * subrequests */ + + ctx->next_handler_cmd--; /* re-run the current cmd */ + goto read_request_body; + } + + return ngx_http_echo_exec_echo_location(r, ctx, computed_args); + + case echo_opcode_echo_subrequest_async: + if (!r->request_body) { + /* we require reading the request body before doing + * subrequests */ + + ctx->next_handler_cmd--; /* re-run the current cmd */ + goto read_request_body; + } + + dd("found opcode echo subrequest async..."); + rc = ngx_http_echo_exec_echo_subrequest_async(r, ctx, + computed_args); + break; + + case echo_opcode_echo_subrequest: + if (!r->request_body) { + /* we require reading the request body before doing + * subrequests */ + + ctx->next_handler_cmd--; /* re-run the current cmd */ + goto read_request_body; + } + + return ngx_http_echo_exec_echo_subrequest(r, ctx, computed_args); + + case echo_opcode_echo_sleep: + return ngx_http_echo_exec_echo_sleep(r, ctx, computed_args); + + case echo_opcode_echo_flush: + rc = ngx_http_echo_exec_echo_flush(r, ctx); + break; + + case echo_opcode_echo_blocking_sleep: + rc = ngx_http_echo_exec_echo_blocking_sleep(r, ctx, + computed_args); + break; + + case echo_opcode_echo_reset_timer: + rc = ngx_http_echo_exec_echo_reset_timer(r, ctx); + break; + + case echo_opcode_echo_duplicate: + rc = ngx_http_echo_exec_echo_duplicate(r, ctx, computed_args); + break; + + case echo_opcode_echo_read_request_body: + +read_request_body: + + ctx->wait_read_request_body = 0; + + rc = ngx_http_echo_exec_echo_read_request_body(r, ctx); + + if (rc == NGX_ERROR) { + return NGX_ERROR; + } + + if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { +#if (nginx_version >= 8011 && nginx_version < 1002006) \ + || (nginx_version >= 1003000 && nginx_version < 1003009) + r->main->count--; +#endif + return rc; + } + +#if nginx_version >= 8011 + r->main->count--; +#endif + dd("read request body: %d", (int) rc); + + if (rc == NGX_OK) { + continue; + } + + /* rc == NGX_AGAIN */ + ctx->wait_read_request_body = 1; + return NGX_AGAIN; + + case echo_opcode_echo_foreach_split: + rc = ngx_http_echo_exec_echo_foreach_split(r, ctx, computed_args); + break; + + case echo_opcode_echo_end: + rc = ngx_http_echo_exec_echo_end(r, ctx); + break; + + case echo_opcode_echo_exec: + dd("echo_exec"); + return ngx_http_echo_exec_exec(r, ctx, computed_args); + + default: + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "unknown opcode: %d", cmd->opcode); + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { + return rc; + } + } + + rc = ngx_http_echo_send_chain_link(r, ctx, NULL /* indicate LAST */); + + if (rc == NGX_ERROR || rc >= NGX_HTTP_SPECIAL_RESPONSE) { + return rc; + } + + if (!r->request_body) { + if (ngx_http_discard_request_body(r) != NGX_OK) { + return NGX_ERROR; + } + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_post_subrequest(ngx_http_request_t *r, + void *data, ngx_int_t rc) +{ + ngx_http_echo_ctx_t *ctx = data; + ngx_http_request_t *pr; + ngx_http_echo_ctx_t *pr_ctx; + + dd("echo post_subrequest: %.*s", (int) r->uri.len, r->uri.data); + + if (ctx->run_post_subrequest) { + dd("already run post_subrequest: %p: %.*s", ctx, + (int) r->uri.len, r->uri.data); + + return rc; + } + + dd("setting run_post_subrequest to 1 for %p for %.*s", ctx, + (int) r->uri.len, r->uri.data); + + ctx->run_post_subrequest = 1; + + pr = r->parent; + + pr_ctx = ngx_http_get_module_ctx(pr, ngx_http_echo_module); + if (pr_ctx == NULL) { + return NGX_ERROR; + } + + dd("mark ready %d", (int) pr_ctx->next_handler_cmd); + + pr_ctx->waiting = 0; + pr_ctx->done = 1; + + pr->write_event_handler = ngx_http_echo_wev_handler; + + /* work-around issues in nginx's event module */ + + if (r != r->connection->data + && r->postponed + && (r->main->posted_requests == NULL + || r->main->posted_requests->request != pr)) + { +#if defined(nginx_version) && nginx_version >= 8012 + ngx_http_post_request(pr, NULL); +#else + ngx_http_post_request(pr); +#endif + } + + return rc; +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.h new file mode 100644 index 0000000..afc0666 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_handler.h @@ -0,0 +1,18 @@ +#ifndef ECHO_HANDLER_H +#define ECHO_HANDLER_H + +#include "ngx_http_echo_module.h" + + +void ngx_http_echo_wev_handler(ngx_http_request_t *r); + +ngx_int_t ngx_http_echo_handler(ngx_http_request_t *r); + +ngx_int_t ngx_http_echo_run_cmds(ngx_http_request_t *r); + +ngx_int_t ngx_http_echo_post_subrequest(ngx_http_request_t *r, + void *data, ngx_int_t rc); + + +#endif /* ECHO_HANDLER_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c new file mode 100644 index 0000000..820e504 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.c @@ -0,0 +1,182 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_location.h" +#include "ngx_http_echo_handler.h" + +#include + + +static ngx_int_t ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr); + + +ngx_int_t +ngx_http_echo_exec_echo_location_async(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_int_t rc; + ngx_http_request_t *sr; /* subrequest object */ + ngx_str_t *computed_arg_elts; + ngx_str_t location; + ngx_str_t *url_args; + ngx_str_t args; + ngx_uint_t flags = 0; + + dd_enter(); + + computed_arg_elts = computed_args->elts; + + location = computed_arg_elts[0]; + + if (location.len == 0) { + return NGX_ERROR; + } + + if (computed_args->nelts > 1) { + url_args = &computed_arg_elts[1]; + } else { + url_args = NULL; + } + + args.data = NULL; + args.len = 0; + + if (ngx_http_parse_unsafe_uri(r, &location, &args, &flags) != NGX_OK) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo_location_async sees unsafe uri: \"%V\"", + &location); + return NGX_ERROR; + } + + if (args.len > 0 && url_args == NULL) { + url_args = &args; + } + + rc = ngx_http_echo_send_header_if_needed(r, ctx); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + rc = ngx_http_subrequest(r, &location, url_args, &sr, NULL, 0); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + + rc = ngx_http_echo_adjust_subrequest(sr); + if (rc != NGX_OK) { + return NGX_ERROR; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_echo_location(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_int_t rc; + ngx_http_request_t *sr; /* subrequest object */ + ngx_str_t *computed_arg_elts; + ngx_str_t location; + ngx_str_t *url_args; + ngx_http_post_subrequest_t *psr; + ngx_str_t args; + ngx_uint_t flags = 0; + ngx_http_echo_ctx_t *sr_ctx; + + if (computed_args == NULL) { + return NGX_ERROR; + } + + computed_arg_elts = computed_args->elts; + + location = computed_arg_elts[0]; + + if (location.len == 0) { + return NGX_ERROR; + } + + if (computed_args->nelts > 1) { + url_args = &computed_arg_elts[1]; + + } else { + url_args = NULL; + } + + args.data = NULL; + args.len = 0; + + if (ngx_http_parse_unsafe_uri(r, &location, &args, &flags) != NGX_OK) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo_location sees unsafe uri: \"%V\"", + &location); + return NGX_ERROR; + } + + if (args.len > 0 && url_args == NULL) { + url_args = &args; + } + + rc = ngx_http_echo_send_header_if_needed(r, ctx); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + sr_ctx = ngx_http_echo_create_ctx(r); + + psr = ngx_palloc(r->pool, sizeof(ngx_http_post_subrequest_t)); + if (psr == NULL) { + return NGX_ERROR; + } + + psr->handler = ngx_http_echo_post_subrequest; + psr->data = sr_ctx; + + rc = ngx_http_subrequest(r, &location, url_args, &sr, psr, 0); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + + rc = ngx_http_echo_adjust_subrequest(sr); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + + return NGX_AGAIN; +} + + +static ngx_int_t +ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr) +{ + ngx_http_core_main_conf_t *cmcf; + ngx_http_request_t *r; + + /* we do not inherit the parent request's variables */ + cmcf = ngx_http_get_module_main_conf(sr, ngx_http_core_module); + + r = sr->parent; + + sr->header_in = r->header_in; + + /* XXX work-around a bug in ngx_http_subrequest */ + if (r->headers_in.headers.last == &r->headers_in.headers.part) { + sr->headers_in.headers.last = &sr->headers_in.headers.part; + } + + sr->variables = ngx_pcalloc(sr->pool, cmcf->variables.nelts + * sizeof(ngx_http_variable_value_t)); + + if (sr->variables == NULL) { + return NGX_ERROR; + } + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.h new file mode 100644 index 0000000..6bc0e03 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_location.h @@ -0,0 +1,13 @@ +#ifndef ECHO_LOCATION_H +#define ECHO_LOCATION_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_exec_echo_location_async(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +ngx_int_t ngx_http_echo_exec_echo_location(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +#endif /* ECHO_LOCATION_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c new file mode 100644 index 0000000..8d736d7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.c @@ -0,0 +1,682 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_echo_handler.h" +#include "ngx_http_echo_filter.h" +#include "ngx_http_echo_echo.h" +#include "ngx_http_echo_request_info.h" +#include "ngx_http_echo_var.h" +#include "ngx_http_echo_util.h" + + +#include +#include +#include + + +/* config init handler */ +static void *ngx_http_echo_create_loc_conf(ngx_conf_t *cf); +static char *ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, + void *child); +static void *ngx_http_echo_create_main_conf(ngx_conf_t *cf); +static ngx_int_t ngx_http_echo_post_config(ngx_conf_t *cf); + +/* config directive handlers */ +static char *ngx_http_echo_echo(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_http_echo_echo_request_body(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_sleep(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_http_echo_echo_flush(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_http_echo_echo_blocking_sleep(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_reset_timer(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_before_body(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_after_body(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_location_async(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_location(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_subrequest_async(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_subrequest(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_duplicate(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_read_request_body(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_foreach_split(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_end(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_abort_parent(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_echo_exec(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); +static char *ngx_http_echo_helper(ngx_http_echo_opcode_t opcode, + ngx_http_echo_cmd_category_t cat, + ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + + +static ngx_http_module_t ngx_http_echo_module_ctx = { + NULL, /* preconfiguration */ + ngx_http_echo_post_config, /* postconfiguration */ + + ngx_http_echo_create_main_conf, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_echo_create_loc_conf, /* create location configuration */ + ngx_http_echo_merge_loc_conf /* merge location configuration */ +}; + + +static ngx_command_t ngx_http_echo_commands[] = { + + { ngx_string("echo"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_ANY, + ngx_http_echo_echo, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_request_body"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_NOARGS, + ngx_http_echo_echo_request_body, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_sleep"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, + ngx_http_echo_echo_sleep, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_flush"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_NOARGS, + ngx_http_echo_echo_flush, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_blocking_sleep"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, + ngx_http_echo_echo_blocking_sleep, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_reset_timer"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_NOARGS, + ngx_http_echo_echo_reset_timer, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_before_body"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_ANY, + ngx_http_echo_echo_before_body, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, before_body_cmds), + NULL }, + + { ngx_string("echo_after_body"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_ANY, + ngx_http_echo_echo_after_body, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, after_body_cmds), + NULL }, + + { ngx_string("echo_location_async"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ngx_http_echo_echo_location_async, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_location"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ngx_http_echo_echo_location, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_subrequest_async"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_2MORE, + ngx_http_echo_echo_subrequest_async, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_subrequest"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_2MORE, + ngx_http_echo_echo_subrequest, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_duplicate"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_2MORE, + ngx_http_echo_echo_duplicate, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_read_request_body"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_NOARGS, + ngx_http_echo_echo_read_request_body, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_foreach_split"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_2MORE, + ngx_http_echo_echo_foreach_split, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_end"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_NOARGS, + ngx_http_echo_echo_end, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_abort_parent"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_NOARGS, + ngx_http_echo_echo_abort_parent, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_exec"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ngx_http_echo_echo_exec, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, handler_cmds), + NULL }, + + { ngx_string("echo_status"), + NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, + ngx_conf_set_num_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_echo_loc_conf_t, status), + NULL }, + + ngx_null_command +}; + + +ngx_module_t ngx_http_echo_module = { + NGX_MODULE_V1, + &ngx_http_echo_module_ctx, /* module context */ + ngx_http_echo_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + + +static void * +ngx_http_echo_create_loc_conf(ngx_conf_t *cf) +{ + ngx_http_echo_loc_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_echo_loc_conf_t)); + if (conf == NULL) { + return NULL; + } + + /* set by ngx_pcalloc + * conf->handler_cmds = NULL + * conf->before_body_cmds = NULL + * conf->after_body_cmds = NULL + * conf->seen_leading_output = 0 + * conf->seen_trailing_output = 0 + */ + + conf->status = NGX_CONF_UNSET; + + return conf; +} + + +static char * +ngx_http_echo_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) +{ + ngx_http_echo_loc_conf_t *prev = parent; + ngx_http_echo_loc_conf_t *conf = child; + + if (conf->handler_cmds == NULL) { + conf->handler_cmds = prev->handler_cmds; + conf->seen_leading_output = prev->seen_leading_output; + } + + if (conf->before_body_cmds == NULL) { + conf->before_body_cmds = prev->before_body_cmds; + } + + if (conf->after_body_cmds == NULL) { + conf->after_body_cmds = prev->after_body_cmds; + } + + ngx_conf_merge_value(conf->status, prev->status, 200); + + return NGX_CONF_OK; +} + + +static char * +ngx_http_echo_helper(ngx_http_echo_opcode_t opcode, + ngx_http_echo_cmd_category_t cat, + ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *raw_args; + ngx_uint_t i, n; + ngx_array_t **args_ptr; + ngx_array_t **cmds_ptr; + ngx_http_echo_cmd_t *echo_cmd; + ngx_http_core_loc_conf_t *clcf; + ngx_http_script_compile_t sc; + ngx_http_echo_main_conf_t *emcf; + ngx_http_echo_arg_template_t *arg; + + emcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_echo_module); + + /* cmds_ptr points to ngx_http_echo_loc_conf_t's + * handler_cmds, before_body_cmds, or after_body_cmds + * array, depending on the actual offset */ + cmds_ptr = (ngx_array_t **) (((u_char *) conf) + cmd->offset); + + if (*cmds_ptr == NULL) { + *cmds_ptr = ngx_array_create(cf->pool, 1, + sizeof(ngx_http_echo_cmd_t)); + + if (*cmds_ptr == NULL) { + return NGX_CONF_ERROR; + } + + if (cat == echo_handler_cmd) { + dd("registering the content handler"); + /* register the content handler */ + clcf = ngx_http_conf_get_module_loc_conf(cf, + ngx_http_core_module); + + dd("registering the content handler (2)"); + clcf->handler = ngx_http_echo_handler; + + } else { + dd("filter used = 1"); + emcf->requires_filter = 1; + } + } + + echo_cmd = ngx_array_push(*cmds_ptr); + + if (echo_cmd == NULL) { + return NGX_CONF_ERROR; + } + + echo_cmd->opcode = opcode; + + args_ptr = &echo_cmd->args; + *args_ptr = ngx_array_create(cf->pool, 1, + sizeof(ngx_http_echo_arg_template_t)); + + if (*args_ptr == NULL) { + return NGX_CONF_ERROR; + } + + raw_args = cf->args->elts; + + /* we skip the first arg and start from the second */ + + for (i = 1 ; i < cf->args->nelts; i++) { + arg = ngx_array_push(*args_ptr); + + if (arg == NULL) { + return NGX_CONF_ERROR; + } + + arg->raw_value = raw_args[i]; + + dd("found raw arg %s", raw_args[i].data); + + arg->lengths = NULL; + arg->values = NULL; + + n = ngx_http_script_variables_count(&arg->raw_value); + + if (n > 0) { + ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); + + sc.cf = cf; + sc.source = &arg->raw_value; + sc.lengths = &arg->lengths; + sc.values = &arg->values; + sc.variables = n; + sc.complete_lengths = 1; + sc.complete_values = 1; + + if (ngx_http_script_compile(&sc) != NGX_OK) { + return NGX_CONF_ERROR; + } + } + } /* end for */ + + return NGX_CONF_OK; +} + + +static char * +ngx_http_echo_echo(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + } + + dd("in echo_echo..."); + return ngx_http_echo_helper(echo_opcode_echo, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_request_body(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + } + + dd("in echo_echo_request_body..."); + return ngx_http_echo_helper(echo_opcode_echo_request_body, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_sleep(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + dd("in echo_sleep..."); + return ngx_http_echo_helper(echo_opcode_echo_sleep, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_flush(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + } + + dd("in echo_flush..."); + return ngx_http_echo_helper(echo_opcode_echo_flush, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_blocking_sleep(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + dd("in echo_blocking_sleep..."); + return ngx_http_echo_helper(echo_opcode_echo_blocking_sleep, + echo_handler_cmd, cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_reset_timer(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_reset_timer, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_before_body(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + dd("processing echo_before_body directive..."); + return ngx_http_echo_helper(echo_opcode_echo_before_body, echo_filter_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_after_body(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_after_body, echo_filter_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_location_async(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + char *ret; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + + ret = ngx_http_echo_helper(echo_opcode_echo_sync, echo_handler_cmd, + cf, cmd, conf); + + if (ret != NGX_CONF_OK) { + return ret; + } + } + + return ngx_http_echo_helper(echo_opcode_echo_location_async, + echo_handler_cmd, cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_location(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + char *ret; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + + ret = ngx_http_echo_helper(echo_opcode_echo_sync, echo_handler_cmd, + cf, cmd, conf); + + if (ret != NGX_CONF_OK) { + return ret; + } + } + + return ngx_http_echo_helper(echo_opcode_echo_location, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_subrequest_async(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + char *ret; + ngx_http_echo_loc_conf_t *elcf = conf; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + + ret = ngx_http_echo_helper(echo_opcode_echo_sync, echo_handler_cmd, + cf, cmd, conf); + + if (ret != NGX_CONF_OK) { + return ret; + } + } + + return ngx_http_echo_helper(echo_opcode_echo_subrequest_async, + echo_handler_cmd, cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_subrequest(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + char *ret; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + + ret = ngx_http_echo_helper(echo_opcode_echo_sync, echo_handler_cmd, + cf, cmd, conf); + + if (ret != NGX_CONF_OK) { + return ret; + } + } + + return ngx_http_echo_helper(echo_opcode_echo_subrequest, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_duplicate(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_echo_loc_conf_t *elcf = conf; + + if (!elcf->seen_leading_output) { + elcf->seen_leading_output = 1; + } + + return ngx_http_echo_helper(echo_opcode_echo_duplicate, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_read_request_body(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_read_request_body, + echo_handler_cmd, cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_foreach_split(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_foreach_split, + echo_handler_cmd, cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_end(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_end, echo_handler_cmd, cf, + cmd, conf); +} + + +static char * +ngx_http_echo_echo_abort_parent(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_abort_parent, echo_handler_cmd, + cf, cmd, conf); +} + + +static char * +ngx_http_echo_echo_exec(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + return ngx_http_echo_helper(echo_opcode_echo_exec, echo_handler_cmd, + cf, cmd, conf); +} + + +static void * +ngx_http_echo_create_main_conf(ngx_conf_t *cf) +{ +#if nginx_version >= 1011011 + ngx_pool_cleanup_t *cln; +#endif + ngx_http_echo_main_conf_t *emcf; + + emcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_echo_main_conf_t)); + if (emcf == NULL) { + return NULL; + } + + /* set by ngx_pcalloc: + * hmcf->requires_filter = 0; + */ + +#if nginx_version >= 1011011 + cln = ngx_pool_cleanup_add(cf->pool, 0); + if (cln == NULL) { + return NULL; + } + + cln->data = emcf; + cln->handler = ngx_http_echo_request_headers_cleanup; +#endif + + return emcf; +} + + +static ngx_int_t +ngx_http_echo_post_config(ngx_conf_t *cf) +{ + ngx_int_t rc; + + rc = ngx_http_echo_filter_init(cf); + if (rc != NGX_OK) { + return rc; + } + + rc = ngx_http_echo_echo_init(cf); + if (rc != NGX_OK) { + return rc; + } + + ngx_http_echo_content_length_hash = + ngx_http_echo_hash_literal("content-length"); + + return ngx_http_echo_add_variables(cf); +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h new file mode 100644 index 0000000..ce0a305 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_module.h @@ -0,0 +1,151 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef NGX_HTTP_ECHO_MODULE_H +#define NGX_HTTP_ECHO_MODULE_H + + +#include +#include +#include + + +extern ngx_module_t ngx_http_echo_module; + + +/* config directive's opcode */ +typedef enum { + echo_opcode_echo_sync, + echo_opcode_echo, + echo_opcode_echo_request_body, + echo_opcode_echo_sleep, + echo_opcode_echo_flush, + echo_opcode_echo_blocking_sleep, + echo_opcode_echo_reset_timer, + echo_opcode_echo_before_body, + echo_opcode_echo_after_body, + echo_opcode_echo_location_async, + echo_opcode_echo_location, + echo_opcode_echo_subrequest_async, + echo_opcode_echo_subrequest, + echo_opcode_echo_duplicate, + echo_opcode_echo_read_request_body, + echo_opcode_echo_foreach_split, + echo_opcode_echo_end, + echo_opcode_echo_abort_parent, + echo_opcode_echo_exec +} ngx_http_echo_opcode_t; + + +/* all the various config directives (or commands) are + * divided into two categories: "handler commands", + * and "filter commands". For instance, the "echo" + * directive is a handler command while + * "echo_before_body" is a filter one. */ +typedef enum { + echo_handler_cmd, + echo_filter_cmd + +} ngx_http_echo_cmd_category_t; + + +/* compiled form of a config directive argument's value */ +typedef struct { + /* holds the raw string of the argument value */ + ngx_str_t raw_value; + + /* fields "lengths" and "values" are set by + * the function ngx_http_script_compile, + * iff the argument value indeed contains + * nginx variables like "$foo" */ + ngx_array_t *lengths; + ngx_array_t *values; + +} ngx_http_echo_arg_template_t; + + +/* represent a config directive (or command) like "echo". */ +typedef struct { + ngx_http_echo_opcode_t opcode; + + /* each argument is of type echo_arg_template_t: */ + ngx_array_t *args; +} ngx_http_echo_cmd_t; + + +/* location config struct */ +typedef struct { + /* elements of the following arrays are of type + * ngx_http_echo_cmd_t */ + ngx_array_t *handler_cmds; + ngx_array_t *before_body_cmds; + ngx_array_t *after_body_cmds; + + unsigned seen_leading_output; + + ngx_int_t status; +} ngx_http_echo_loc_conf_t; + + +typedef struct { + ngx_int_t requires_filter; +#if nginx_version >= 1011011 + ngx_buf_t **busy_buf_ptrs; + ngx_int_t busy_buf_ptr_count; +#endif +} ngx_http_echo_main_conf_t; + + +typedef struct { + ngx_array_t *choices; /* items after splitting */ + ngx_uint_t next_choice; /* current item index */ + ngx_uint_t cmd_index; /* cmd index for the echo_foreach direcitve */ +} ngx_http_echo_foreach_ctx_t; + + +/* context struct in the request handling cycle, holding + * the current states of the command evaluator */ +typedef struct { + /* index of the next handler command in + * ngx_http_echo_loc_conf_t's "handler_cmds" array. */ + ngx_uint_t next_handler_cmd; + + /* index of the next before-body filter command in + * ngx_http_echo_loc_conf_t's "before_body_cmds" array. */ + ngx_uint_t next_before_body_cmd; + + /* index of the next after-body filter command in + * ngx_http_echo_loc_conf_t's "after_body_cmds" array. */ + ngx_uint_t next_after_body_cmd; + + ngx_http_echo_foreach_ctx_t *foreach; + + ngx_time_t timer_begin; + + ngx_event_t sleep; + + ngx_uint_t counter; + + unsigned before_body_sent:1; + unsigned skip_filter:1; + + unsigned wait_read_request_body:1; + + unsigned waiting:1; + unsigned done:1; + + unsigned run_post_subrequest:1; + unsigned header_sent:1; /* r->header_sent is not sufficient + * because special header filters like + * ngx_http_image_filter_module's may + * intercept the whole header filter chain + * leaving r->header_sent unset. So we + * should always test both flags. */ + +} ngx_http_echo_ctx_t; + + +#endif /* NGX_HTTP_ECHO_MODULE_H */ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c new file mode 100644 index 0000000..7dd3683 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.c @@ -0,0 +1,522 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_echo_request_info.h" +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_handler.h" + +#include + + +static void ngx_http_echo_post_read_request_body(ngx_http_request_t *r); +#if nginx_version >= 1011011 +void ngx_http_echo_request_headers_cleanup(void *data); +#endif + + +ngx_int_t +ngx_http_echo_exec_echo_read_request_body(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ + return ngx_http_read_client_request_body(r, + ngx_http_echo_post_read_request_body); +} + + +static void +ngx_http_echo_post_read_request_body(ngx_http_request_t *r) +{ + ngx_http_echo_ctx_t *ctx; + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + dd("wait read request body %d", (int) ctx->wait_read_request_body); + + if (ctx->wait_read_request_body) { + ctx->waiting = 0; + ctx->done = 1; + + r->write_event_handler = ngx_http_echo_wev_handler; + + ngx_http_echo_wev_handler(r); + } +} + + +/* this function's implementation is borrowed from nginx 0.8.20 + * and modified a bit to work with subrequests. + * Copyrighted (C) by Igor Sysoev */ +ngx_int_t +ngx_http_echo_request_method_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->method_name.data) { + v->len = r->method_name.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = r->method_name.data; + + } else { + v->not_found = 1; + } + + return NGX_OK; +} + + +/* this function's implementation is borrowed from nginx 0.8.20 + * and modified a bit to work with subrequests. + * Copyrighted (C) by Igor Sysoev */ +ngx_int_t +ngx_http_echo_client_request_method_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->main->method_name.data) { + v->len = r->main->method_name.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = r->main->method_name.data; + + } else { + v->not_found = 1; + } + + return NGX_OK; +} + + +/* this function's implementation is borrowed from nginx 0.8.20 + * and modified a bit to work with subrequests. + * Copyrighted (C) by Igor Sysoev */ +ngx_int_t +ngx_http_echo_request_body_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + u_char *p; + size_t len; + ngx_buf_t *b; + ngx_chain_t *cl; + ngx_chain_t *in; + + if (r->request_body == NULL + || r->request_body->bufs == NULL + || r->request_body->temp_file) + { + v->not_found = 1; + + return NGX_OK; + } + + in = r->request_body->bufs; + + len = 0; + for (cl = in; cl; cl = cl->next) { + b = cl->buf; + + if (!ngx_buf_in_memory(b)) { + if (b->in_file) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "variable echo_request_body sees in-file only " + "buffers and discard the whole body data"); + + v->not_found = 1; + + return NGX_OK; + } + + } else { + len += b->last - b->pos; + } + } + + p = ngx_pnalloc(r->pool, len); + if (p == NULL) { + return NGX_ERROR; + } + + v->data = p; + + for (cl = in; cl; cl = cl->next) { + b = cl->buf; + + if (ngx_buf_in_memory(b)) { + p = ngx_copy(p, b->pos, b->last - b->pos); + } + } + + if (p - v->data != (ssize_t) len) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "variable echo_request_body: buffer error"); + + v->not_found = 1; + + return NGX_OK; + } + + v->len = len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + int line_break_len; + size_t size; + u_char *p, *last, *pos; + ngx_int_t i, j; + ngx_buf_t *b, *first = NULL; + unsigned found; +#if nginx_version >= 1011011 + ngx_buf_t **bb; + ngx_chain_t *cl; + ngx_http_echo_main_conf_t *emcf; +#endif + ngx_connection_t *c; + ngx_http_request_t *mr; + ngx_http_connection_t *hc; + + mr = r->main; + hc = r->main->http_connection; + c = mr->connection; + +#if (NGX_HTTP_V2) + /* TODO */ + if (mr->stream) { + v->not_found = 1; + return NGX_OK; + } +#endif + +#if nginx_version >= 1011011 + emcf = ngx_http_get_module_main_conf(r, ngx_http_echo_module); +#endif + + size = 0; + b = c->buffer; + + if (mr->request_line.data[mr->request_line.len] == CR) { + line_break_len = 2; + + } else { + line_break_len = 1; + } + + if (mr->request_line.data >= b->start + && mr->request_line.data + mr->request_line.len + line_break_len + <= b->pos) + { + first = b; + size += b->pos - mr->request_line.data; + } + + if (hc->nbusy) { + b = NULL; + +#if nginx_version >= 1011011 + if (hc->nbusy > emcf->busy_buf_ptr_count) { + if (emcf->busy_buf_ptrs) { + ngx_free(emcf->busy_buf_ptrs); + } + + emcf->busy_buf_ptrs = ngx_alloc(hc->nbusy * sizeof(ngx_buf_t *), + r->connection->log); + + if (emcf->busy_buf_ptrs == NULL) { + return NGX_ERROR; + } + + emcf->busy_buf_ptr_count = hc->nbusy; + } + + bb = emcf->busy_buf_ptrs; + for (cl = hc->busy; cl; cl = cl->next) { + *bb++ = cl->buf; + } + + bb = emcf->busy_buf_ptrs; + for (i = hc->nbusy; i > 0; i--) { + b = bb[i - 1]; +#else + for (i = 0; i < hc->nbusy; i++) { + b = hc->busy[i]; +#endif + + if (first == NULL) { + if (mr->request_line.data >= b->pos + || mr->request_line.data + mr->request_line.len + + line_break_len <= b->start) + { + continue; + } + + dd("found first at %d", (int) i); + first = b; + } + + size += b->pos - b->start; + } + } + + + size++; /* plus the null terminator, as required by the later + ngx_strstr() call */ + + v->data = ngx_palloc(r->pool, size); + if (v->data == NULL) { + return NGX_ERROR; + } + + last = v->data; + + b = c->buffer; + found = 0; + + if (first == b) { + found = 1; + pos = b->pos; + + last = ngx_copy(v->data, mr->request_line.data, + pos - mr->request_line.data); + + if (b != mr->header_in) { + /* skip truncated header entries (if any) */ + while (last > v->data && last[-1] != LF) { + last--; + } + } + + i = 0; + for (p = v->data; p != last; p++) { + if (*p == '\0') { + i++; + if (p + 1 != last && *(p + 1) == LF) { + *p = CR; + + } else if (i % 2 == 1) { + *p = ':'; + + } else { + *p = LF; + } + } + } + } + + if (hc->nbusy) { + +#if nginx_version >= 1011011 + bb = emcf->busy_buf_ptrs; + for (i = hc->nbusy; i > 0; i--) { + b = bb[i - 1]; +#else + for (i = 0; i < hc->nbusy; i++) { + b = hc->busy[i]; +#endif + + if (!found) { + if (b != first) { + continue; + } + + dd("found first"); + found = 1; + } + + p = last; + + pos = b->pos; + + if (b == first) { + dd("request line: %.*s", (int) mr->request_line.len, + mr->request_line.data); + + last = ngx_copy(last, + mr->request_line.data, + pos - mr->request_line.data); + + } else { + last = ngx_copy(last, b->start, pos - b->start); + } + +#if 1 + /* skip truncated header entries (if any) */ + while (last > p && last[-1] != LF) { + last--; + } +#endif + + j = 0; + for (; p != last; p++) { + if (*p == '\0') { + j++; + if (p + 1 == last) { + /* XXX this should not happen */ + dd("found string end!!"); + + } else if (*(p + 1) == LF) { + *p = CR; + + } else if (j % 2 == 1) { + *p = ':'; + + } else { + *p = LF; + } + } + } + + if (b == mr->header_in) { + break; + } + } + } + + *last++ = '\0'; + + if (last - v->data > (ssize_t) size) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "buffer error when evaluating " + "$echo_client__request_headers: \"%V\"", + (ngx_int_t) (last - v->data - size)); + + return NGX_ERROR; + } + + /* strip the leading part (if any) of the request body in our header. + * the first part of the request body could slip in because nginx core's + * ngx_http_request_body_length_filter and etc can move r->header_in->pos + * in case that some of the body data has been preread into r->header_in. + */ + + if ((p = (u_char *) ngx_strstr(v->data, CRLF CRLF)) != NULL) { + last = p + sizeof(CRLF CRLF) - 1; + + } else if ((p = (u_char *) ngx_strstr(v->data, CRLF "\n")) != NULL) { + last = p + sizeof(CRLF "\n") - 1; + + } else if ((p = (u_char *) ngx_strstr(v->data, "\n" CRLF)) != NULL) { + last = p + sizeof("\n" CRLF) - 1; + + } else { + for (p = last - 1; p - v->data >= 2; p--) { + if (p[0] == LF && p[-1] == CR) { + p[-1] = LF; + last = p + 1; + break; + } + + if (p[0] == LF && p[-1] == LF) { + last = p + 1; + break; + } + } + } + + v->len = last - v->data; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_cacheable_request_uri_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->uri.len) { + v->len = r->uri.len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + v->data = r->uri.data; + + } else { + v->not_found = 1; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_request_uri_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + if (r->uri.len) { + v->len = r->uri.len; + v->valid = 1; + v->no_cacheable = 1; + v->not_found = 0; + v->data = r->uri.data; + + } else { + v->not_found = 1; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_response_status_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + u_char *p; + + if (r->headers_out.status) { + dd("headers out status: %d", (int) r->headers_out.status); + + p = ngx_palloc(r->pool, NGX_INT_T_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + v->len = ngx_sprintf(p, "%ui", r->headers_out.status) - p; + v->data = p; + + v->valid = 1; + v->no_cacheable = 1; + v->not_found = 0; + + } else { + v->not_found = 1; + } + + return NGX_OK; +} + + +#if nginx_version >= 1011011 +void +ngx_http_echo_request_headers_cleanup(void *data) +{ + ngx_http_echo_main_conf_t *emcf; + + emcf = (ngx_http_echo_main_conf_t *) data; + + if (emcf->busy_buf_ptrs) { + ngx_free(emcf->busy_buf_ptrs); + emcf->busy_buf_ptrs = NULL; + } +} +#endif + +/* vi:set ft=c ts=4 sw=4 et fdm=marker: */ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h new file mode 100644 index 0000000..aa5730b --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_request_info.h @@ -0,0 +1,36 @@ +#ifndef ECHO_REQUEST_INFO_H +#define ECHO_REQUEST_INFO_H + + +#include "ngx_http_echo_module.h" + + +ngx_int_t ngx_http_echo_exec_echo_read_request_body( + ngx_http_request_t *r, ngx_http_echo_ctx_t *ctx); + +ngx_int_t ngx_http_echo_request_method_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_client_request_method_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_request_body_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_client_request_headers_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_cacheable_request_uri_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_request_uri_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_response_status_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +#if nginx_version >= 1011011 +void ngx_http_echo_request_headers_cleanup(void *data); +#endif + +#endif /* ECHO_REQUEST_INFO_H */ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c new file mode 100644 index 0000000..c96fa5a --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.c @@ -0,0 +1,208 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_echo_sleep.h" +#include "ngx_http_echo_handler.h" + +#include +#include + + +/* event handler for echo_sleep */ + +static void ngx_http_echo_post_sleep(ngx_http_request_t *r); +static void ngx_http_echo_sleep_cleanup(void *data); + + +ngx_int_t +ngx_http_echo_exec_echo_sleep(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_str_t *computed_arg; + ngx_str_t *computed_arg_elts; + ngx_int_t delay; /* in msec */ + ngx_http_cleanup_t *cln; + + computed_arg_elts = computed_args->elts; + computed_arg = &computed_arg_elts[0]; + + delay = ngx_atofp(computed_arg->data, computed_arg->len, 3); + + if (delay == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "invalid sleep duration \"%V\"", &computed_arg_elts[0]); + + return NGX_HTTP_BAD_REQUEST; + } + + dd("adding timer with delay %lu ms, r:%.*s", (unsigned long) delay, + (int) r->uri.len, r->uri.data); + + ngx_add_timer(&ctx->sleep, (ngx_msec_t) delay); + + /* we don't check broken downstream connections + * ourselves so even if the client shuts down + * the connection prematurely, nginx will still + * go on waiting for our timers to get properly + * expired. However, we'd still register a + * cleanup handler for completeness. */ + + cln = ngx_http_cleanup_add(r, 0); + if (cln == NULL) { + return NGX_ERROR; + } + + cln->handler = ngx_http_echo_sleep_cleanup; + cln->data = r; + + return NGX_AGAIN; +} + + +static void +ngx_http_echo_post_sleep(ngx_http_request_t *r) +{ + ngx_http_echo_ctx_t *ctx; + /* ngx_int_t rc; */ + + dd("post sleep, r:%.*s", (int) r->uri.len, r->uri.data); + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + + if (ctx == NULL) { + return; + } + + ctx->waiting = 0; + ctx->done = 1; + + dd("sleep: after get module ctx"); + + dd("timed out? %d", ctx->sleep.timedout); + dd("timer set? %d", ctx->sleep.timer_set); + + if (!ctx->sleep.timedout) { + dd("HERE reached!"); + return; + } + + ctx->sleep.timedout = 0; + + if (ctx->sleep.timer_set) { + dd("deleting timer for echo_sleep"); + + ngx_del_timer(&ctx->sleep); + } + + /* r->write_event_handler = ngx_http_request_empty_handler; */ + + ngx_http_echo_wev_handler(r); +} + + +void +ngx_http_echo_sleep_event_handler(ngx_event_t *ev) +{ + ngx_connection_t *c; + ngx_http_request_t *r; + ngx_http_log_ctx_t *ctx; + + r = ev->data; + c = r->connection; + + if (c->destroyed) { + return; + } + + if (c->error) { + ngx_http_finalize_request(r, NGX_ERROR); + return; + } + + ctx = c->log->data; + ctx->current_request = r; + + /* XXX when r->done == 1 we should do cleaning immediately + * and delete our timer and then quit. */ + + ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, + "echo sleep event handler: \"%V?%V\"", &r->uri, &r->args); + + /* + if (r->done) { + return; + } + */ + + ngx_http_echo_post_sleep(r); + +#if defined(nginx_version) + + dd("before run posted requests"); + + ngx_http_run_posted_requests(c); + + dd("after run posted requests"); + +#endif +} + + +ngx_int_t +ngx_http_echo_exec_echo_blocking_sleep(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_str_t *computed_arg; + ngx_str_t *computed_arg_elts; + ngx_int_t delay; /* in msec */ + + computed_arg_elts = computed_args->elts; + computed_arg = &computed_arg_elts[0]; + + delay = ngx_atofp(computed_arg->data, computed_arg->len, 3); + + if (delay == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "invalid sleep duration \"%V\"", &computed_arg_elts[0]); + return NGX_HTTP_BAD_REQUEST; + } + + dd("blocking delay: %lu ms", (unsigned long) delay); + + ngx_msleep((ngx_msec_t) delay); + + return NGX_OK; +} + + +static void +ngx_http_echo_sleep_cleanup(void *data) +{ + ngx_http_request_t *r = data; + ngx_http_echo_ctx_t *ctx; + + dd("echo sleep cleanup"); + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + if (ctx == NULL) { + return; + } + + if (ctx->sleep.timer_set) { + dd("cleanup: deleting timer for echo_sleep"); + + ngx_del_timer(&ctx->sleep); + return; + } + + dd("cleanup: timer not set"); +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.h new file mode 100644 index 0000000..8bb70c3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_sleep.h @@ -0,0 +1,16 @@ +#ifndef ECHO_SLEEP_H +#define ECHO_SLEEP_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_exec_echo_sleep( + ngx_http_request_t *r, ngx_http_echo_ctx_t *ctx, + ngx_array_t *computed_args); + +ngx_int_t ngx_http_echo_exec_echo_blocking_sleep(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +void ngx_http_echo_sleep_event_handler(ngx_event_t *ev); + +#endif /* ECHO_SLEEP_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c new file mode 100644 index 0000000..0980d58 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.c @@ -0,0 +1,791 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_subrequest.h" +#include "ngx_http_echo_handler.h" +#include + + +#define ngx_http_echo_method_name(m) { sizeof(m) - 1, (u_char *) m " " } + + +ngx_str_t ngx_http_echo_content_length_header_key = + ngx_string("Content-Length"); + +ngx_str_t ngx_http_echo_get_method = ngx_http_echo_method_name("GET"); +ngx_str_t ngx_http_echo_put_method = ngx_http_echo_method_name("PUT"); +ngx_str_t ngx_http_echo_post_method = ngx_http_echo_method_name("POST"); +ngx_str_t ngx_http_echo_head_method = ngx_http_echo_method_name("HEAD"); +ngx_str_t ngx_http_echo_copy_method = ngx_http_echo_method_name("COPY"); +ngx_str_t ngx_http_echo_move_method = ngx_http_echo_method_name("MOVE"); +ngx_str_t ngx_http_echo_lock_method = ngx_http_echo_method_name("LOCK"); +ngx_str_t ngx_http_echo_mkcol_method = ngx_http_echo_method_name("MKCOL"); +ngx_str_t ngx_http_echo_trace_method = ngx_http_echo_method_name("TRACE"); +ngx_str_t ngx_http_echo_delete_method = ngx_http_echo_method_name("DELETE"); +ngx_str_t ngx_http_echo_unlock_method = ngx_http_echo_method_name("UNLOCK"); +ngx_str_t ngx_http_echo_options_method = ngx_http_echo_method_name("OPTIONS"); +ngx_str_t ngx_http_echo_propfind_method = + ngx_http_echo_method_name("PROPFIND"); +ngx_str_t ngx_http_echo_proppatch_method = + ngx_http_echo_method_name("PROPPATCH"); + + +typedef struct ngx_http_echo_subrequest_s { + ngx_uint_t method; + ngx_str_t *method_name; + ngx_str_t *location; + ngx_str_t *query_string; + ssize_t content_length_n; + ngx_http_request_body_t *request_body; +} ngx_http_echo_subrequest_t; + + +static ngx_int_t ngx_http_echo_parse_method_name(ngx_str_t **method_name_ptr); +static ngx_int_t ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr, + ngx_http_echo_subrequest_t *parsed_sr); +static ngx_int_t ngx_http_echo_parse_subrequest_spec(ngx_http_request_t *r, + ngx_array_t *computed_args, ngx_http_echo_subrequest_t **parsed_sr_ptr); +static ngx_int_t ngx_http_echo_set_content_length_header(ngx_http_request_t *r, + off_t len); + + +ngx_int_t +ngx_http_echo_exec_echo_subrequest_async(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_int_t rc; + ngx_http_echo_subrequest_t *parsed_sr; + ngx_http_request_t *sr; /* subrequest object */ + ngx_str_t args; + ngx_uint_t flags = 0; + + dd_enter(); + + rc = ngx_http_echo_parse_subrequest_spec(r, computed_args, &parsed_sr); + if (rc != NGX_OK) { + return rc; + } + + dd("location: %.*s", + (int) parsed_sr->location->len, + parsed_sr->location->data); + + args.data = NULL; + args.len = 0; + + if (ngx_http_parse_unsafe_uri(r, parsed_sr->location, &args, &flags) + != NGX_OK) + { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo_subrequest_async sees unsafe uri: \"%V\"", + parsed_sr->location); + return NGX_ERROR; + } + + if (args.len > 0 && parsed_sr->query_string == NULL) { + parsed_sr->query_string = &args; + } + + rc = ngx_http_echo_send_header_if_needed(r, ctx); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + rc = ngx_http_subrequest(r, parsed_sr->location, parsed_sr->query_string, + &sr, NULL, 0); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + + rc = ngx_http_echo_adjust_subrequest(sr, parsed_sr); + + if (rc != NGX_OK) { + return rc; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_echo_subrequest(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_int_t rc; + ngx_http_request_t *sr; /* subrequest object */ + ngx_http_post_subrequest_t *psr; + ngx_http_echo_subrequest_t *parsed_sr; + ngx_str_t args; + ngx_uint_t flags = 0; + ngx_http_echo_ctx_t *sr_ctx; + + dd_enter(); + + rc = ngx_http_echo_parse_subrequest_spec(r, computed_args, &parsed_sr); + if (rc != NGX_OK) { + return rc; + } + + args.data = NULL; + args.len = 0; + + if (ngx_http_parse_unsafe_uri(r, parsed_sr->location, &args, &flags) + != NGX_OK) + { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo_subrequest sees unsafe uri: \"%V\"", + parsed_sr->location); + return NGX_ERROR; + } + + if (args.len > 0 && parsed_sr->query_string == NULL) { + parsed_sr->query_string = &args; + } + + rc = ngx_http_echo_send_header_if_needed(r, ctx); + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + sr_ctx = ngx_http_echo_create_ctx(r); + + /* set by ngx_http_echo_create_ctx + * sr_ctx->run_post_subrequest = 0 + */ + + dd("creating sr ctx for %.*s: %p", (int) parsed_sr->location->len, + parsed_sr->location->data, sr_ctx); + + psr = ngx_palloc(r->pool, sizeof(ngx_http_post_subrequest_t)); + + if (psr == NULL) { + return NGX_ERROR; + } + + psr->handler = ngx_http_echo_post_subrequest; + psr->data = sr_ctx; + + rc = ngx_http_subrequest(r, parsed_sr->location, parsed_sr->query_string, + &sr, psr, 0); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + + sr_ctx->sleep.data = sr; + + ngx_http_set_ctx(sr, sr_ctx, ngx_http_echo_module); + + rc = ngx_http_echo_adjust_subrequest(sr, parsed_sr); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + + return NGX_AGAIN; +} + + +static ngx_int_t +ngx_http_echo_parse_subrequest_spec(ngx_http_request_t *r, + ngx_array_t *computed_args, ngx_http_echo_subrequest_t **parsed_sr_ptr) +{ + ngx_str_t *computed_arg_elts, *arg; + ngx_str_t **to_write = NULL; + ngx_str_t *method_name; + ngx_str_t *body_str = NULL; + ngx_str_t *body_file = NULL; + ngx_uint_t i; + ngx_flag_t expecting_opt; + ngx_http_request_body_t *rb = NULL; + ngx_buf_t *b; + ngx_http_echo_subrequest_t *parsed_sr; + ngx_open_file_info_t of; + ngx_http_core_loc_conf_t *clcf; + size_t len; + + *parsed_sr_ptr = ngx_pcalloc(r->pool, sizeof(ngx_http_echo_subrequest_t)); + if (*parsed_sr_ptr == NULL) { + return NGX_ERROR; + } + + parsed_sr = *parsed_sr_ptr; + computed_arg_elts = computed_args->elts; + method_name = &computed_arg_elts[0]; + parsed_sr->location = &computed_arg_elts[1]; + + if (parsed_sr->location->len == 0) { + return NGX_ERROR; + } + + expecting_opt = 1; + + for (i = 2; i < computed_args->nelts; i++) { + arg = &computed_arg_elts[i]; + + if (!expecting_opt) { + if (to_write == NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "echo_subrequest_async: to_write should NOT be NULL"); + return NGX_ERROR; + } + + *to_write = arg; + to_write = NULL; + + expecting_opt = 1; + + continue; + } + + if (arg->len == 2) { + if (ngx_strncmp("-q", arg->data, arg->len) == 0) { + to_write = &parsed_sr->query_string; + expecting_opt = 0; + continue; + } + + if (ngx_strncmp("-b", arg->data, arg->len) == 0) { + to_write = &body_str; + expecting_opt = 0; + continue; + } + + if (ngx_strncmp("-f", arg->data, arg->len) == 0) { + dd("found option -f"); + to_write = &body_file; + expecting_opt = 0; + continue; + } + } + + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "unknown option for echo_subrequest*: %V", arg); + + return NGX_ERROR; + } + + if (body_str != NULL && body_str->len) { + rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); + + if (rb == NULL) { + return NGX_ERROR; + } + + parsed_sr->content_length_n = body_str->len; + + b = ngx_calloc_buf(r->pool); + if (b == NULL) { + return NGX_ERROR; + } + + b->temporary = 1; + /* b->memory = 1; */ + b->start = b->pos = body_str->data; + b->end = b->last = body_str->data + body_str->len; + + rb->bufs = ngx_alloc_chain_link(r->pool); + if (rb->bufs == NULL) { + return NGX_ERROR; + } + + rb->bufs->buf = b; + rb->bufs->next = NULL; + + rb->buf = b; + + } else if (body_file != NULL && body_file->len) { + + dd("body_file defined %.*s", (int) body_file->len, body_file->data); + + body_file->data = ngx_http_echo_rebase_path(r->pool, body_file->data, + body_file->len, &len); + + if (body_file->data == NULL) { + return NGX_ERROR; + } + + body_file->len = len; + + dd("after rebase, the path becomes %.*s", (int) body_file->len, + body_file->data); + + rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t)); + if (rb == NULL) { + return NGX_ERROR; + } + + clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); + ngx_memzero(&of, sizeof(ngx_open_file_info_t)); + +#if defined(nginx_version) && nginx_version >= 8018 + of.read_ahead = clcf->read_ahead; +#endif + + of.directio = clcf->directio; + of.valid = clcf->open_file_cache_valid; + of.min_uses = clcf->open_file_cache_min_uses; + of.errors = clcf->open_file_cache_errors; + of.events = clcf->open_file_cache_events; + + if (ngx_open_cached_file(clcf->open_file_cache, body_file, &of, r->pool) + != NGX_OK) + { + ngx_log_error(NGX_LOG_ERR, r->connection->log, of.err, + "%s \"%V\" failed", + of.failed, body_file); + + return NGX_ERROR; + } + + dd("file content size: %d", (int) of.size); + + parsed_sr->content_length_n = (ssize_t) of.size; + + b = ngx_pcalloc(r->pool, sizeof(ngx_buf_t)); + if (b == NULL) { + return NGX_ERROR; + } + + b->file = ngx_pcalloc(r->pool, sizeof(ngx_file_t)); + if (b->file == NULL) { + return NGX_ERROR; + } + + b->file_pos = 0; + b->file_last = of.size; + + b->in_file = b->file_last ? 1: 0; + +#if 0 + b->last_buf = (r == r->main) ? 1: 0; + b->last_in_chain = 1; +#endif + + b->file->fd = of.fd; + b->file->name = *body_file; + b->file->log = r->connection->log; + b->file->directio = of.is_directio; + + rb->bufs = ngx_alloc_chain_link(r->pool); + if (rb->bufs == NULL) { + return NGX_ERROR; + } + + rb->bufs->buf = b; + rb->bufs->next = NULL; + rb->buf = b; + } + + parsed_sr->request_body = rb; + + parsed_sr->method = ngx_http_echo_parse_method_name(&method_name); + parsed_sr->method_name = method_name; + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_echo_adjust_subrequest(ngx_http_request_t *sr, + ngx_http_echo_subrequest_t *parsed_sr) +{ + ngx_http_core_main_conf_t *cmcf; + ngx_http_request_t *r; + ngx_http_request_body_t *body; + ngx_int_t rc; + + sr->method = parsed_sr->method; + sr->method_name = *(parsed_sr->method_name); + + if (sr->method == NGX_HTTP_HEAD) { + sr->header_only = 1; + } + + r = sr->parent; + + sr->header_in = r->header_in; + + /* XXX work-around a bug in ngx_http_subrequest */ + if (r->headers_in.headers.last == &r->headers_in.headers.part) { + sr->headers_in.headers.last = &sr->headers_in.headers.part; + } + + /* we do not inherit the parent request's variables */ + cmcf = ngx_http_get_module_main_conf(sr, ngx_http_core_module); + sr->variables = ngx_pcalloc(sr->pool, cmcf->variables.nelts + * sizeof(ngx_http_variable_value_t)); + + if (sr->variables == NULL) { + return NGX_ERROR; + } + + body = parsed_sr->request_body; + if (body) { + sr->request_body = body; + + rc = ngx_http_echo_set_content_length_header(sr, body->buf ? + ngx_buf_size(body->buf) + : 0); + + if (rc != NGX_OK) { + return NGX_ERROR; + } + } + + dd("subrequest body: %p", sr->request_body); + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_echo_parse_method_name(ngx_str_t **method_name_ptr) +{ + const ngx_str_t *method_name = *method_name_ptr; + + switch (method_name->len) { + case 3: + if (ngx_http_echo_strcmp_const(method_name->data, "GET") == 0) { + *method_name_ptr = &ngx_http_echo_get_method; + return NGX_HTTP_GET; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "PUT") == 0) { + *method_name_ptr = &ngx_http_echo_put_method; + return NGX_HTTP_PUT; + } + + return NGX_HTTP_UNKNOWN; + + case 4: + if (ngx_http_echo_strcmp_const(method_name->data, "POST") == 0) { + *method_name_ptr = &ngx_http_echo_post_method; + return NGX_HTTP_POST; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "HEAD") == 0) { + *method_name_ptr = &ngx_http_echo_head_method; + return NGX_HTTP_HEAD; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "COPY") == 0) { + *method_name_ptr = &ngx_http_echo_copy_method; + return NGX_HTTP_COPY; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "MOVE") == 0) { + *method_name_ptr = &ngx_http_echo_move_method; + return NGX_HTTP_MOVE; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "LOCK") == 0) { + *method_name_ptr = &ngx_http_echo_lock_method; + return NGX_HTTP_LOCK; + } + + return NGX_HTTP_UNKNOWN; + + case 5: + if (ngx_http_echo_strcmp_const(method_name->data, "MKCOL") == 0) { + *method_name_ptr = &ngx_http_echo_mkcol_method; + return NGX_HTTP_MKCOL; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "TRACE") == 0) { + *method_name_ptr = &ngx_http_echo_trace_method; + return NGX_HTTP_TRACE; + } + + return NGX_HTTP_UNKNOWN; + + case 6: + if (ngx_http_echo_strcmp_const(method_name->data, "DELETE") == 0) { + *method_name_ptr = &ngx_http_echo_delete_method; + return NGX_HTTP_DELETE; + } + + if (ngx_http_echo_strcmp_const(method_name->data, "UNLOCK") == 0) { + *method_name_ptr = &ngx_http_echo_unlock_method; + return NGX_HTTP_UNLOCK; + } + + return NGX_HTTP_UNKNOWN; + + case 7: + if (ngx_http_echo_strcmp_const(method_name->data, "OPTIONS") == 0) { + *method_name_ptr = &ngx_http_echo_options_method; + return NGX_HTTP_OPTIONS; + } + + return NGX_HTTP_UNKNOWN; + + case 8: + if (ngx_http_echo_strcmp_const(method_name->data, "PROPFIND") == 0) { + *method_name_ptr = &ngx_http_echo_propfind_method; + return NGX_HTTP_PROPFIND; + } + + return NGX_HTTP_UNKNOWN; + + case 9: + if (ngx_http_echo_strcmp_const(method_name->data, "PROPPATCH") == 0) { + *method_name_ptr = &ngx_http_echo_proppatch_method; + return NGX_HTTP_PROPPATCH; + } + + return NGX_HTTP_UNKNOWN; + + default: + return NGX_HTTP_UNKNOWN; + } +} + + +/* XXX extermely evil and not working yet */ +ngx_int_t +ngx_http_echo_exec_abort_parent(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ +#if 0 + ngx_http_postponed_request_t *pr, *ppr; + ngx_http_request_t *saved_data = NULL; + ngx_chain_t *out = NULL; + /* ngx_int_t rc; */ + + dd("aborting parent..."); + + if (r == r->main || r->parent == NULL) { + return NGX_OK; + } + + if (r->parent->postponed) { + dd("Found parent->postponed..."); + + saved_data = r->connection->data; + ppr = NULL; + for (pr = r->parent->postponed; pr->next; pr = pr->next) { + if (pr->request == NULL) { + continue; + } + + if (pr->request == r) { + /* r->parent->postponed->next = pr; */ + dd("found the current subrequest"); + out = pr->out; + continue; + } + + /* r->connection->data = pr->request; */ + dd("finalizing the subrequest..."); + ngx_http_upstream_create(pr->request); + pr->request->upstream = NULL; + + if (ppr == NULL) { + r->parent->postponed = pr->next; + ppr = pr->next; + } else { + ppr->next = pr->next; + ppr = pr->next; + } + } + } + + r->parent->postponed->next = NULL; + + /* + r->connection->data = r->parent; + r->connection->buffered = 0; + + if (out != NULL) { + dd("trying to send more stuffs for the parent"); + ngx_http_output_filter(r->parent, out); + } + */ + + /* ngx_http_send_special(r->parent, NGX_HTTP_LAST); */ + + if (saved_data) { + r->connection->data = saved_data; + } + + dd("terminating the parent request"); + + return ngx_http_echo_send_chain_link(r, ctx, NULL /* indicate LAST */); + + /* ngx_http_upstream_create(r); */ + + /* ngx_http_finalize_request(r->parent, NGX_ERROR); */ +#endif + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_exec(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args) +{ + ngx_str_t *uri; + ngx_str_t *user_args; + ngx_str_t args; + ngx_uint_t flags = 0; + ngx_str_t *computed_arg; + + computed_arg = computed_args->elts; + + uri = &computed_arg[0]; + + if (uri->len == 0) { + return NGX_HTTP_BAD_REQUEST; + } + + if (computed_args->nelts > 1) { + user_args = &computed_arg[1]; + + } else { + user_args = NULL; + } + + args.data = NULL; + args.len = 0; + + if (ngx_http_parse_unsafe_uri(r, uri, &args, &flags) != NGX_OK) { + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "echo_exec sees unsafe uri: \"%V\"", + uri); + return NGX_ERROR; + } + + if (args.len > 0 && user_args == NULL) { + user_args = &args; + } + + r->write_event_handler = ngx_http_request_empty_handler; + + if (uri->data[0] == '@') { + + if (user_args && user_args->len > 0) { + ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, + "querystring %V ignored when exec'ing named " + "location %V", user_args, uri); + } + +#if 1 + /* clear the modules contexts */ + ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); +#endif + + dd("named location: %.*s, c:%d", (int) uri->len, uri->data, + (int) r->main->count); + + return ngx_http_named_location(r, uri); + } + + return ngx_http_internal_redirect(r, uri, user_args); +} + + +static ngx_int_t +ngx_http_echo_set_content_length_header(ngx_http_request_t *r, off_t len) +{ + ngx_table_elt_t *h, *header; + u_char *p; + ngx_list_part_t *part; + ngx_http_request_t *pr; + ngx_uint_t i; + + r->headers_in.content_length_n = len; + + if (ngx_list_init(&r->headers_in.headers, r->pool, 20, + sizeof(ngx_table_elt_t)) + != NGX_OK) + { + return NGX_ERROR; + } + + h = ngx_list_push(&r->headers_in.headers); + if (h == NULL) { + return NGX_ERROR; + } + + h->key = ngx_http_echo_content_length_header_key; + h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); + if (h->lowcase_key == NULL) { + return NGX_ERROR; + } + + ngx_strlow(h->lowcase_key, h->key.data, h->key.len); + + r->headers_in.content_length = h; + + p = ngx_palloc(r->pool, NGX_OFF_T_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + h->value.data = p; + + h->value.len = ngx_sprintf(h->value.data, "%O", len) - h->value.data; + + h->hash = ngx_http_echo_content_length_hash; + + dd("r content length: %.*s", + (int) r->headers_in.content_length->value.len, + r->headers_in.content_length->value.data); + + pr = r->parent; + + if (pr == NULL) { + return NGX_OK; + } + + /* forward the parent request's all other request headers */ + + part = &pr->headers_in.headers.part; + header = part->elts; + + for (i = 0; /* void */; i++) { + + if (i >= part->nelts) { + if (part->next == NULL) { + break; + } + + part = part->next; + header = part->elts; + i = 0; + } + + if (header[i].key.len == sizeof("Content-Length") - 1 + && ngx_strncasecmp(header[i].key.data, (u_char *) "Content-Length", + sizeof("Content-Length") - 1) + == 0) + { + continue; + } + + h = ngx_list_push(&r->headers_in.headers); + if (h == NULL) { + return NGX_ERROR; + } + + *h = header[i]; + } + + /* XXX maybe we should set those built-in header slot in + * ngx_http_headers_in_t too? */ + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.h new file mode 100644 index 0000000..61c0a04 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_subrequest.h @@ -0,0 +1,19 @@ +#ifndef ECHO_SUBREQUEST_H +#define ECHO_SUBREQUEST_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_exec_echo_subrequest(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +ngx_int_t ngx_http_echo_exec_echo_subrequest_async(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +ngx_int_t ngx_http_echo_exec_abort_parent(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); + +ngx_int_t ngx_http_echo_exec_exec(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_array_t *computed_args); + +#endif /* ECHO_SUBREQUEST_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c new file mode 100644 index 0000000..e2777ee --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.c @@ -0,0 +1,95 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif + +#include "ddebug.h" + +#include "ngx_http_echo_timer.h" +#include "ngx_http_echo_util.h" + +#include +#include +#include + + +ngx_int_t +ngx_http_echo_timer_elapsed_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + ngx_http_echo_ctx_t *ctx; + ngx_msec_int_t ms; + u_char *p; + ngx_time_t *tp; + size_t size; + + ctx = ngx_http_get_module_ctx(r, ngx_http_echo_module); + if (ctx == NULL) { + ctx = ngx_http_echo_create_ctx(r); + if (ctx == NULL) { + return NGX_ERROR; + } + + ngx_http_set_ctx(r, ctx, ngx_http_echo_module); + } + + if (ctx->timer_begin.sec == 0) { + ctx->timer_begin.sec = r->start_sec; + ctx->timer_begin.msec = (ngx_msec_t) r->start_msec; + } + + /* force the ngx timer to update */ + +#if (nginx_version >= 8035) || (nginx_version < 8000 && nginx_version >= 7066) + ngx_time_update(); +#else + ngx_time_update(0, 0); +#endif + + tp = ngx_timeofday(); + + dd("old sec msec: %ld %d\n", (long) ctx->timer_begin.sec, + (int) ctx->timer_begin.msec); + + dd("new sec msec: %ld %d\n", (long) tp->sec, (int) tp->msec); + + ms = (ngx_msec_int_t) + ((tp->sec - ctx->timer_begin.sec) * 1000 + + (tp->msec - ctx->timer_begin.msec)); + ms = (ms >= 0) ? ms : 0; + + size = sizeof("-9223372036854775808.000") - 1; + + p = ngx_palloc(r->pool, size); + if (p == NULL) { + return NGX_ERROR; + } + + v->len = ngx_snprintf(p, size, "%T.%03M", ms / 1000, ms % 1000) - p; + v->data = p; + + v->valid = 1; + v->no_cacheable = 1; + v->not_found = 0; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_exec_echo_reset_timer(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ + dd("Exec timer..."); + + /* force the ngx timer to update */ + +#if (nginx_version >= 8035) || (nginx_version < 8000 && nginx_version >= 7066) + ngx_time_update(); +#else + ngx_time_update(0, 0); +#endif + + ctx->timer_begin = *ngx_timeofday(); + return NGX_OK; +} + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.h new file mode 100644 index 0000000..b6e7ff3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_timer.h @@ -0,0 +1,13 @@ +#ifndef ECHO_TIMER_H +#define ECHO_TIMER_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_timer_elapsed_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +ngx_int_t ngx_http_echo_exec_echo_reset_timer(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); + +#endif /* ECHO_TIMER_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c new file mode 100644 index 0000000..fed0587 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.c @@ -0,0 +1,302 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_echo_util.h" +#include "ngx_http_echo_sleep.h" + + +ngx_uint_t ngx_http_echo_content_length_hash = 0; + + +ngx_http_echo_ctx_t * +ngx_http_echo_create_ctx(ngx_http_request_t *r) +{ + ngx_http_echo_ctx_t *ctx; + + ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_echo_ctx_t)); + if (ctx == NULL) { + return NULL; + } + + ctx->sleep.handler = ngx_http_echo_sleep_event_handler; + ctx->sleep.data = r; + ctx->sleep.log = r->connection->log; + + return ctx; +} + + +ngx_int_t +ngx_http_echo_eval_cmd_args(ngx_http_request_t *r, + ngx_http_echo_cmd_t *cmd, ngx_array_t *computed_args, + ngx_array_t *opts) +{ + unsigned expecting_opts = 1; + ngx_uint_t i; + ngx_array_t *args = cmd->args; + ngx_str_t *arg, *raw, *opt; + ngx_http_echo_arg_template_t *value; + + value = args->elts; + + for (i = 0; i < args->nelts; i++) { + raw = &value[i].raw_value; + + if (value[i].lengths == NULL && raw->len > 0) { + if (expecting_opts) { + if (raw->len == 1 || raw->data[0] != '-') { + expecting_opts = 0; + + } else if (raw->data[1] == '-') { + expecting_opts = 0; + continue; + + } else { + opt = ngx_array_push(opts); + if (opt == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + opt->len = raw->len - 1; + opt->data = raw->data + 1; + + dd("pushing opt: %.*s", (int) opt->len, opt->data); + + continue; + } + } + + } else { + expecting_opts = 0; + } + + arg = ngx_array_push(computed_args); + if (arg == NULL) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + if (value[i].lengths == NULL) { /* does not contain vars */ + dd("Using raw value \"%.*s\"", (int) raw->len, raw->data); + *arg = *raw; + + } else { + if (ngx_http_script_run(r, arg, value[i].lengths->elts, + 0, value[i].values->elts) + == NULL) + { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + } + + dd("pushed arg: %.*s", (int) arg->len, arg->data); + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_echo_send_chain_link(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_chain_t *in) +{ + ngx_int_t rc; + + rc = ngx_http_echo_send_header_if_needed(r, ctx); + + if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) { + return rc; + } + + if (in == NULL) { + +#if defined(nginx_version) && nginx_version <= 8004 + + /* earlier versions of nginx does not allow subrequests + to send last_buf themselves */ + if (r != r->main) { + return NGX_OK; + } + +#endif + + rc = ngx_http_send_special(r, NGX_HTTP_LAST); + if (rc >= NGX_HTTP_SPECIAL_RESPONSE) { + return rc; + } + + return NGX_OK; + } + + /* FIXME we should udpate chains to recycle chain links and bufs */ + return ngx_http_output_filter(r, in); +} + + +ngx_int_t +ngx_http_echo_send_header_if_needed(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx) +{ + ngx_int_t rc; + ngx_http_echo_loc_conf_t *elcf; + + if (!r->header_sent && !ctx->header_sent) { + elcf = ngx_http_get_module_loc_conf(r, ngx_http_echo_module); + + r->headers_out.status = (ngx_uint_t) elcf->status; + + if (ngx_http_set_content_type(r) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; + } + + ngx_http_clear_content_length(r); + ngx_http_clear_accept_ranges(r); + + rc = ngx_http_send_header(r); + ctx->header_sent = 1; + return rc; + } + + return NGX_OK; +} + + +ssize_t +ngx_http_echo_atosz(u_char *line, size_t n) +{ + ssize_t value; + + if (n == 0) { + return NGX_ERROR; + } + + for (value = 0; n--; line++) { + if (*line == '_') { /* we ignore undercores */ + continue; + } + + if (*line < '0' || *line > '9') { + return NGX_ERROR; + } + + value = value * 10 + (*line - '0'); + } + + if (value < 0) { + return NGX_ERROR; + } + + return value; +} + + +/* Modified from the ngx_strlcasestrn function in ngx_string.h + * Copyright (C) by Igor Sysoev */ +u_char * +ngx_http_echo_strlstrn(u_char *s1, u_char *last, u_char *s2, size_t n) +{ + ngx_uint_t c1, c2; + + c2 = (ngx_uint_t) *s2++; + last -= n; + + do { + do { + if (s1 >= last) { + return NULL; + } + + c1 = (ngx_uint_t) *s1++; + + } while (c1 != c2); + + } while (ngx_strncmp(s1, s2, n) != 0); + + return --s1; +} + + +ngx_int_t +ngx_http_echo_post_request_at_head(ngx_http_request_t *r, + ngx_http_posted_request_t *pr) +{ + dd_enter(); + + if (pr == NULL) { + pr = ngx_palloc(r->pool, sizeof(ngx_http_posted_request_t)); + if (pr == NULL) { + return NGX_ERROR; + } + } + + pr->request = r; + pr->next = r->main->posted_requests; + r->main->posted_requests = pr; + + return NGX_OK; +} + + +u_char * +ngx_http_echo_rebase_path(ngx_pool_t *pool, u_char *src, size_t osize, + size_t *nsize) +{ + u_char *p, *dst; + + if (osize == 0) { + return NULL; + } + + if (src[0] == '/') { + /* being an absolute path already, just add a trailing '\0' */ + *nsize = osize; + + dst = ngx_palloc(pool, *nsize + 1); + if (dst == NULL) { + *nsize = 0; + return NULL; + } + + p = ngx_copy(dst, src, osize); + *p = '\0'; + + return dst; + } + + *nsize = ngx_cycle->prefix.len + osize; + + dst = ngx_palloc(pool, *nsize + 1); + if (dst == NULL) { + *nsize = 0; + return NULL; + } + + p = ngx_copy(dst, ngx_cycle->prefix.data, ngx_cycle->prefix.len); + p = ngx_copy(p, src, osize); + + *p = '\0'; + + return dst; +} + + +ngx_int_t +ngx_http_echo_flush_postponed_outputs(ngx_http_request_t *r) +{ + if (r == r->connection->data && r->postponed) { + /* notify the downstream postpone filter to flush the postponed + * outputs of the current request */ + return ngx_http_output_filter(r, NULL); + } + + /* do nothing */ + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h new file mode 100644 index 0000000..d620d09 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_util.h @@ -0,0 +1,58 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef NGX_HTTP_ECHO_UTIL_H +#define NGX_HTTP_ECHO_UTIL_H + + +#include "ngx_http_echo_module.h" + + +#define ngx_http_echo_strcmp_const(a, b) \ + ngx_strncmp(a, b, sizeof(b) - 1) + + +#define ngx_http_echo_hash_literal(s) \ + ngx_http_echo_hash_str((u_char *) s, sizeof(s) - 1) + + +static ngx_inline ngx_uint_t +ngx_http_echo_hash_str(u_char *src, size_t n) +{ + ngx_uint_t key; + + key = 0; + + while (n--) { + key = ngx_hash(key, *src); + src++; + } + + return key; +} + + +extern ngx_uint_t ngx_http_echo_content_length_hash; + + +ngx_http_echo_ctx_t *ngx_http_echo_create_ctx(ngx_http_request_t *r); +ngx_int_t ngx_http_echo_eval_cmd_args(ngx_http_request_t *r, + ngx_http_echo_cmd_t *cmd, ngx_array_t *computed_args, + ngx_array_t *opts); +ngx_int_t ngx_http_echo_send_header_if_needed(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx); +ngx_int_t ngx_http_echo_send_chain_link(ngx_http_request_t *r, + ngx_http_echo_ctx_t *ctx, ngx_chain_t *cl); +ssize_t ngx_http_echo_atosz(u_char *line, size_t n); +u_char *ngx_http_echo_strlstrn(u_char *s1, u_char *last, u_char *s2, size_t n); +ngx_int_t ngx_http_echo_post_request_at_head(ngx_http_request_t *r, + ngx_http_posted_request_t *pr); +u_char *ngx_http_echo_rebase_path(ngx_pool_t *pool, u_char *src, size_t osize, + size_t *nsize); +ngx_int_t ngx_http_echo_flush_postponed_outputs(ngx_http_request_t *r); + + +#endif /* NGX_HTTP_ECHO_UTIL_H */ diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.c b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.c new file mode 100644 index 0000000..138a510 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.c @@ -0,0 +1,110 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_echo_var.h" +#include "ngx_http_echo_timer.h" +#include "ngx_http_echo_request_info.h" +#include "ngx_http_echo_foreach.h" + + +static ngx_int_t ngx_http_echo_incr_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + + +static ngx_http_variable_t ngx_http_echo_variables[] = { + + { ngx_string("echo_timer_elapsed"), NULL, + ngx_http_echo_timer_elapsed_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_request_method"), NULL, + ngx_http_echo_request_method_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_cacheable_request_uri"), NULL, + ngx_http_echo_cacheable_request_uri_variable, 0, + 0, 0 }, + + { ngx_string("echo_request_uri"), NULL, + ngx_http_echo_request_uri_variable, 0, + 0, 0 }, + + { ngx_string("echo_client_request_method"), NULL, + ngx_http_echo_client_request_method_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_request_body"), NULL, + ngx_http_echo_request_body_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_client_request_headers"), NULL, + ngx_http_echo_client_request_headers_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_it"), NULL, + ngx_http_echo_it_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_incr"), NULL, + ngx_http_echo_incr_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_string("echo_response_status"), NULL, + ngx_http_echo_response_status_variable, 0, + NGX_HTTP_VAR_NOCACHEABLE, 0 }, + + { ngx_null_string, NULL, NULL, 0, 0, 0 } +}; + + +ngx_int_t +ngx_http_echo_add_variables(ngx_conf_t *cf) +{ + ngx_http_variable_t *var, *v; + + for (v = ngx_http_echo_variables; v->name.len; v++) { + var = ngx_http_add_variable(cf, &v->name, v->flags); + if (var == NULL) { + return NGX_ERROR; + } + + var->get_handler = v->get_handler; + var->data = v->data; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_echo_incr_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data) +{ + ngx_http_echo_ctx_t *ctx; + u_char *p; + + ctx = ngx_http_get_module_ctx(r->main, ngx_http_echo_module); + + if (ctx == NULL) { + return NGX_ERROR; + } + + ctx->counter++; + + p = ngx_palloc(r->pool, NGX_INT_T_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + v->len = ngx_sprintf(p, "%ui", ctx->counter) - p; + v->data = p; + + v->valid = 1; + v->not_found = 0; + v->no_cacheable = 1; + + return NGX_OK; +} + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.h b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.h new file mode 100644 index 0000000..8b24e02 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/src/ngx_http_echo_var.h @@ -0,0 +1,9 @@ +#ifndef ECHO_VAR_H +#define ECHO_VAR_H + +#include "ngx_http_echo_module.h" + +ngx_int_t ngx_http_echo_add_variables(ngx_conf_t *cf); + +#endif /* ECHO_VAR_H */ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/abort-parent.t b/modules_deb/libnginx-mod-http-echo-0.63/t/abort-parent.t new file mode 100644 index 0000000..6137607 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/abort-parent.t @@ -0,0 +1,63 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::LWP skip_all => + 'not working at all'; + +plan tests => 2 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /abort { + echo hello; + echo_flush; + echo_location_async '/foo'; + echo_location_async '/bar'; + echo_location_async '/baz'; + echo world; + echo_flush; + } + + location /proxy { + proxy_pass "http://127.0.0.1:$server_port/sleep?$query_string"; + } + + location /sleep { + echo_sleep $arg_sleep; + echo $arg_echo; + echo_flush; + } + + location /foo { + echo_location '/proxy?sleep=1&echo=foo'; + #echo_flush; + echo_abort_parent; + } + + location /bar { + proxy_pass 'http://127.0.0.1:$server_port/sleep_bar'; + } + + location /baz { + proxy_pass 'http://127.0.0.1:$server_port/sleep_baz'; + } + + location /sleep_bar { + echo_sleep 2; + echo bar; + } + + location /sleep_baz { + echo_sleep 3; + echo baz; + } +--- request + GET /abort +--- response_body +hello +bar + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/blocking-sleep.t b/modules_deb/libnginx-mod-http-echo-0.63/t/blocking-sleep.t new file mode 100644 index 0000000..0bdc6cc --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/blocking-sleep.t @@ -0,0 +1,156 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /echo { + echo_blocking_sleep 1; + } +--- request + GET /echo +--- response_body + + + +=== TEST 2: fractional delay +--- config + location /echo { + echo_blocking_sleep 0.01; + } +--- request + GET /echo +--- response_body + + + +=== TEST 3: leading echo +--- config + location /echo { + echo before...; + echo_blocking_sleep 0.01; + } +--- request + GET /echo +--- response_body +before... + + + +=== TEST 4: trailing echo +--- config + location /echo { + echo_blocking_sleep 0.01; + echo after...; + } +--- request + GET /echo +--- response_body +after... + + + +=== TEST 5: two echos around sleep +--- config + location /echo { + echo before...; + echo_blocking_sleep 0.01; + echo after...; + } +--- request + GET /echo +--- response_body +before... +after... + + + +=== TEST 6: interleaving sleep and echo +--- config + location /echo { + echo 1; + echo_blocking_sleep 0.01; + echo 2; + echo_blocking_sleep 0.01; + } +--- request + GET /echo +--- response_body +1 +2 + + + +=== TEST 7: interleaving sleep and echo with echo at the end... +--- config + location /echo { + echo 1; + echo_blocking_sleep 0.01; + echo 2; + echo_blocking_sleep 0.01; + echo 3; + } +--- request + GET /echo +--- response_body +1 +2 +3 + + + +=== TEST 8: flush before sleep +we didn't really test the actual effect of "echo_flush" here... +merely checks if it croaks if appears. +--- config + location /flush { + echo hi; + echo_flush; + echo_blocking_sleep 0.01; + echo trees; + } +--- request + GET /flush +--- response_body +hi +trees + + + +=== TEST 9: flush does not increment opcode pointer itself +--- config + location /flush { + echo hi; + echo_flush; + echo trees; + } +--- request + GET /flush +--- response_body +hi +trees + + + +=== TEST 10: blocking sleep by variable +--- config + location ~ ^/sleep/(.+) { + echo before...; + echo_blocking_sleep $1; + echo after...; + } +--- request + GET /sleep/0.01 +--- response_body +before... +after... + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-after-body.t b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-after-body.t new file mode 100644 index 0000000..44c4c72 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-after-body.t @@ -0,0 +1,261 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (2 * blocks() + 1); + +no_long_string(); +log_level('warn'); + +#master_on(); +#workers(1); + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- http_config + postpone_output 1; +--- config + location /echo { + echo_after_body hello; + echo world; + } +--- request + GET /echo +--- response_body +world +hello + + + +=== TEST 2: echo after proxy +--- config + location /echo { + echo_after_body hello; + proxy_pass http://127.0.0.1:$server_port$request_uri/more; + } + location /echo/more { + echo world; + } +--- request + GET /echo +--- response_body +world +hello + + + +=== TEST 3: with variables +--- config + location /echo { + echo_after_body $request_method; + echo world; + } +--- request + GET /echo +--- response_body +world +GET + + + +=== TEST 4: w/o args +--- config + location /echo { + echo_after_body; + echo world; + } +--- request + GET /echo +--- response_body eval +"world\n\n" + + + +=== TEST 5: order is not important +--- config + location /reversed { + echo world; + echo_after_body hello; + } +--- request + GET /reversed +--- response_body +world +hello + + + +=== TEST 6: multiple echo_after_body instances +--- config + location /echo { + echo_after_body hello; + echo_after_body world; + echo !; + } +--- request + GET /echo +--- response_body +! +hello +world + + + +=== TEST 7: multiple echo_after_body instances with multiple echo cmds +--- config + location /echo { + echo_after_body hello; + echo_after_body world; + echo i; + echo say; + } +--- request + GET /echo +--- response_body +i +say +hello +world + + + +=== TEST 8: echo-after-body & echo-before-body +--- config + location /mixed { + echo_before_body hello; + echo_after_body world; + echo_before_body hiya; + echo_after_body igor; + echo ////////; + } +--- request + GET /mixed +--- response_body +hello +hiya +//////// +world +igor + + + +=== TEST 9: echo around proxy +--- config + location /echo { + echo_before_body hello; + echo_before_body world; + #echo $scheme://$host:$server_port$request_uri/more; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + echo_after_body hiya; + echo_after_body igor; + } + location /echo/more { + echo blah; + } +--- request + GET /echo +--- response_body +hello +world +blah +hiya +igor + + + +=== TEST 10: with $echo_response_status +--- config + location /status { + echo_after_body "status: $echo_response_status"; + return 404; + } +--- request + GET /status +--- response_body_like +.*404 Not Found.* +status: 404$ +--- error_code: 404 + + + +=== TEST 11: in subrequests +--- config + location /main { + echo_location_async /hello; + } + location /hello { + echo_after_body 'world!'; + echo 'hello'; + } +--- request + GET /main +--- response_body +hello +world! + + + +=== TEST 12: echo_after_body + gzip +--- config + gzip on; + gzip_min_length 1; + location /main { + echo_after_body 'world!'; + echo_duplicate 1024 'hello'; + } +--- request + GET /main +--- response_body_like +hello +--- SKIP + + + +=== TEST 13: echo_after_body + proxy output +--- config + #gzip on; + #gzip_min_length 1; + location /main { + echo_after_body 'world'; + proxy_pass http://127.0.0.1:$server_port/foo; + } + location /foo { + echo_duplicate 10 hello; + } +--- request + GET /main +--- response_body_like +^(?:hello){10}world$ + + + +=== TEST 14: in subrequests (we get last_in_chain set properly) +--- config + location /main { + echo_location_async /hello; + } + location /hello { + echo 'hello'; + echo_after_body 'world!'; + body_filter_by_lua ' + local eof = ngx.arg[2] + if eof then + print("lua: eof found in body") + end + '; + } +--- request + GET /main +--- response_body +hello +world! +--- log_level: notice +--- error_log +lua: eof found in body + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-before-body.t b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-before-body.t new file mode 100644 index 0000000..1513184 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-before-body.t @@ -0,0 +1,278 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /echo { + echo_before_body hello; + echo world; + } +--- request + GET /echo +--- response_body +hello +world + + + +=== TEST 2: echo before proxy +--- config + location /echo { + echo_before_body hello; + proxy_pass $scheme://127.0.0.1:$server_port$request_uri/more; + } + location /echo/more { + echo world; + } +--- request + GET /echo +--- response_body +hello +world + + + +=== TEST 3: with variables +--- config + location /echo { + echo_before_body $request_method; + echo world; + } +--- request + GET /echo +--- response_body +GET +world + + + +=== TEST 4: w/o args +--- config + location /echo { + echo_before_body; + echo world; + } +--- request + GET /echo +--- response_body eval +"\nworld\n" + + + +=== TEST 5: order is not important +--- config + location /reversed { + echo world; + echo_before_body hello; + } +--- request + GET /reversed +--- response_body +hello +world + + + +=== TEST 6: multiple echo_before_body instances +--- config + location /echo { + echo_before_body hello; + echo_before_body world; + echo !; + } +--- request + GET /echo +--- response_body +hello +world +! + + + +=== TEST 7: multiple echo_before_body instances with multiple echo cmds +--- config + location /echo { + echo_before_body hello; + echo_before_body world; + echo i; + echo say; + } +--- request + GET /echo +--- response_body +hello +world +i +say + + + +=== TEST 8: with $echo_response_status +--- config + location /status { + echo_before_body "status: $echo_response_status"; + return 404; + } +--- request + GET /status +--- response_body_like +status: 404 +.*404 Not Found.*$ +--- error_code: 404 + + + +=== TEST 9: $echo_response_status in echo_before_body in subrequests +--- config + location /main { + echo_location '/status?val=403'; + echo_location '/status?val=500'; + } + location /status { + if ($arg_val = 500) { + echo_before_body "status: $echo_response_status"; + return 500; + break; + } + if ($arg_val = 403) { + echo_before_body "status: $echo_response_status"; + return 403; + break; + } + return 200; + } +--- request + GET /main +--- response_body_like +^status: 403.*?status: 500.*$ + + + +=== TEST 10: echo -n +--- config + location /echo { + echo_before_body -n hello; + echo_before_body -n world; + echo ==; + } +--- request + GET /echo +--- response_body +helloworld== + + + +=== TEST 11: echo a -n +--- config + location /echo { + echo_before_body a -n hello; + echo_before_body b -n world; + echo ==; + } +--- request + GET /echo +--- response_body +a -n hello +b -n world +== + + + +=== TEST 12: -n in a var +--- config + location /echo { + set $opt -n; + echo_before_body $opt hello; + echo_before_body $opt world; + echo ==; + } +--- request + GET /echo +--- response_body +-n hello +-n world +== + + + +=== TEST 13: -n only +--- config + location /echo { + echo_before_body -n; + echo_before_body -n; + echo ==; + } +--- request + GET /echo +--- response_body +== + + + +=== TEST 14: -n with an empty string +--- config + location /echo { + echo_before_body -n ""; + set $empty ""; + echo_before_body -n $empty; + echo ==; + } +--- request + GET /echo +--- response_body +== + + + +=== TEST 15: -- -n +--- config + location /echo { + echo_before_body -- -n hello; + echo_before_body -- -n world; + echo ==; + } +--- request + GET /echo +--- response_body +-n hello +-n world +== + + + +=== TEST 16: -n -n +--- config + location /echo { + echo_before_body -n -n hello; + echo_before_body -n -n world; + echo ==; + } +--- request + GET /echo +--- response_body +helloworld== + + + +=== TEST 17: -n -- -n +--- config + location /echo { + echo_before_body -n -- -n hello; + echo_before_body -n -- -n world; + echo ==; + } +--- request + GET /echo +--- response_body +-n hello-n world== + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-duplicate.t b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-duplicate.t new file mode 100644 index 0000000..82b6725 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-duplicate.t @@ -0,0 +1,89 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /dup { + echo_duplicate 3 a; + } +--- request + GET /dup +--- response_body: aaa + + + +=== TEST 2: abc abc +--- config + location /dup { + echo_duplicate 2 abc; + } +--- request + GET /dup +--- response_body: abcabc + + + +=== TEST 3: big size with underscores +--- config + location /dup { + echo_duplicate 10_000 A; + } +--- request + GET /dup +--- response_body eval +'A' x 10_000 + + + +=== TEST 4: 0 duplicate 0 empty strings +--- config + location /dup { + echo_duplicate 0 ""; + } +--- request + GET /dup +--- response_body + + + +=== TEST 5: 0 duplicate non-empty strings +--- config + location /dup { + echo_duplicate 0 "abc"; + } +--- request + GET /dup +--- response_body + + + +=== TEST 6: duplication of empty strings +--- config + location /dup { + echo_duplicate 2 ""; + } +--- request + GET /dup +--- response_body + + + +=== TEST 7: sanity (HEAD) +--- config + location /dup { + echo_duplicate 3 a; + } +--- request + HEAD /dup +--- response_body + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo-timer.t b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-timer.t new file mode 100644 index 0000000..712524d --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/echo-timer.t @@ -0,0 +1,107 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: timer without explicit reset +--- config + location /timer { + echo_sleep 0.03; + echo "elapsed $echo_timer_elapsed sec."; + } +--- request + GET /timer +--- response_body_like +^elapsed 0\.0(2[6-9]|3[0-6]) sec\.$ + + + +=== TEST 2: timer without explicit reset and sleep +--- config + location /timer { + echo "elapsed $echo_timer_elapsed sec."; + } +--- request + GET /timer +--- response_body_like +^elapsed 0\.00[0-5] sec\.$ + + + +=== TEST 3: timing accumulated sleeps +--- config + location /timer { + echo_sleep 0.03; + echo_sleep 0.02; + echo "elapsed $echo_timer_elapsed sec."; + } +--- request + GET /timer +--- response_body_like +^elapsed 0\.0(4[6-9]|5[0-6]) sec\.$ + + + +=== TEST 4: timer with explicit reset but without sleep +--- config + location /timer { + echo_reset_timer; + echo "elapsed $echo_timer_elapsed sec."; + } +--- request + GET /timer +--- response_body_like +^elapsed 0\.00[0-5] sec\.$ + + + +=== TEST 5: reset timer between sleeps +--- config + location /timer { + echo_sleep 0.02; + echo "elapsed $echo_timer_elapsed sec."; + echo_reset_timer; + echo_sleep 0.03; + echo "elapsed $echo_timer_elapsed sec."; + } +--- request + GET /timer +--- response_body_like +^elapsed 0\.0(1[6-9]|2[0-6]) sec\. +elapsed 0\.0(2[6-9]|3[0-6]) sec\.$ + + + +=== TEST 6: reset timer between blocking sleeps +--- config + location /timer { + echo_blocking_sleep 0.02; + echo "elapsed $echo_timer_elapsed sec."; + echo_reset_timer; + echo_blocking_sleep 0.03; + echo "elapsed $echo_timer_elapsed sec."; + } +--- request + GET /timer +--- response_body_like +^elapsed 0\.0(1[6-9]|2[0-9]) sec\. +elapsed 0\.0(2[6-9]|3[0-6]) sec\.$ + + + +=== TEST 7: timer without explicit reset +--- config + location = /timer { + return 200 "$echo_timer_elapsed"; + } +--- request + GET /timer +--- response_body_like chop +^0(\.0\d*)$ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/echo.t b/modules_deb/libnginx-mod-http-echo-0.63/t/echo.t new file mode 100644 index 0000000..b181259 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/echo.t @@ -0,0 +1,416 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (2 * blocks() + 6); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /echo { + echo hello; + } +--- request + GET /echo +--- response_body +hello + + + +=== TEST 2: multiple args +--- config + location /echo { + echo say hello world; + } +--- request + GET /echo +--- response_body +say hello world + + + +=== TEST 3: multiple directive instances +--- config + location /echo { + echo say that; + echo hello; + echo world !; + } +--- request + GET /echo +--- response_body +say that +hello +world ! + + + +=== TEST 4: echo without arguments +--- config + location /echo { + echo; + echo; + } +--- request + GET /echo +--- response_body eval +"\n\n" + + + +=== TEST 5: escaped newline +--- config + location /echo { + echo "hello\nworld"; + } +--- request + GET /echo +--- response_body +hello +world + + + +=== TEST 6: escaped tabs and \r and " wihtin "..." +--- config + location /echo { + echo "i say \"hello\tworld\"\r"; + } +--- request + GET /echo +--- response_body eval: "i say \"hello\tworld\"\r\n" + + + +=== TEST 7: escaped tabs and \r and " in single quotes +--- config + location /echo { + echo 'i say \"hello\tworld\"\r'; + } +--- request + GET /echo +--- response_body eval: "i say \"hello\tworld\"\r\n" + + + +=== TEST 8: escaped tabs and \r and " w/o any quotes +--- config + location /echo { + echo i say \"hello\tworld\"\r; + } +--- request + GET /echo +--- response_body eval: "i say \"hello\tworld\"\r\n" + + + +=== TEST 9: escaping $ +As of Nginx 0.8.20, there's still no way to escape the '$' character. +--- config + location /echo { + echo \$; + } +--- request + GET /echo +--- response_body +$ +--- SKIP + + + +=== TEST 10: XSS +--- config + location /blah { + echo_duplicate 1 "$arg_callback("; + echo_location_async "/data?$uri"; + echo_duplicate 1 ")"; + } + location /data { + echo_duplicate 1 '{"dog":"$query_string"}'; + } +--- request + GET /blah/9999999.json?callback=ding1111111 +--- response_body chomp +ding1111111({"dog":"/blah/9999999.json"}) + + + +=== TEST 11: XSS - filter version +--- config + location /blah { + echo_before_body "$arg_callback("; + + echo_duplicate 1 '{"dog":"$uri"}'; + + echo_after_body ")"; + } +--- request + GET /blah/9999999.json?callback=ding1111111 +--- response_body +ding1111111( +{"dog":"/blah/9999999.json"}) + + + +=== TEST 12: if +--- config +location /first { + echo "before"; + echo_location_async /second $request_uri; + echo "after"; +} + +location = /second { + if ($query_string ~ '([^?]+)') { + set $memcached_key $1; # needing this to be keyed on the request_path, not the entire uri + echo $memcached_key; + } +} +--- request + GET /first/9999999.json?callback=ding1111111 +--- response_body +before +/first/9999999.json +after + + + +=== TEST 13: echo -n +--- config + location /echo { + echo -n hello; + echo -n world; + } +--- request + GET /echo +--- response_body chop +helloworld + + + +=== TEST 14: echo a -n +--- config + location /echo { + echo a -n hello; + echo b -n world; + } +--- request + GET /echo +--- response_body +a -n hello +b -n world + + + +=== TEST 15: -n in a var +--- config + location /echo { + set $opt -n; + echo $opt hello; + echo $opt world; + } +--- request + GET /echo +--- response_body +-n hello +-n world + + + +=== TEST 16: -n only +--- config + location /echo { + echo -n; + echo -n; + } +--- request + GET /echo +--- response_body chop + + + +=== TEST 17: -n with an empty string +--- config + location /echo { + echo -n ""; + set $empty ""; + echo -n $empty; + } +--- request + GET /echo +--- response_body chop + + + +=== TEST 18: -- -n +--- config + location /echo { + echo -- -n hello; + echo -- -n world; + } +--- request + GET /echo +--- response_body +-n hello +-n world + + + +=== TEST 19: -n -n +--- config + location /echo { + echo -n -n hello; + echo -n -n world; + } +--- request + GET /echo +--- response_body chop +helloworld + + + +=== TEST 20: -n -- -n +--- config + location /echo { + echo -n -- -n hello; + echo -n -- -n world; + } +--- request + GET /echo +--- response_body chop +-n hello-n world + + + +=== TEST 21: proxy +--- config + location /main { + proxy_pass http://127.0.0.1:$server_port/echo; + } + location /echo { + echo hello; + echo world; + } +--- request + GET /main +--- response_headers +!Content-Length +--- response_body +hello +world + + + +=== TEST 22: if is evil +--- config + location /test { + set $a 3; + set_by_lua $a ' + if ngx.var.a == "3" then + return 4 + end + '; + echo $a; + } +--- request + GET /test +--- response_body +4 +--- SKIP + + + +=== TEST 23: HEAD +--- config + location /echo { + echo hello; + echo world; + } +--- request + HEAD /echo +--- response_body + + + +=== TEST 24: POST +--- config + location /echo { + echo hello; + echo world; + } +--- pipelined_requests eval +["POST /echo +blah blah", "POST /echo +foo bar baz"] +--- response_body eval +["hello\nworld\n","hello\nworld\n"] + + + +=== TEST 25: POST +--- config + location /echo { + echo_sleep 0.001; + echo hello; + echo world; + } +--- pipelined_requests eval +["POST /echo +blah blah", "POST /echo +foo bar baz"] +--- response_body eval +["hello\nworld\n","hello\nworld\n"] + + + +=== TEST 26: empty arg after -n (github issue #33) +--- config + location = /t { + set $empty ""; + echo -n $empty hello world; + } +--- request + GET /t +--- response_body chop + hello world + + + +=== TEST 27: image filter +--- config + location = /gif { + empty_gif; + } + + location = /t { + default_type image/gif; + image_filter resize 10 10; + set $gif1 ''; + set $gif2 ''; + rewrite_by_lua ' + local res = ngx.location.capture("/gif") + local data = res.body + ngx.var.gif1 = string.sub(data, 1, #data - 1) + ngx.var.gif2 = string.sub(data, #data) + '; + echo -n $gif1; + echo -n $gif2; + } +--- request + GET /t +--- stap +F(ngx_http_image_header_filter) { + println("image header filter") +} +--- stap_out +image header filter +--- response_body_like: . + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/exec.t b/modules_deb/libnginx-mod-http-echo-0.63/t/exec.t new file mode 100644 index 0000000..b7c1308 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/exec.t @@ -0,0 +1,228 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (2 * blocks() + 1); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: exec normal location +--- config + location /main { + echo_exec /bar; + echo end; + } + location = /bar { + echo "$echo_request_uri:"; + echo bar; + } +--- request + GET /main +--- response_body +/bar: +bar + + + +=== TEST 2: location with args (inlined in uri) +--- config + location /main { + echo_exec /bar?a=32; + echo end; + } + location /bar { + echo "a: [$arg_a]"; + } +--- request + GET /main +--- response_body +a: [32] + + + +=== TEST 3: location with args (in separate arg) +--- config + location /main { + echo_exec /bar a=56; + echo end; + } + location /bar { + echo "a: [$arg_a]"; + } +--- request + GET /main +--- response_body +a: [56] + + + +=== TEST 4: exec named location +--- config + location /main { + echo_exec @bar; + echo end; + } + location @bar { + echo bar; + } +--- request + GET /main +--- response_body +bar + + + +=== TEST 5: query string ignored for named locations +--- config + location /main { + echo_exec @bar?a=32; + echo end; + } + location @bar { + echo "a: [$arg_a]"; + } +--- request + GET /main +--- response_body +a: [] +--- error_log +querystring a=32 ignored when exec'ing named location @bar + + + +=== TEST 6: query string ignored for named locations +--- config + location /foo { + echo_exec @bar; + } + location @bar { + echo "uri: [$echo_request_uri]"; + } +--- request + GET /foo +--- response_body +uri: [/foo] + + + +=== TEST 7: exec(named location) in subrequests +--- config + location /entry { + echo_location /foo; + echo_sleep 0.001; + echo_location /foo2; + } + location /foo { + echo_exec @bar; + } + location /foo2 { + echo_exec @bar; + } + + location @bar { + proxy_pass http://127.0.0.1:$server_port/bar; + } + location /bar { + echo_sleep 0.01; + echo hello; + } +--- request + GET /entry +--- response_body +hello +hello + + + +=== TEST 8: exec(normal loctions) in subrequests +--- config + location /entry { + echo_location /foo; + echo_sleep 0.001; + echo_location /foo2; + } + location /foo { + echo_exec /baz; + } + location /foo2 { + echo_exec /baz; + } + + location /baz { + proxy_pass http://127.0.0.1:$server_port/bar; + } + location /bar { + echo_sleep 0.01; + echo hello; + } +--- request + GET /entry +--- response_body +hello +hello + + + +=== TEST 9: exec should clear ctx +--- config + location @bar { + echo hello; + echo world; + echo heh; + } + location /foo { + #echo_sleep 0.001; + echo_reset_timer; + echo_exec @bar; + } +--- request + GET /foo +--- response_body +hello +world +heh + + + +=== TEST 10: reset ctx +--- config + location @proxy { + rewrite_by_lua return; + echo hello; + } + location /main { + rewrite_by_lua return; + echo_exec @proxy; + } +--- request + GET /main +--- response_body +hello + + + +=== TEST 11: yield before exec +--- config + location @bar { + echo hello; + echo world; + echo heh; + } + location /foo { + echo_sleep 0.001; + echo_exec @bar; + } +--- request + GET /foo +--- response_body +hello +world +heh + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/filter-used.t b/modules_deb/libnginx-mod-http-echo-0.63/t/filter-used.t new file mode 100644 index 0000000..2835270 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/filter-used.t @@ -0,0 +1,59 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (3 * blocks()); + +no_long_string(); +log_level('warn'); + +#master_on(); +#workers(1); + +run_tests(); + +__DATA__ + +=== TEST 1: filter indeed used +--- http_config + postpone_output 1; +--- config + location /echo { + echo_after_body hello; + echo world; + } +--- request + GET /echo +--- stap +F(ngx_http_echo_header_filter) { + println("echo header filter called") +} +--- stap_out +echo header filter called +--- response_body +world +hello + + + +=== TEST 2: filter not used +--- http_config + postpone_output 1; +--- config + location /echo { + #echo_after_body hello; + echo world; + } +--- request + GET /echo +--- stap +F(ngx_http_echo_header_filter) { + println("echo header filter called") +} +--- stap_out +--- response_body +world + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/foreach-split.t b/modules_deb/libnginx-mod-http-echo-0.63/t/foreach-split.t new file mode 100644 index 0000000..266a701 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/foreach-split.t @@ -0,0 +1,283 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /main { + echo_foreach_split '&' $query_string; + echo_location_async $echo_it; + echo '/* end */'; + echo_end; + } + location /sub/1.css { + echo "body { font-size: 12pt; }"; + } + location /sub/2.css { + echo "table { color: 'red'; }"; + } +--- request + GET /main?/sub/1.css&/sub/2.css +--- response_body +body { font-size: 12pt; } +/* end */ +table { color: 'red'; } +/* end */ + + + +=== TEST 2: split in a url argument (echo_location_async) +--- config + location /main_async { + echo_foreach_split ',' $arg_cssfiles; + echo_location_async $echo_it; + echo_end; + } + location /foo.css { + echo foo; + } + location /bar.css { + echo bar; + } + location /baz.css { + echo baz; + } +--- request + GET /main_async?cssfiles=/foo.css,/bar.css,/baz.css +--- response_body +foo +bar +baz + + + +=== TEST 3: split in a url argument (echo_location) +--- config + location /main_sync { + echo_foreach_split ',' $arg_cssfiles; + echo_location $echo_it; + echo_end; + } + location /foo.css { + echo foo; + } + location /bar.css { + echo bar; + } + location /baz.css { + echo baz; + } +--- request + GET /main_sync?cssfiles=/foo.css,/bar.css,/baz.css +--- response_body +foo +bar +baz +--- SKIP + + + +=== TEST 4: empty loop +--- config + location /main { + echo "start"; + echo_foreach_split ',' $arg_cssfiles; + echo_end; + echo "end"; + } +--- request + GET /main?cssfiles=/foo.css,/bar.css,/baz.css +--- response_body +start +end + + + +=== TEST 5: trailing delimiter +--- config + location /main_t { + echo_foreach_split ',' $arg_cssfiles; + echo_location_async $echo_it; + echo_end; + } + location /foo.css { + echo foo; + } +--- request + GET /main_t?cssfiles=/foo.css, +--- response_body +foo + + + +=== TEST 6: multi-char delimiter +--- config + location /main_sleep { + echo_foreach_split '-a-' $arg_list; + echo $echo_it; + echo_end; + } +--- request + GET /main_sleep?list=foo-a-bar-a-baz +--- error_code: 500 +--- response_body_like: 500 Internal Server Error + + + +=== TEST 7: multi-char delimiter (the right way) +--- config + location /main_sleep { + echo_foreach_split -- '-a-' $arg_list; + echo $echo_it; + echo_end; + } +--- request + GET /main_sleep?list=foo-a-bar-a-baz +--- response_body +foo +bar +baz + + + +=== TEST 8: loop with sleep +--- config + location /main_sleep { + echo_foreach_split '-' $arg_list; + echo_sleep 0.001; + echo $echo_it; + echo_end; + } +--- request + GET /main_sleep?list=foo-a-bar-A-baz +--- response_body +foo +a +bar +A +baz + + + +=== TEST 9: empty +--- config + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } +--- request + GET /merge +--- response_body + + + +=== TEST 10: single & +--- config + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } +--- request + GET /merge?& +--- response_body + + + +=== TEST 11: pure &'s +--- config + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } +--- request + GET /merge?&&& +--- response_body + + + +=== TEST 12: pure & and spaces +TODO: needs to uri_decode $echo_it... +--- config + location /merge { + default_type 'text/javascript'; + echo_foreach_split '&' $query_string; + echo "/* JS File $echo_it */"; + echo_location_async $echo_it; + echo; + echo_end; + } +--- request + GET /merge?&%20&%20& +--- response_body +--- SKIP + + + +=== TEST 13: multiple foreach_split +--- config + location /multi { + echo_foreach_split '&' $query_string; + echo [$echo_it]; + echo_end; + + echo '...'; + + echo_foreach_split '-' $query_string; + echo [$echo_it]; + echo_end; + } +--- request + GET /multi?a-b&c-d +--- response_body +[a-b] +[c-d] +... +[a] +[b&c] +[d] + + + +=== TEST 14: github issue #2: setting a variable from $echo_it results to crashing +--- config +location = /getFile { + set $filelist "a,b,c"; + echo_foreach_split ',' $filelist; + set $file $echo_it; + echo_subrequest GET '/getFile2' -q 'sha256=$file'; + echo_end; +} + +location = /getFile2 { + echo "sha256: $arg_sha256"; +} +--- request + GET /getFile +--- response_body +sha256: +sha256: +sha256: + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/gzip.t b/modules_deb/libnginx-mod-http-echo-0.63/t/gzip.t new file mode 100644 index 0000000..61eb4f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/gzip.t @@ -0,0 +1,31 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /gzip { + gzip on; + gzip_min_length 10; + gzip_types text/plain; + + echo_duplicate 1000 hello; + } +--- request + GET /gzip +--- more_headers +Accept-Encoding: gzip +--- response_headers +Content-Encoding: gzip +--- timeout: 20 diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/if.t b/modules_deb/libnginx-mod-http-echo-0.63/t/if.t new file mode 100644 index 0000000..054ec43 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/if.t @@ -0,0 +1,150 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity (hit) +--- config + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } +--- request + GET /if?val=abc +--- response_body +hit + + + +=== TEST 2: sanity (miss) +--- config + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + echo $res; + } + echo $res; + } +--- request + GET /if?val=bcd +--- response_body +miss + + + +=== TEST 3: proxy in if (hit) +--- config + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + proxy_pass $scheme://127.0.0.1:$server_port/foo?res=$res; + } + proxy_pass $scheme://127.0.0.1:$server_port/foo?res=$res; + } + location /foo { + echo "res = $arg_res"; + } +--- request + GET /if?val=abc +--- response_body +res = hit + + + +=== TEST 4: proxy in if (miss) +--- config + location ^~ /if { + set $res miss; + if ($arg_val ~* '^a') { + set $res hit; + proxy_pass $scheme://127.0.0.1:$server_port/foo?res=$res; + } + proxy_pass $scheme://127.0.0.1:$server_port/foo?res=$res; + } + location /foo { + echo "res = $arg_res"; + } +--- request + GET /if?val=bcd +--- response_body +res = miss + + + +=== TEST 5: if too long url (hit) +--- config + location /foo { + if ($request_uri ~ '.{20,}') { + echo too long; + } + echo ok; + } +--- request + GET /foo?a=12345678901234567890 +--- response_body +too long + + + +=== TEST 6: if too long url (miss) +--- config + location /foo { + if ($request_uri ~ '.{20,}') { + echo too long; + } + echo ok; + } +--- request + GET /foo?a=1234567890 +--- response_body +ok + + + +=== TEST 7: echo should be inherited by if blocks +--- config + location /foo { + if ($uri ~ 'foo') { + } + echo ok; + } +--- request + GET /foo +--- response_body +ok + + + +=== TEST 8: echo_after_body and echo_before_body should be inherited by if blocks +--- config + location /foo { + if ($uri ~ 'foo') { + } + echo_before_body -n 'hello'; + echo_location /comma; + echo_after_body 'world'; + } + + location = /comma { + internal; + echo -n ', '; + } +--- request + GET /foo +--- response_body +hello, world + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/incr.t b/modules_deb/libnginx-mod-http-echo-0.63/t/incr.t new file mode 100644 index 0000000..8ad6d98 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/incr.t @@ -0,0 +1,32 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /main { + echo "main pre: $echo_incr"; + echo_location_async /sub; + echo_location_async /sub; + echo "main post: $echo_incr"; + } + location /sub { + echo "sub: $echo_incr"; + } +--- request + GET /main +--- response_body +main pre: 1 +sub: 3 +sub: 4 +main post: 2 + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/location-async.t b/modules_deb/libnginx-mod-http-echo-0.63/t/location-async.t new file mode 100644 index 0000000..3494516 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/location-async.t @@ -0,0 +1,439 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (2 * blocks() + 1); + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /main { + echo_location_async /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello + + + +=== TEST 2: trailing echo +--- config + location /main { + echo_location_async /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello +after subrequest + + + +=== TEST 3: leading echo +--- config + location /main { + echo before subrequest; + echo_location_async /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello + + + +=== TEST 4: leading & trailing echo +--- config + location /main { + echo before subrequest; + echo_location_async /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello +after subrequest + + + +=== TEST 5: multiple subrequests +--- config + location /main { + echo before sr 1; + echo_location_async /sub; + echo after sr 1; + echo before sr 2; + echo_location_async /sub; + echo after sr 2; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before sr 1 +hello +after sr 1 +before sr 2 +hello +after sr 2 + + + +=== TEST 6: timed multiple subrequests (blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_location_async /sub1; + echo_location_async /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_blocking_sleep 0.02; + echo hello; + } + location /sub2 { + echo_blocking_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.00[0-5] sec for total\.$ + + + +=== TEST 7: timed multiple subrequests (non-blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_location_async /sub1; + echo_location_async /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 0.02; + echo hello; + } + location /sub2 { + echo_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.00[0-5] sec for total\.$ + + + +=== TEST 8: location with args +--- config + location /main { + echo_location_async /sub 'foo=Foo&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 9: encoded chars in query strings +--- config + location /main { + echo_location_async /sub 'foo=a%20b&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +a%20b Bar + + + +=== TEST 10: UTF-8 chars in query strings +--- config + location /main { + echo_location_async /sub 'foo=你好'; + } + location /sub { + echo $arg_foo; + } +--- request + GET /main +--- response_body +你好 + + + +=== TEST 11: encoded chars in location url +--- config + location /main { + echo_location_async /sub%31 'foo=Foo&bar=Bar'; + } + location /sub%31 { + echo 'sub%31'; + } + location /sub1 { + echo 'sub1'; + } +--- request + GET /main +--- response_body +sub1 + + + +=== TEST 12: querystring in url +--- config + location /main { + echo_location_async /sub?foo=Foo&bar=Bar; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 13: querystring in url *AND* an explicit querystring +--- config + location /main { + echo_location_async /sub?foo=Foo&bar=Bar blah=Blah; + } + location /sub { + echo $arg_foo $arg_bar $arg_blah; + } +--- request + GET /main +--- response_body + Blah + + + +=== TEST 14: explicit flush in main request +flush won't really flush the buffer... +--- config + location /main_flush { + echo 'pre main'; + echo_location_async /sub; + echo 'post main'; + echo_flush; + } + + location /sub { + echo_sleep 0.02; + echo 'sub'; + } +--- request + GET /main_flush +--- response_body +pre main +sub +post main + + + +=== TEST 15: no varaiable inheritance +--- config + location /main { + echo $echo_cacheable_request_uri; + echo_location_async /sub; + echo_location_async /sub2; + } + location /sub { + echo $echo_cacheable_request_uri; + } + location /sub2 { + echo $echo_cacheable_request_uri; + } + +--- request + GET /main +--- response_body +/main +/sub +/sub2 + + + +=== TEST 16: unsafe uri +--- config + location /unsafe { + echo_location_async '/../foo'; + } +--- request + GET /unsafe +--- stap2 +F(ngx_http_send_header) { + printf("send header on req %p (header sent: %d)\n", $r, $r->header_sent) + print_ubacktrace() +} +--- ignore_response +--- error_log +echo_location_async sees unsafe uri: "/../foo" +--- no_error_log +[error] +[alert] + + + +=== TEST 17: access/deny (access phase handlers skipped in subrequests) +--- config + location /main { + echo_location_async /denied; + } + location /denied { + deny all; + echo No no no; + } +--- request + GET /main +--- error_code: 200 +--- response_body +No no no + + + +=== TEST 18: rewrite is honored. +--- config + location /main { + echo_location_async /rewrite; + } + location /rewrite { + rewrite ^ /foo break; + echo $uri; + } +--- request + GET /main +--- response_body +/foo + + + +=== TEST 19: let subrequest to read the main request's request body +--- SKIP +--- config + location /main { + echo_location_async /sub; + } + location /sub { + echo_read_request_body; + echo_request_body; + } +--- request +POST /main +hello, body! +--- response_body chomp +hello, body! + + + +=== TEST 20: leading subrequest & echo_before_body +--- config + location /main { + echo_before_body hello; + echo_location_async /foo; + } + location /foo { + echo world; + } +--- request + GET /main +--- response_body +hello +world + + + +=== TEST 21: leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_location_async /foo; + } + location /foo { + echo -n world; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world); + + + +=== TEST 22: multiple leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_location_async /foo; + echo_location_async /bar; + } + location /foo { + echo -n world; + } + location /bar { + echo -n ' people'; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world people); + + + +=== TEST 23: sanity (HEAD) +--- config + location /main { + echo_location_async /sub; + echo_location_async /sub; + } + location /sub { + echo hello; + } +--- request + HEAD /main +--- response_body + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/location.t b/modules_deb/libnginx-mod-http-echo-0.63/t/location.t new file mode 100644 index 0000000..48c851e --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/location.t @@ -0,0 +1,567 @@ +# vi:filetype= + +use lib 'lib'; + +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (2 * blocks() + 2); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +#no_diff(); + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /main { + echo_location /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello + + + +=== TEST 2: sanity with proxy in the middle +--- config + location /main { + echo_location /proxy; + } + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello + + + +=== TEST 3: trailing echo +--- config + location /main { + echo_location /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello +after subrequest + + + +=== TEST 4: leading echo +--- config + location /main { + echo before subrequest; + echo_location /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello + + + +=== TEST 5: leading & trailing echo +--- config + location /main { + echo before subrequest; + echo_location /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello +after subrequest + + + +=== TEST 6: multiple subrequests +--- config + location /main { + echo before sr 1; + echo_location /sub; + echo after sr 1; + echo before sr 2; + echo_location /sub; + echo after sr 2; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before sr 1 +hello +after sr 1 +before sr 2 +hello +after sr 2 + + + +=== TEST 7: timed multiple subrequests (blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_location /sub1; + echo_location /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_blocking_sleep 0.02; + echo hello; + } + location /sub2 { + echo_blocking_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.0(?:2[5-9]|3[0-6]) sec for total\.$ + + + +=== TEST 8: timed multiple subrequests (non-blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_location /sub1; + echo_location /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 0.02; + echo hello; + } + location /sub2 { + echo_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.0(?:2[5-9]|3[0-6]) sec for total\.$ + + + +=== TEST 9: location with args +--- config + location /main { + echo_location /sub 'foo=Foo&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 10: chained subrequests +--- config + location /main { + echo 'pre main'; + echo_location /sub; + echo 'post main'; + } + + location /sub { + echo 'pre sub'; + echo_location /subsub; + echo 'post sub'; + } + + location /subsub { + echo 'subsub'; + } +--- request + GET /main +--- response_body +pre main +pre sub +subsub +post sub +post main + + + +=== TEST 11: chained subrequests using named locations +as of 0.8.20, ngx_http_subrequest still does not support +named location. sigh. this case is a TODO. +--- config + location /main { + echo 'pre main'; + echo_location @sub; + echo 'post main'; + } + + location @sub { + echo 'pre sub'; + echo_location @subsub; + echo 'post sub'; + } + + location @subsub { + echo 'subsub'; + } +--- request + GET /main +--- response_body +pre main +pre sub +subsub +post sub +post main +--- SKIP + + + +=== TEST 12: explicit flush in main request +--- config + location /main { + echo 'pre main'; + echo_location /sub; + echo 'post main'; + echo_flush; + } + + location /sub { + echo_sleep 0.02; + echo 'sub'; + } +--- request + GET /main +--- response_body +pre main +sub +post main + + + +=== TEST 13: no varaiable inheritance +--- config + location /main { + echo $echo_cacheable_request_uri; + echo_location /sub; + echo_location /sub2; + } + location /sub { + echo $echo_cacheable_request_uri; + } + location /sub2 { + echo $echo_cacheable_request_uri; + } + +--- request + GET /main +--- response_body +/main +/sub +/sub2 + + + +=== TEST 14: unsafe uri +--- config + location /unsafe { + echo_location '/../foo'; + } +--- request + GET /unsafe +--- ignore_response +--- error_log +echo_location sees unsafe uri: "/../foo" +--- no_error_log +[error] +[alert] + + + +=== TEST 15: querystring in url +--- config + location /main { + echo_location /sub?foo=Foo&bar=Bar; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 16: querystring in url *AND* an explicit querystring +--- config + location /main { + echo_location /sub?foo=Foo&bar=Bar blah=Blah; + } + location /sub { + echo $arg_foo $arg_bar $arg_blah; + } +--- request + GET /main +--- response_body + Blah + + + +=== TEST 17: let subrequest to read the main request's request body +--- SKIP +--- config + location /main { + echo_location /sub; + } + location /sub { + echo_read_request_body; + echo_request_body; + } +--- request +POST /main +hello, body! +--- response_body chomp +hello, body! + + + +=== TEST 18: sleep after location +--- config + location /main { + echo_location /sub; + echo_sleep 0.001; + echo_location /sub; + } + location /sub { + echo_sleep 0.001; + echo sub; + } +--- request + GET /main +--- response_body +sub +sub +--- skip_nginx: 2: < 0.8.11 + + + +=== TEST 19: deep nested echo_location/echo_location_async +--- config + location /main { + echo_location /bar; + echo_location_async /bar; + echo_location_async /bar; + echo_location /group; + echo_location_async /group; + } + + location /group { + echo_location /bar; + echo_location_async /bar; + } + + location /bar { + #echo_sleep 0.001; + echo $echo_incr; + } +--- request +GET /main +--- response_body +1 +2 +3 +4 +5 +6 +7 +--- timeout: 2 + + + +=== TEST 20: deep nested echo_location/echo_location_async (with sleep) +--- config + location /main { + echo_location /bar; + echo_location_async /bar; + echo_location_async /bar; + echo_location /group; + echo_location_async /group; + } + + location /group { + echo_location /baz; + echo_location_async /bah; + } + + location ~ '^/ba[rzh]' { + echo_sleep 0.001; + echo $echo_incr; + } +--- request +GET /main +--- response_body +1 +2 +3 +4 +5 +6 +7 +--- timeout: 2 + + + +=== TEST 21: deep nested echo_location (with sleep) +--- config + location /main { + echo_location /bar; + echo_location /bar; + echo_location /bar; + echo_location /group; + echo_location /group; + } + + location /group { + echo_location /bar; + echo_location /bar; + } + + location /incr { + echo_sleep 0.001; + echo $echo_incr; + } + + location /bar { + proxy_pass $scheme://127.0.0.1:$server_port/incr; + } +--- request +GET /main +--- response_body +1 +1 +1 +1 +1 +1 +1 +--- timeout: 5 +--- no_error_log +[error] + + + +=== TEST 22: leading subrequest & echo_before_body +--- config + location /main { + echo_before_body hello; + echo_location /foo; + } + location /foo { + echo world; + } +--- request + GET /main +--- response_body +hello +world + + + +=== TEST 23: leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_location /foo; + } + location /foo { + echo -n world; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world); + + + +=== TEST 24: multiple leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_location /foo; + echo_location /bar; + } + location /main2 { + content_by_lua ' + local res = ngx.location.capture("/foo") + local res2 = ngx.location.capture("/bar") + ngx.say(res.body) + ngx.say(res2.body) + '; + } + location /foo { + echo -n world; + } + location /bar { + echo -n ' people'; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world people); + + + +=== TEST 25: sanity (HEAD) +--- config + location /main { + echo_location /sub; + echo_location /sub; + } + location /sub { + echo hello; + } +--- request + HEAD /main +--- response_body + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/mixed.t b/modules_deb/libnginx-mod-http-echo-0.63/t/mixed.t new file mode 100644 index 0000000..abf2599 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/mixed.t @@ -0,0 +1,82 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: echo before echo_client_request_headers +--- config + location /echo { + echo "headers:"; + echo -n $echo_client_request_headers; + } +--- request + GET /echo +--- response_body eval +"headers: +GET /echo HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +" + + + +=== TEST 2: echo_client_request_headers before echo +--- config + location /echo { + echo -n $echo_client_request_headers; + echo "...these are the headers"; + } +--- request + GET /echo +--- response_body eval +"GET /echo HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +...these are the headers +" + + + +=== TEST 3: echo & headers & echo +--- config + location /echo { + echo "headers are"; + echo -n $echo_client_request_headers; + echo "...these are the headers"; + } +--- request + GET /echo +--- response_body eval +"headers are +GET /echo HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +...these are the headers +" + + + +=== TEST 4: mixed with echo_duplicate +--- config + location /mixed { + echo hello; + echo_duplicate 2 ---; + echo_duplicate 1 ' END '; + echo_duplicate 2 ---; + echo; + } +--- request + GET /mixed +--- response_body +hello +------ END ------ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/request-body.t b/modules_deb/libnginx-mod-http-echo-0.63/t/request-body.t new file mode 100644 index 0000000..d467b2e --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/request-body.t @@ -0,0 +1,58 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * 2 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: big client body buffered into temp files +--- config + location /echo { + client_body_buffer_size 1k; + echo_read_request_body; + echo_request_body; + } +--- request eval +"POST /echo +" . 'a' x 4096 . 'end'; +--- response_body eval +'a' x 4096 . 'end' + + + +=== TEST 2: in memory request body (trailing echo) +--- config + location /echo { + client_body_buffer_size 1k; + echo_read_request_body; + echo_request_body; + echo done; + } +--- request +POST /echo +hello world +--- response_body +hello worlddone + + + +=== TEST 3: big client body buffered into temp files (trailing echo) +--- config + location /echo { + client_body_buffer_size 1k; + echo_read_request_body; + echo_request_body; + echo done; + } +--- request eval +"POST /echo +" . 'a' x 4096 . "end\n"; +--- response_body eval +'a' x 4096 . "enddone\n" + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t b/modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t new file mode 100644 index 0000000..dd34da4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/request-info.t @@ -0,0 +1,870 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (3 * blocks() + 14); + +run_tests(); + +__DATA__ + +=== TEST 1: standalone directive +--- config + location /echo { + echo -n $echo_client_request_headers; + } +--- request + GET /echo +--- response_body eval +"GET /echo HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +" +--- no_error_log +[error] + + + +=== TEST 2: multiple instances +--- config + location /echo { + echo -n $echo_client_request_headers; + echo -n $echo_client_request_headers; + } +--- request + GET /echo +--- response_body eval +"GET /echo HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +GET /echo HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +" +--- no_error_log +[error] + + + +=== TEST 3: does not explicitly request_body +--- config + location /echo { + echo [$echo_request_body]; + } +--- request +POST /echo +body here +heh +--- response_body +[] +--- no_error_log +[error] + + + +=== TEST 4: let proxy read request_body +--- config + location /echo { + echo_before_body [$echo_request_body]; + proxy_pass $scheme://127.0.0.1:$server_port/blah; + } + location /blah { echo_duplicate 0 ''; } +--- request +POST /echo +body here +heh +--- response_body +[body here +heh] +--- no_error_log +[error] + + + +=== TEST 5: use echo_read_request_body to read it! +--- config + location /echo { + echo_read_request_body; + echo [$echo_request_body]; + } +--- request +POST /echo +body here +heh +--- response_body +[body here +heh] +--- no_error_log +[error] + + + +=== TEST 6: how about sleep after that? +--- config + location /echo { + echo_read_request_body; + echo_sleep 0.002; + echo [$echo_request_body]; + } +--- request +POST /echo +body here +heh +--- response_body +[body here +heh] +--- no_error_log +[error] + + + +=== TEST 7: echo back the whole client request +--- config + # echo back the client request + location /echoback { + echo -n $echo_client_request_headers; + echo_read_request_body; + echo $echo_request_body; + } +--- request +POST /echoback +body here +haha +--- response_body eval +"POST /echoback HTTP/1.1\r +Host: localhost\r +Connection: close\r +Content-Length: 14\r +\r +body here +haha +" +--- no_error_log +[error] + + + +=== TEST 8: echo_request_body +--- config + location /body { + client_body_buffer_size 5; + echo_read_request_body; + echo "[$echo_request_body]"; + echo_request_body; + } +--- request eval +"POST /body +" . ('a' x 2048) . "b" +--- response_body eval +"[]\n" . +('a' x 2048) . "b" +--- no_error_log +[error] + + + +=== TEST 9: $echo_response_status in content handler +--- config + location /status { + echo "status: $echo_response_status"; + } +--- request + GET /status +--- response_body +status: +--- no_error_log +[error] + + + +=== TEST 10: echo_request_body (empty body) +--- config + location /body { + echo_read_request_body; + echo_request_body; + } + location /main { + proxy_pass http://127.0.0.1:$server_port/body; + } +--- request eval +"POST /main" +--- response_body eval +"" +--- no_error_log +[error] + + + +=== TEST 11: small header +--- config + location /t { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- response_body eval +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +} +--- no_error_log +[error] +--- no_error_log +[error] + + + +=== TEST 12: large header +--- config + client_header_buffer_size 10; + large_client_header_buffers 30 561; + location /t { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- more_headers eval +CORE::join "\n", map { "Header$_: value-$_" } 1..512 + +--- response_body eval +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..512) . "\r\n\r\n" + +--- no_error_log +[error] + + + +=== TEST 13: small header, with leading CRLF +--- config + location /t { + echo -n $echo_client_request_headers; + } +--- raw_request eval +"\r\nGET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +" +--- response_body eval +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +} +--- no_error_log +[error] + + + +=== TEST 14: large header, with leading CRLF +--- config + client_header_buffer_size 10; + large_client_header_buffers 30 561; + location /t { + echo -n $echo_client_request_headers; + } + +--- raw_request eval +"\r\nGET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +". +(CORE::join "\r\n", map { "Header$_: value-$_" } 1..512) . "\r\n\r\n" + +--- response_body eval +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..512) . "\r\n\r\n" + +--- no_error_log +[error] + + + +=== TEST 15: small header, pipelined +--- config + location /t { + echo -n $echo_client_request_headers; + } +--- pipelined_requests eval +["GET /t", "GET /th"] + +--- more_headers +Foo: bar + +--- response_body eval +[qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: keep-alive\r +Foo: bar\r +\r +}, qq{GET /th HTTP/1.1\r +Host: localhost\r +Connection: close\r +Foo: bar\r +\r +}] +--- no_error_log +[error] + + + +=== TEST 16: large header, pipelined +--- config + client_header_buffer_size 10; + large_client_header_buffers 30 561; + location /t { + echo -n $echo_client_request_headers; + } +--- pipelined_requests eval +["GET /t", "GET /t"] + +--- more_headers eval +CORE::join "\n", map { "Header$_: value-$_" } 1..512 + +--- response_body eval +my $headers = (CORE::join "\r\n", map { "Header$_: value-$_" } 1..512) . "\r\n\r\n"; + +[qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: keep-alive\r +$headers}, +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +$headers}] + +--- no_error_log +[error] + + + +=== TEST 17: small header, multi-line header +multi-line header is not supported since 1.21 +--- config + location /t { + echo -n $echo_client_request_headers; + } +--- raw_request eval +"GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +Foo: bar baz\r + blah\r +\r +" +--- response_body eval +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +Foo: bar baz\r + blah\r +\r +} +--- no_error_log +[error] +--- skip_nginx +3: >= 1.21.1 + + + +=== TEST 18: large header, multi-line header +multi-line header is not supported since 1.21 +--- config + client_header_buffer_size 10; + large_client_header_buffers 50 567; + location /t { + echo -n $echo_client_request_headers; + } + +--- raw_request eval +my $headers = (CORE::join "\r\n", map { "Header$_: value-$_\r\n hello $_ world blah blah" } 1..512) . "\r\n\r\n"; + +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +$headers} + +--- response_body eval +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_\r\n hello $_ world blah blah" } 1..512) . "\r\n\r\n" + +--- no_error_log +[error] +--- skip_nginx +3: >= 1.21.1 + + + +=== TEST 19: small header (POST body) +--- config + location /t { + echo_read_request_body; + echo -n $echo_client_request_headers; + } +--- request +POST /t +hello +--- response_body eval +qq{POST /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +Content-Length: 5\r +\r +} +--- no_error_log +[error] + + + +=== TEST 20: small header (POST body) - in subrequests (location) +--- config + location /t { + echo -n $echo_client_request_headers; + } + location /main { + echo_location /t; + } + +--- request +POST /main +hello +--- response_body eval +qq{POST /main HTTP/1.1\r +Host: localhost\r +Connection: close\r +Content-Length: 5\r +\r +} +--- no_error_log +[error] + + + +=== TEST 21: large header (POST body) +--- config + client_header_buffer_size 10; + large_client_header_buffers 30 561; + location /t { + echo_read_request_body; + echo -n $echo_client_request_headers; + } +--- request +POST /t +hello + +--- more_headers eval +CORE::join"\n", map { "Header$_: value-$_" } 1..512 + +--- response_body eval +qq{POST /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..512) . "\r\nContent-Length: 5\r\n\r\n" + +--- no_error_log +[error] +--- timeout: 5 + + + +=== TEST 22: large header (POST body) - in subrequests +--- config + client_header_buffer_size 10; + large_client_header_buffers 30 561; + location /t { + echo_read_request_body; + echo -n $echo_client_request_headers; + } + + location /main { + echo_location /t; + } +--- request +POST /main +hello +--- more_headers eval +CORE::join"\n", map { "Header$_: value-$_" } 1..512 + +--- response_body eval +qq{POST /main HTTP/1.1\r +Host: localhost\r +Connection: close\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..512) . "\r\nContent-Length: 5\r\n\r\n" + +--- no_error_log +[error] +--- timeout: 5 + + + +=== TEST 23: raw headers - the default header buffer can hold the request line, but not the header entries +--- config + location /t { + echo_read_request_body; + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- more_headers eval +my $s = "User-Agent: curl\nBah: bah\n"; +$s .= "Accept: */*\n"; +$s .= "Cookie: " . "C" x 1200 . "\n"; +$s +--- response_body eval +"GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +User-Agent: curl\r +Bah: bah\r +Accept: */*\r +Cookie: " . ("C" x 1200) . "\r\n\r\n" +--- no_error_log +[error] + + + +=== TEST 24: small header (POST body) - in subrequests (location_async) +--- config + location /t { + echo -n $echo_client_request_headers; + } + location /main { + echo_location_async /t; + } + +--- request +POST /main +hello +--- response_body eval +qq{POST /main HTTP/1.1\r +Host: localhost\r +Connection: close\r +Content-Length: 5\r +\r +} +--- no_error_log +[error] + + + +=== TEST 25: small header (POST body) - in subrequests (subrequest) +--- config + location /t { + echo -n $echo_client_request_headers; + } + location /main { + echo_subrequest GET /t; + } + +--- request +POST /main +hello +--- response_body eval +qq{POST /main HTTP/1.1\r +Host: localhost\r +Connection: close\r +Content-Length: 5\r +\r +} +--- no_error_log +[error] + + + +=== TEST 26: small header (POST body) - in subrequests (subrequest_async) +--- config + location /t { + echo -n $echo_client_request_headers; + } + location /main { + echo_subrequest_async GET /t; + } + +--- request +POST /main +hello +--- response_body eval +qq{POST /main HTTP/1.1\r +Host: localhost\r +Connection: close\r +Content-Length: 5\r +\r +} +--- no_error_log +[error] + + + +=== TEST 27: ngx_proxy/ngx_fastcgi/etc change r->header_end to point to their own buffers +--- config + location = /t { + proxy_buffering off; + proxy_pass http://127.0.0.1:$server_port/bad; + proxy_intercept_errors on; + error_page 500 = /500; + } + + location = /bad { + return 500; + } + + location = /500 { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- response_body eval +"GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +\r +" +--- no_error_log +[error] + + + +=== TEST 28: ngx_proxy/ngx_fastcgi/etc change r->header_end to point to their own buffers (exclusive LF in the request data) +--- config + location = /t { + proxy_buffering off; + proxy_pass http://127.0.0.1:$server_port/bad; + proxy_intercept_errors on; + error_page 500 = /500; + } + + location = /bad { + return 500; + } + + location = /500 { + internal; + echo -n $echo_client_request_headers; + } +--- raw_request eval +"GET /t HTTP/1.1 +Host: localhost +Connection: close +Content-Length: 5 + +hello" +--- response_body eval +"GET /t HTTP/1.1 +Host: localhost +Connection: close +Content-Length: 5 + +" +--- no_error_log +[error] + + + +=== TEST 29: ngx_proxy/ngx_fastcgi/etc change r->header_end to point to their own buffers (mixed LF and CRLF in the request data) +--- config + location = /t { + proxy_buffering off; + proxy_pass http://127.0.0.1:$server_port/bad; + proxy_intercept_errors on; + error_page 500 = /500; + } + + location = /bad { + return 500; + } + + location = /500 { + internal; + echo -n $echo_client_request_headers; + } +--- raw_request eval +"GET /t HTTP/1.1\r +Host: localhost +Connection: close\r +Content-Length: 5\r + +hello" +--- response_body eval +"GET /t HTTP/1.1\r +Host: localhost +Connection: close\r +Content-Length: 5\r + +" +--- no_error_log +[error] + + + +=== TEST 30: ngx_proxy/ngx_fastcgi/etc change r->header_end to point to their own buffers (another way of mixing LF and CRLF in the request data) +--- config + location = /t { + proxy_buffering off; + proxy_pass http://127.0.0.1:$server_port/bad; + proxy_intercept_errors on; + error_page 500 = /500; + } + + location = /bad { + return 500; + } + + location = /500 { + internal; + echo -n $echo_client_request_headers; + } +--- raw_request eval +"GET /t HTTP/1.1\r +Host: localhost +Connection: close\r +Content-Length: 5 +\r +hello" +--- response_body eval +"GET /t HTTP/1.1\r +Host: localhost +Connection: close\r +Content-Length: 5 +\r +" +--- no_error_log +[error] + + + +=== TEST 31: two pipelined requests with large headers +--- config + client_header_buffer_size 10; + large_client_header_buffers 3 5610; + location /t { + echo -n $echo_client_request_headers; + } +--- pipelined_requests eval +["GET /t", "GET /t"] +--- more_headers eval +CORE::join "\n", map { "Header$_: value-$_" } 1..585 + +--- response_body eval +[qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: keep-alive\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..585) . "\r\n\r\n", +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..585) . "\r\n\r\n", +, +] + +--- no_error_log +[error] +--- timeout: 5 + + + +=== TEST 32: a request with large header and a smaller pipelined request following +--- config + client_header_buffer_size 10; + large_client_header_buffers 2 1921; + location /t { + echo -n $echo_client_request_headers; + } +--- pipelined_requests eval +["GET /t", "GET /t"] +--- more_headers eval +[CORE::join("\n", map { "Header$_: value-$_" } 1..170), "Foo: bar\n"] + +--- response_body eval +[qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: keep-alive\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..170) . "\r\n\r\n", +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +Foo: bar\r +\r +}, +] + +--- no_error_log +[error] +--- timeout: 5 + + + +=== TEST 33: a request with large header and a smaller pipelined request following +--- config + client_header_buffer_size 10; + large_client_header_buffers 2 1921; + location /t { + echo -n $echo_client_request_headers; + } +--- pipelined_requests eval +["GET /t", "GET /t" . ("a" x 512)] +--- more_headers eval +[CORE::join("\n", map { "Header$_: value-$_" } 1..170), "Foo: bar\n"] + +--- response_body eval +[qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: keep-alive\r +} +.(CORE::join "\r\n", map { "Header$_: value-$_" } 1..170) . "\r\n\r\n", +qq{GET /t} . ("a" x 512) . qq{ HTTP/1.1\r +Host: localhost\r +Connection: close\r +Foo: bar\r +\r +}, +] + +--- no_error_log +[error] +--- timeout: 5 + + + +=== TEST 34: invalid header line started with whitespace since nginx 1.21.1 +--- config + client_header_buffer_size 10; + large_client_header_buffers 50 567; + location /t { + echo -n $echo_client_request_headers; + } + +--- raw_request eval +my $headers = (CORE::join "\r\n", map { "Header$_: value-$_\r\n hello $_ world blah blah" } 1..512) . "\r\n\r\n"; + +qq{GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +$headers} + +--- error_code: 400 +--- no_error_log +[error] +--- skip_nginx +2: < 1.21.1 diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/sleep.t b/modules_deb/libnginx-mod-http-echo-0.63/t/sleep.t new file mode 100644 index 0000000..f8e741e --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/sleep.t @@ -0,0 +1,200 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 2 * blocks(); + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /echo { + echo_sleep 1; + } +--- request + GET /echo +--- response_body + + + +=== TEST 2: fractional delay +--- config + location /echo { + echo_sleep 0.01; + } +--- request + GET /echo +--- response_body + + + +=== TEST 3: leading echo +--- config + location /echo { + echo before...; + echo_sleep 0.01; + } +--- request + GET /echo +--- response_body +before... + + + +=== TEST 4: trailing echo +--- config + location /echo { + echo_sleep 0.01; + echo after...; + } +--- request + GET /echo +--- response_body +after... + + + +=== TEST 5: two echos around sleep +--- config + location /echo { + echo before...; + echo_sleep 0.01; + echo after...; + } +--- request + GET /echo +--- response_body +before... +after... + + + +=== TEST 6: interleaving sleep and echo +--- config + location /echo { + echo 1; + echo_sleep 0.01; + echo 2; + echo_sleep 0.01; + } +--- request + GET /echo +--- response_body +1 +2 + + + +=== TEST 7: interleaving sleep and echo with echo at the end... +--- config + location /echo { + echo 1; + echo_sleep 0.01; + echo 2; + echo_sleep 0.01; + echo 3; + } +--- request + GET /echo +--- response_body +1 +2 +3 + + + +=== TEST 8: flush before sleep +we didn't really test the actual effect of "echo_flush" here... +merely checks if it croaks if appears. +--- config + location /flush { + echo hi; + echo_flush; + echo_sleep 0.01; + echo trees; + } +--- request + GET /flush +--- response_body +hi +trees + + + +=== TEST 9: flush does not increment opcode pointer itself +--- config + location /flush { + echo hi; + echo_flush; + echo trees; + } +--- request + GET /flush +--- response_body +hi +trees + + + +=== TEST 10: sleep through a proxy +this reveals a bug in v0.19 and the bug is fixed in v0.20. +--- config + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/entry'; + } + location /entry { + echo_sleep 0.001; + echo done; + } +--- request + GET /proxy +--- response_body_like +done + + + +=== TEST 11: abnormally quit +--- config + location /quit { + echo before; + echo_flush; + echo_sleep 1; + echo after; + } +--- request + GET /quit +--- response_body +before +after + + + +=== TEST 12: two echos around sleep (HEAD) +--- config + location /echo { + echo before...; + echo_sleep 0.01; + echo after...; + } +--- request + HEAD /echo +--- response_body + + + +=== TEST 13: sleep by variable +--- config + location ~ ^/sleep/(.+) { + echo before...; + echo_sleep $1; + echo after...; + } +--- request + GET /sleep/0.01 +--- response_body +before... +after... + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/status.t b/modules_deb/libnginx-mod-http-echo-0.63/t/status.t new file mode 100644 index 0000000..d97b084 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/status.t @@ -0,0 +1,142 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(1); + +plan tests => repeat_each() * (2 * blocks()); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +run_tests(); + +__DATA__ + +=== TEST 1: 200 +--- config + location /echo { + echo_status 200; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 200 + + + +=== TEST 2: if location (200) +--- config + location /echo { + set $true 1; + if ($true) { + } + echo_status 200; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 200 + + + +=== TEST 3: 404 +--- config + location /echo { + echo_status 404; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 404 + + + +=== TEST 4: if location (404) +--- config + location /echo { + set $true 1; + if ($true) { + } + echo_status 404; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 404 + + + +=== TEST 5: 500 +--- config + location /echo { + echo_status 500; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 500 + + + +=== TEST 6: if location (500) +--- config + location /echo { + set $true 1; + if ($true) { + } + echo_status 500; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 500 + + + +=== TEST 7: if location (500) no inherit +--- config + location /echo { + set $true 1; + if ($true) { + echo_status 503; + } + echo_status 500; + echo hello; + } +--- request + GET /echo +--- response_body +hello +--- error_code: 503 + + + +=== TEST 8: subrequest +--- config + location /echo { + echo_location /sub; + echo_status 503; + } + + location /sub { + echo blah blah; + } +--- request + GET /echo +--- response_body +blah blah +--- error_code: 503 + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest-async.t b/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest-async.t new file mode 100644 index 0000000..882b368 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest-async.t @@ -0,0 +1,604 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (blocks() * 2 + 1); + +#$Test::Nginx::LWP::LogLevel = 'debug'; + +$ENV{TEST_NGINX_HTML_DIR} = html_dir; + +run_tests(); + +__DATA__ + +=== TEST 1: sanity - GET +--- config + location /main { + echo_subrequest_async GET /sub; + } + location /sub { + echo "sub method: $echo_request_method"; + echo "main method: $echo_client_request_method"; + } +--- request + GET /main +--- response_body +sub method: GET +main method: GET + + + +=== TEST 2: sanity - DELETE +--- config + location /main { + echo_subrequest_async DELETE /sub; + } + location /sub { + echo "sub method: $echo_request_method"; + echo "main method: $echo_client_request_method"; + } +--- request + GET /main +--- response_body +sub method: DELETE +main method: GET + + + +=== TEST 3: trailing echo +--- config + location /main { + echo_subrequest_async GET /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello +after subrequest + + + +=== TEST 4: leading echo +--- config + location /main { + echo before subrequest; + echo_subrequest_async GET /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello + + + +=== TEST 5: leading & trailing echo +--- config + location /main { + echo before subrequest; + echo_subrequest_async GET /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello +after subrequest + + + +=== TEST 6: multiple subrequests +--- config + location /main { + echo before sr 1; + echo_subrequest_async GET /sub; + echo after sr 1; + echo before sr 2; + echo_subrequest_async GET /sub; + echo after sr 2; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before sr 1 +hello +after sr 1 +before sr 2 +hello +after sr 2 + + + +=== TEST 7: timed multiple subrequests (blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_subrequest_async GET /sub1; + echo_subrequest_async GET /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_blocking_sleep 0.02; + echo hello; + } + location /sub2 { + echo_blocking_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.00[0-5] sec for total\.$ + + + +=== TEST 8: timed multiple subrequests (non-blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_subrequest_async GET /sub1; + echo_subrequest_async GET /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 0.02; + echo hello; + } + location /sub2 { + echo_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.00[0-5] sec for total\.$ + + + +=== TEST 9: location with args +--- config + location /main { + echo_subrequest_async GET /sub -q 'foo=Foo&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 10: encoded chars in query strings +--- config + location /main { + echo_subrequest_async GET /sub -q 'foo=a%20b&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +a%20b Bar + + + +=== TEST 11: UTF-8 chars in query strings +--- config + location /main { + echo_subrequest_async GET /sub -q 'foo=你好'; + } + location /sub { + echo $arg_foo; + } +--- request + GET /main +--- response_body +你好 + + + +=== TEST 12: encoded chars in location url +--- config + location /main { + echo_subrequest_async GET /sub%31 -q 'foo=Foo&bar=Bar'; + } + location /sub%31 { + echo 'sub%31'; + } + location /sub1 { + echo 'sub1'; + } +--- request + GET /main +--- response_body +sub1 + + + +=== TEST 13: querystring in url +--- config + location /main { + echo_subrequest_async GET /sub?foo=Foo&bar=Bar; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 14: querystring in url *AND* an explicit querystring +--- config + location /main { + echo_subrequest_async GET /sub?foo=Foo&bar=Bar -q blah=Blah; + } + location /sub { + echo $arg_foo $arg_bar $arg_blah; + } +--- request + GET /main +--- response_body + Blah + + + +=== TEST 15: explicit flush in main request +flush won't really flush the buffer... +--- config + location /main_flush { + echo 'pre main'; + echo_subrequest_async GET /sub; + echo 'post main'; + echo_flush; + } + + location /sub { + echo_sleep 0.02; + echo 'sub'; + } +--- request + GET /main_flush +--- response_body +pre main +sub +post main + + + +=== TEST 16: POST subrequest with body (with proxy in the middle) and without read body explicitly +--- config + location /main { + echo_subrequest_async POST /proxy -b 'hello, world'; + } + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/sub; + } + location /sub { + echo "sub method: $echo_request_method."; + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo "sub body: $echo_request_body."; + } +--- request + GET /main +--- response_body +sub method: POST. +sub body: . + + + +=== TEST 17: POST subrequest with body (with proxy in the middle) and read body explicitly +--- config + location /main { + echo_subrequest_async POST /proxy -b 'hello, world'; + } + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/sub; + } + location /sub { + echo "sub method: $echo_request_method."; + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo_read_request_body; + echo "sub body: $echo_request_body."; + } +--- request + GET /main +--- response_body +sub method: POST. +sub body: hello, world. + + + +=== TEST 18: multiple subrequests +--- config + location /multi { + echo_subrequest_async POST '/sub' -q 'foo=Foo' -b 'hi'; + echo_subrequest_async PUT '/sub' -q 'bar=Bar' -b 'hello'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } +--- request + GET /multi +--- response_body +querystring: foo=Foo +method: POST +body: hi +content length: 2 +/// +querystring: bar=Bar +method: PUT +body: hello +content length: 5 +/// + + + +=== TEST 19: no varaiable inheritance +--- config + location /main { + echo $echo_cacheable_request_uri; + echo_subrequest_async GET /sub; + echo_subrequest_async GET /sub2; + } + location /sub { + echo $echo_cacheable_request_uri; + } + location /sub2 { + echo $echo_cacheable_request_uri; + } + +--- request + GET /main +--- response_body +/main +/sub +/sub2 + + + +=== TEST 20: unsafe uri +--- config + location /unsafe { + echo_subrequest_async GET '/../foo'; + } +--- request + GET /unsafe +--- ignore_response +--- error_log +echo_subrequest_async sees unsafe uri: "/../foo" +--- no_error_log +[error] +[alert] + + + +=== TEST 21: let subrequest to read the main request's request body +--- SKIP +--- config + location /main { + echo_subrequest_async POST /sub; + } + location /sub { + echo_read_request_body; + echo_request_body; + } +--- request +POST /main +hello, body! +--- response_body chomp +hello, body! + + + +=== TEST 22: POST subrequest with file body (relative paths) +--- config + location /main { + echo_subrequest_async POST /sub -f html/blah.txt; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world +--- request + GET /main +--- response_body +sub method: POST +Hello, world + + + +=== TEST 23: POST subrequest with file body (absolute paths) +--- config + location /main { + echo_subrequest_async POST /sub -f $TEST_NGINX_HTML_DIR/blah.txt; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world! +Haha +--- request + GET /main +--- response_body +sub method: POST +Hello, world! +Haha + + + +=== TEST 24: POST subrequest with file body (file not found) +--- config + location /main { + echo_subrequest_async POST /sub -f html/blah/blah.txt; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world +--- request + GET /main +--- ignore_response +--- error_log eval +qr/open\(\) ".*?" failed/ +--- no_error_log +[alert] + + + +=== TEST 25: POST subrequest with file body (absolute paths in vars) +--- config + location /main { + set $path $TEST_NGINX_HTML_DIR/blah.txt; + echo_subrequest_async POST /sub -f $path; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world! +Haha +--- request + GET /main +--- response_body +sub method: POST +Hello, world! +Haha + + + +=== TEST 26: leading subrequest & echo_before_body +--- config + location /main { + echo_before_body hello; + echo_subrequest_async GET /foo; + } + location /foo { + echo world; + } +--- request + GET /main +--- response_body +hello +world + + + +=== TEST 27: leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_subrequest_async GET /foo; + } + location /foo { + echo -n world; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world); + + + +=== TEST 28: multiple leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_subrequest_async GET /foo; + echo_subrequest_async GET /bar; + } + location /foo { + echo -n world; + } + location /bar { + echo -n ' people'; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world people); + + + +=== TEST 29: sanity (HEAD) +--- config + location /main { + echo_subrequest_async GET /sub; + echo_subrequest_async GET /sub; + } + location /sub { + echo hello; + } +--- request + HEAD /main +--- response_body + + + +=== TEST 30: HEAD subrequest +--- config + location /main { + echo_subrequest_async HEAD /sub; + echo_subrequest_async HEAD /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t b/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t new file mode 100644 index 0000000..6d965d0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/subrequest.t @@ -0,0 +1,725 @@ +# vi:filetype= + +use lib 'lib'; + +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (2 * blocks() + 1); + +$ENV{TEST_NGINX_HTML_DIR} = html_dir; +$ENV{TEST_NGINX_CLIENT_PORT} ||= server_port(); + +run_tests(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /main { + echo_subrequest GET /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello + + + +=== TEST 2: trailing echo +--- config + location /main { + echo_subrequest GET /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +hello +after subrequest + + + +=== TEST 3: leading echo +--- config + location /main { + echo before subrequest; + echo_subrequest GET /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello + + + +=== TEST 4: leading & trailing echo +--- config + location /main { + echo before subrequest; + echo_subrequest GET /sub; + echo after subrequest; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before subrequest +hello +after subrequest + + + +=== TEST 5: multiple subrequests +--- config + location /main { + echo before sr 1; + echo_subrequest GET /sub; + echo after sr 1; + echo before sr 2; + echo_subrequest GET /sub; + echo after sr 2; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body +before sr 1 +hello +after sr 1 +before sr 2 +hello +after sr 2 + + + +=== TEST 6: timed multiple subrequests (blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_subrequest GET /sub1; + echo_subrequest GET /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_blocking_sleep 0.02; + echo hello; + } + location /sub2 { + echo_blocking_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.0(?:2[5-9]|3[0-6]) sec for total\.$ + + + +=== TEST 7: timed multiple subrequests (non-blocking sleep) +--- config + location /main { + echo_reset_timer; + echo_subrequest GET /sub1; + echo_subrequest GET /sub2; + echo "took $echo_timer_elapsed sec for total."; + } + location /sub1 { + echo_sleep 0.02; + echo hello; + } + location /sub2 { + echo_sleep 0.01; + echo world; + } + +--- request + GET /main +--- response_body_like +^hello +world +took 0\.0(?:2[5-9]|3[0-6]) sec for total\.$ + + + +=== TEST 8: location with args +--- config + location /main { + echo_subrequest GET /sub -q 'foo=Foo&bar=Bar'; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 9: chained subrequests +--- config + location /main { + echo 'pre main'; + echo_subrequest GET /sub; + echo 'post main'; + } + + location /sub { + echo 'pre sub'; + echo_subrequest GET /subsub; + echo 'post sub'; + } + + location /subsub { + echo 'subsub'; + } +--- request + GET /main +--- response_body +pre main +pre sub +subsub +post sub +post main + + + +=== TEST 10: chained subrequests using named locations +as of 0.8.20, ngx_http_subrequest still does not support +named location. sigh. this case is a TODO. +--- config + location /main { + echo 'pre main'; + echo_subrequest GET @sub; + echo 'post main'; + } + + location @sub { + echo 'pre sub'; + echo_subrequest GET @subsub; + echo 'post sub'; + } + + location @subsub { + echo 'subsub'; + } +--- request + GET /main +--- response_body +pre main +pre sub +subsub +post sub +post main +--- SKIP + + + +=== TEST 11: explicit flush in main request +--- config + location /main { + echo 'pre main'; + echo_subrequest GET /sub; + echo 'post main'; + echo_flush; + } + + location /sub { + echo_sleep 0.02; + echo 'sub'; + } +--- request + GET /main +--- response_body +pre main +sub +post main + + + +=== TEST 12: DELETE subrequest +--- config + location /main { + echo_subrequest DELETE /sub; + } + location /sub { + echo "sub method: $echo_request_method"; + echo "main method: $echo_client_request_method"; + } +--- request + GET /main +--- response_body +sub method: DELETE +main method: GET + + + +=== TEST 13: DELETE subrequest +--- config + location /main { + echo "main method: $echo_client_request_method"; + echo_subrequest GET /proxy; + echo_subrequest DELETE /proxy; + } + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/sub; + } + location /sub { + echo "sub method: $echo_request_method"; + } +--- request + GET /main +--- response_body +main method: GET +sub method: GET +sub method: DELETE + + + +=== TEST 14: POST subrequest with body +--- config + location /main { + echo_subrequest POST /sub -b 'hello, world'; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo "sub body: $echo_request_body"; + } +--- request + GET /main +--- response_body +sub method: POST +sub body: hello, world + + + +=== TEST 15: POST subrequest with body (explicitly read the body) +--- config + location /main { + echo_subrequest POST /sub -b 'hello, world'; + } + location /sub { + echo "sub method: $echo_request_method"; + # we call echo_read_client_body explicitly here even + # though it's not necessary. + echo_read_request_body; + echo "sub body: $echo_request_body"; + } +--- request + GET /main +--- response_body +sub method: POST +sub body: hello, world + + + +=== TEST 16: POST subrequest with body (with proxy in the middle) and without read body explicitly +--- config + location /main { + echo_subrequest POST /proxy -b 'hello, world'; + } + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/sub; + } + location /sub { + echo "sub method: $echo_request_method."; + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo "sub body: $echo_request_body."; + } +--- request + GET /main +--- response_body +sub method: POST. +sub body: . + + + +=== TEST 17: POST subrequest with body (with proxy in the middle) and read body explicitly +--- config + location /main { + echo_subrequest POST /proxy -b 'hello, world'; + } + location /proxy { + proxy_pass $scheme://127.0.0.1:$server_port/sub; + } + location /sub { + echo "sub method: $echo_request_method."; + # we need to read body explicitly here...or $echo_request_body + # will evaluate to empty ("") + echo_read_request_body; + echo "sub body: $echo_request_body."; + } +--- request + GET /main +--- response_body +sub method: POST. +sub body: hello, world. + + + +=== TEST 18: multiple subrequests +--- config + location /multi { + echo_subrequest POST '/sub' -q 'foo=Foo' -b 'hi'; + echo_subrequest PUT '/sub' -q 'bar=Bar' -b 'hello'; + } + location /sub { + echo "querystring: $query_string"; + echo "method: $echo_request_method"; + echo "body: $echo_request_body"; + echo "content length: $http_content_length"; + echo '///'; + } +--- request + GET /multi +--- response_body +querystring: foo=Foo +method: POST +body: hi +content length: 2 +/// +querystring: bar=Bar +method: PUT +body: hello +content length: 5 +/// + + + +=== TEST 19: unsafe uri +--- config + location /unsafe { + echo_subrequest GET '/../foo'; + } +--- request + GET /unsafe +--- ignore_response +--- error_log +echo_subrequest sees unsafe uri: "/../foo" +--- no_error_log +[error] + + + +=== TEST 20: querystring in url +--- config + location /main { + echo_subrequest GET /sub?foo=Foo&bar=Bar; + } + location /sub { + echo $arg_foo $arg_bar; + } +--- request + GET /main +--- response_body +Foo Bar + + + +=== TEST 21: querystring in url *AND* an explicit querystring +--- config + location /main { + echo_subrequest GET /sub?foo=Foo&bar=Bar -q blah=Blah; + } + location /sub { + echo $arg_foo $arg_bar $arg_blah; + } +--- request + GET /main +--- response_body + Blah + + + +=== TEST 22: let subrequest to read the main request's request body +--- SKIP +--- config + location /main { + echo_subrequest POST /sub; + } + location /sub { + echo_read_request_body; + echo_request_body; + } +--- request +POST /main +hello, body! +--- response_body chomp +hello, body! + + + +=== TEST 23: deep nested echo_subrequest/echo_subrequest_async +--- config + location /main { + echo_subrequest GET /bar; + echo_subrequest_async GET /bar; + echo_subrequest_async GET /bar; + echo_subrequest GET /group; + echo_subrequest_async GET /group; + } + + location /group { + echo_subrequest GET /bar; + echo_subrequest_async GET /bar; + } + + location /bar { + echo $echo_incr; + } +--- request +GET /main +--- response_body +1 +2 +3 +4 +5 +6 +7 + + + +=== TEST 24: deep nested echo_subrequest/echo_subrequest_async +--- config + location /main { + echo_subrequest GET /bar?a; + echo_subrequest_async GET /bar?b; + echo_subrequest_async GET /bar?c; + echo_subrequest GET /group?a=d&b=e; + echo_subrequest_async GET /group?a=f&b=g; + } + + location /group { + echo_subrequest GET /bar?$arg_a; + echo_subrequest_async GET /bar?$arg_b; + } + + location /bar { + echo -n $query_string; + } +--- request +GET /main +--- response_body: abcdefg +--- timeout: 2 + + + +=== TEST 25: POST subrequest with file body (relative paths) +--- config + location /main { + echo_subrequest POST /sub -f html/blah.txt; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world +--- request + GET /main +--- response_body +sub method: POST +Hello, world + + + +=== TEST 26: POST subrequest with file body (absolute paths) +--- config + location /main { + echo_subrequest POST /sub -f $TEST_NGINX_HTML_DIR/blah.txt; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world! +Haha +--- request + GET /main +--- response_body +sub method: POST +Hello, world! +Haha + + + +=== TEST 27: POST subrequest with file body (file not found) +--- config + location /main { + echo_subrequest POST /sub -f html/blah/blah.txt; + } + location /sub { + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo_request_body; + } +--- user_files +>>> blah.txt +Hello, world +--- request + GET /main +--- ignore_response +--- error_log eval +qr/open\(\) ".*?" failed/ +--- no_error_log +[alert] + + + +=== TEST 28: leading subrequest & echo_before_body +--- config + location /main { + echo_before_body hello; + echo_subrequest GET /foo; + } + location /foo { + echo world; + } +--- request + GET /main +--- response_body +hello +world + + + +=== TEST 29: leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_subrequest GET /foo; + } + location /foo { + echo -n world; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world); + + + +=== TEST 30: multiple leading subrequest & xss +--- config + location /main { + default_type 'application/json'; + xss_get on; + xss_callback_arg c; + echo_subrequest GET /foo; + echo_subrequest GET /bar; + } + location /foo { + echo -n world; + } + location /bar { + echo -n ' people'; + } +--- request + GET /main?c=hi +--- response_body chop +hi(world people); + + + +=== TEST 31: sanity (HEAD) +--- config + location /main { + echo_subrequest GET /sub; + echo_subrequest GET /sub; + } + location /sub { + echo hello; + } +--- request + HEAD /main +--- response_body + + + +=== TEST 32: POST subrequest to ngx_proxy +--- config + location /hello { + default_type text/plain; + echo_subrequest POST '/proxy' -q 'foo=Foo&bar=baz' -b 'request_body=test&test=3'; + } + + location /proxy { + proxy_pass http://127.0.0.1:$TEST_NGINX_CLIENT_PORT/sub; + #proxy_pass http://127.0.0.1:1113/sub; + } + + location /sub { + echo_read_request_body; + echo "sub method: $echo_request_method"; + # we don't need to call echo_read_client_body explicitly here + echo "sub body: $echo_request_body"; + } +--- request + GET /hello +--- response_body +sub method: POST +sub body: request_body=test&test=3 + + + +=== TEST 33: HEAD subrequest +--- config + location /main { + echo_subrequest HEAD /sub; + echo_subrequest HEAD /sub; + } + location /sub { + echo hello; + } +--- request + GET /main +--- response_body + + + +=== TEST 34: method name as an nginx variable (github issue #34) +--- config + location ~ ^/delay/(?[0-9.]+)/(?.*)$ { + # echo_blocking_sleep $delay; + echo_subrequest '$echo_request_method' '/$originalURL' -q '$args'; + } + + location /api { + echo "args: $args"; + } +--- request + GET /delay/0.343/api/?a=b +--- response_body +args: a=b +--- no_error_log +[error] + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/t/unused.t b/modules_deb/libnginx-mod-http-echo-0.63/t/unused.t new file mode 100644 index 0000000..f3c6e9e --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/t/unused.t @@ -0,0 +1,119 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (5 * blocks()); + +no_long_string(); +log_level('warn'); + +#master_on(); +#workers(1); + +run_tests(); + +__DATA__ + +=== TEST 1: filters used +--- http_config + postpone_output 1; +--- config + location /echo { + echo world; + echo_after_body hello; + } +--- request + GET /echo?blah +--- response_body +world +hello +--- error_log +echo header filter, uri "/echo?blah" +echo body filter, uri "/echo?blah" +--- no_error_log +[error] +--- log_level: debug + + + +=== TEST 2: filters not used +--- http_config + postpone_output 1; +--- config + location /echo { + echo world; + #echo_after_body hello; + } +--- request + GET /echo?blah +--- response_body +world +--- no_error_log +echo header filter, uri "/echo?blah" +echo body filter, uri "/echo?blah" +[error] +--- log_level: debug + + + +=== TEST 3: (after) filters used (multiple http {} blocks) +This test case won't run with nginx 1.9.3+ since duplicate http {} blocks +have been prohibited since then. +--- SKIP +--- http_config + postpone_output 1; +--- config + location /echo { + echo world; + echo_after_body hello; + } + +--- post_main_config + http { + } + +--- request + GET /echo?blah +--- response_body +world +hello +--- error_log +echo header filter, uri "/echo?blah" +echo body filter, uri "/echo?blah" +--- no_error_log +[error] +--- log_level: debug + + + +=== TEST 4: (before) filters used (multiple http {} blocks) +This test case won't run with nginx 1.9.3+ since duplicate http {} blocks +have been prohibited since then. +--- SKIP +--- http_config + postpone_output 1; +--- config + location /echo { + echo world; + echo_before_body hello; + } + +--- post_main_config + http { + } + +--- request + GET /echo?blah +--- response_body +hello +world +--- error_log +echo header filter, uri "/echo?blah" +echo body filter, uri "/echo?blah" +--- no_error_log +[error] +--- log_level: debug + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/util/build.sh b/modules_deb/libnginx-mod-http-echo-0.63/util/build.sh new file mode 100755 index 0000000..45949bb --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/util/build.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +# this file is mostly meant to be used by the author himself. + +root=`pwd` +version=$1 +force=$2 +home=~ + + #--with-cc=gcc46 \ + +ngx-build $force $version \ + --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LIBDRIZZLE_LIB:/usr/local/lib" \ + --with-cc-opt="-DDEBUG_MALLOC" \ + --with-http_stub_status_module \ + --with-http_image_filter_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --without-http_upstream_ip_hash_module \ + --without-http_memcached_module \ + --without-http_referer_module \ + --without-http_autoindex_module \ + --without-http_auth_basic_module \ + --without-http_userid_module \ + --add-module=$root/../ndk-nginx-module \ + --add-module=$root/../set-misc-nginx-module \ + --add-module=$root/../eval-nginx-module \ + --add-module=$root/../xss-nginx-module \ + --add-module=$root/../rds-json-nginx-module \ + --add-module=$root/../headers-more-nginx-module \ + --add-module=$root/../lua-nginx-module \ + --add-module=$root $opts \ + --with-http_v2_module \ + --with-select_module \ + --with-poll_module \ + --without-http_ssi_module \ + --with-debug || exit 1 + #--add-module=$root/../lz-session-nginx-module \ + #--add-module=$home/work/ndk \ + #--add-module=$home/work/ndk/examples/http/set_var \ + #--add-module=$root/../eval-nginx-module \ + #--add-module=/home/agentz/work/nginx_eval_module-1.0.1 \ + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/util/wiki2pod.pl b/modules_deb/libnginx-mod-http-echo-0.63/util/wiki2pod.pl new file mode 100644 index 0000000..cdd33a2 --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/util/wiki2pod.pl @@ -0,0 +1,131 @@ +#!/usr/bin/env perl + +use strict; +use warnings; +use bytes; + +my @nl_counts; +my $last_nl_count_level; + +my @bl_counts; +my $last_bl_count_level; + +sub fmt_pos ($) { + (my $s = $_[0]) =~ s{\#(.*)}{/"$1"}; + $s; +} + +sub fmt_mark ($$) { + my ($tag, $s) = @_; + my $max_level = 0; + while ($s =~ /([<>])\1*/g) { + my $level = length $&; + if ($level > $max_level) { + $max_level = $level; + } + } + + my $times = $max_level + 1; + if ($times > 1) { + $s = " $s "; + } + return $tag . ('<' x $times) . $s . ('>' x $times); +} + +print "=encoding utf-8\n\n"; + +while (<>) { + if ($. == 1) { + # strip the leading U+FEFF byte in MS-DOS text files + my $first = ord(substr($_, 0, 1)); + #printf STDERR "0x%x", $first; + #my $second = ord(substr($_, 2, 1)); + #printf STDERR "0x%x", $second; + if ($first == 0xEF) { + substr($_, 0, 1, ''); + #warn "Hit!"; + } + } + s{\[(http[^ \]]+) ([^\]]*)\]}{$2 (L<$1>)}gi; + s{ \[\[ ( [^\]\|]+ ) \| ([^\]]*) \]\] }{"L<$2|" . fmt_pos($1) . ">"}gixe; + s{(.*?)}{fmt_mark('C', $1)}gie; + s{'''(.*?)'''}{fmt_mark('B', $1)}ge; + s{''(.*?)''}{fmt_mark('I', $1)}ge; + if (s{^\s*<[^>]+>\s*$}{}) { + next; + } + + if (/^\s*$/) { + print "\n"; + next; + } + +=begin cmt + + if ($. == 1) { + warn $_; + for my $i (0..length($_) - 1) { + my $chr = substr($_, $i, 1); + warn "chr ord($i): ".ord($chr)." \"$chr\"\n"; + } + } + +=end cmt +=cut + + if (/(=+) (.*) \1$/) { + #warn "HERE! $_" if $. == 1; + my ($level, $title) = (length $1, $2); + collapse_lists(); + + print "\n=head$level $title\n\n"; + } elsif (/^(\#+) (.*)/) { + my ($level, $txt) = (length($1) - 1, $2); + if (defined $last_nl_count_level && $level != $last_nl_count_level) { + print "\n=back\n\n"; + } + $last_nl_count_level = $level; + $nl_counts[$level] ||= 0; + if ($nl_counts[$level] == 0) { + print "\n=over\n\n"; + } + $nl_counts[$level]++; + print "\n=item $nl_counts[$level].\n\n"; + print "$txt\n"; + } elsif (/^(\*+) (.*)/) { + my ($level, $txt) = (length($1) - 1, $2); + if (defined $last_bl_count_level && $level != $last_bl_count_level) { + print "\n=back\n\n"; + } + $last_bl_count_level = $level; + $bl_counts[$level] ||= 0; + if ($bl_counts[$level] == 0) { + print "\n=over\n\n"; + } + $bl_counts[$level]++; + print "\n=item *\n\n"; + print "$txt\n"; + } else { + collapse_lists(); + print; + } +} + +collapse_lists(); + +sub collapse_lists { + while (defined $last_nl_count_level && $last_nl_count_level >= 0) { + print "\n=back\n\n"; + $last_nl_count_level--; + } + undef $last_nl_count_level; + undef @nl_counts; + + while (defined $last_bl_count_level && $last_bl_count_level >= 0) { + print "\n=back\n\n"; + $last_bl_count_level--; + } + undef $last_bl_count_level; + undef @bl_counts; +} + diff --git a/modules_deb/libnginx-mod-http-echo-0.63/valgrind.suppress b/modules_deb/libnginx-mod-http-echo-0.63/valgrind.suppress new file mode 100644 index 0000000..975415e --- /dev/null +++ b/modules_deb/libnginx-mod-http-echo-0.63/valgrind.suppress @@ -0,0 +1,53 @@ +{ + + Memcheck:Param + epoll_ctl(event) + fun:epoll_ctl +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_event_process_init +} +{ + + Memcheck:Cond + fun:index + fun:expand_dynamic_string_token + fun:_dl_map_object + fun:map_doit + fun:_dl_catch_error + fun:do_preload + fun:dl_main +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_single_process_cycle + fun:main +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_single_process_cycle +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_worker_process_init + fun:ngx_worker_process_cycle +} diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/LICENSE b/modules_deb/libnginx-mod-http-geoip2-3.4/LICENSE new file mode 100644 index 0000000..fdc13a7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/LICENSE @@ -0,0 +1,23 @@ +Copyright (c) 2014, Lee Valentine +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/README.md b/modules_deb/libnginx-mod-http-geoip2-3.4/README.md new file mode 100644 index 0000000..cea0d04 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/README.md @@ -0,0 +1,153 @@ +Description +=========== + +**ngx_http_geoip2_module** - creates variables with values from the maxmind geoip2 databases based on the client IP (default) or from a specific variable (supports both IPv4 and IPv6) + +The module now supports nginx streams and can be used in the same way the http module can be used. + +## Installing +First install [libmaxminddb](https://github.com/maxmind/libmaxminddb) as described in its [README.md +file](https://github.com/maxmind/libmaxminddb/blob/main/README.md#installing-from-a-tarball). + +#### Download nginx source +``` +wget http://nginx.org/download/nginx-VERSION.tar.gz +tar zxvf nginx-VERSION.tar.gz +cd nginx-VERSION +``` + +##### To build as a dynamic module (nginx 1.9.11+): +``` +./configure --add-dynamic-module=/path/to/ngx_http_geoip2_module +make +make install +``` + +This will produce ```objs/ngx_http_geoip2_module.so```. It can be copied to your nginx module path manually if you wish. + +Add the following line to your nginx.conf: +``` +load_module modules/ngx_http_geoip2_module.so; +``` + +##### To build as a static module: +``` +./configure --add-module=/path/to/ngx_http_geoip2_module +make +make install +``` + +##### If you need stream support, make sure to compile with stream: +``` +./configure --add-dynamic-module=/path/to/ngx_http_geoip2_module --with-stream +OR +./configure --add-module=/path/to/ngx_http_geoip2_module --with-stream +``` + + +## Download Maxmind GeoLite2 Database (optional) +The free GeoLite2 databases are available from [Maxminds website](http://dev.maxmind.com/geoip/geoip2/geolite2/) (requires signing up) + +## Example Usage: +``` +http { + ... + geoip2 /etc/maxmind-country.mmdb { + auto_reload 5m; + $geoip2_metadata_country_build metadata build_epoch; + $geoip2_data_country_code default=US source=$variable_with_ip country iso_code; + $geoip2_data_country_name country names en; + } + + geoip2 /etc/maxmind-city.mmdb { + $geoip2_data_city_name default=London city names en; + } + .... + + fastcgi_param COUNTRY_CODE $geoip2_data_country_code; + fastcgi_param COUNTRY_NAME $geoip2_data_country_name; + fastcgi_param CITY_NAME $geoip2_data_city_name; + .... +} + +stream { + ... + geoip2 /etc/maxmind-country.mmdb { + $geoip2_data_country_code default=US source=$remote_addr country iso_code; + } + ... +} +``` + +##### Metadata: +Retrieve metadata regarding the geoip database. +``` +$variable_name metadata +``` +Available fields: + - build_epoch: the build timestamp of the maxmind database. + - last_check: the last time the database was checked for changes (when using auto_reload) + - last_change: the last time the database was reloaded (when using auto_reload) + +##### Autoreload (default: disabled): +Enabling auto reload will have nginx check the modification time of the database at the specified +interval and reload it if it has changed. +``` +auto_reload +``` + +##### GeoIP: +``` +$variable_name [default= + "iso_code": + "US" + "names": + { + "de": + "USA" + "en": + "United States" + } + } + } + +$ mmdblookup --file /usr/share/GeoIP/GeoIP2-Country.mmdb --ip 8.8.8.8 country names en + + "United States" +``` + +This translates to: + +``` +$country_name "default=United States" source=$remote_addr country names en +``` + +##### Additional Commands: +These commands works the same as the original ngx_http_geoip_module documented here: http://nginx.org/en/docs/http/ngx_http_geoip_module.html#geoip_proxy. + +However, if you provide the `source=$variable_with_ip` option on a variable, these settings will be ignored for that particular variable. + +``` +geoip2_proxy < cidr > +``` +Defines trusted addresses. When a request comes from a trusted address, an address from the "X-Forwarded-For" request header field will be used instead. + +``` +geoip2_proxy_recursive < on | off > +``` +If recursive search is disabled then instead of the original client address that matches one of the trusted addresses, the last address sent in "X-Forwarded-For" will be used. If recursive search is enabled then instead of the original client address that matches one of the trusted addresses, the last non-trusted address sent in "X-Forwarded-For" will be used. diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/config b/modules_deb/libnginx-mod-http-geoip2-3.4/config new file mode 100644 index 0000000..48bf15d --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/config @@ -0,0 +1,43 @@ +ngx_feature="MaxmindDB library" +ngx_feature_name= +ngx_feature_run=no +ngx_feature_incs="#include " +ngx_feature_libs=-lmaxminddb +ngx_feature_test="MMDB_s mmdb" +. auto/feature + +ngx_addon_name="ngx_geoip2_module" + +if [ $ngx_found = yes ]; then + if test -n "$ngx_module_link"; then + if [ $HTTP != NO ]; then + ngx_module_type=HTTP + ngx_module_name="ngx_http_geoip2_module" + ngx_module_incs= + ngx_module_deps= + ngx_module_srcs="$ngx_addon_dir/ngx_http_geoip2_module.c" + ngx_module_libs="$ngx_feature_libs" + . auto/module + fi + + nginx_version=`awk '/^#define nginx_version / {print $3}' src/core/nginx.h` + if [ $STREAM != NO -a $nginx_version -gt 1011001 ]; then + ngx_module_type=STREAM + ngx_module_name="ngx_stream_geoip2_module" + ngx_module_incs= + ngx_module_deps= + ngx_module_srcs="$ngx_addon_dir/ngx_stream_geoip2_module.c" + ngx_module_libs="$ngx_feature_libs" + . auto/module + fi + else + HTTP_MODULES="$HTTP_MODULES ngx_http_geoip2_module" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_geoip2_module.c" + CORE_LIBS="$CORE_LIBS $ngx_feature_libs" + fi +else + cat << END +$0: error: the geoip2 module requires the maxminddb library. +END + exit 1 +fi diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/changelog b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/changelog new file mode 100644 index 0000000..0c0f22e --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/changelog @@ -0,0 +1,52 @@ +libnginx-mod-http-geoip2 (1:3.4-6) unstable; urgency=medium + + * d/control: update my email to janmojzis@debian.org + * d/copyright: update my email to janmojzis@debian.org + * d/control: bump Standards-Version: 4.7.2, no changes + * d/copyright: bump debian/* copyright year + * d/watch: use more generic template + + -- Jan Mojžíš Fri, 11 Apr 2025 14:26:59 +0200 + +libnginx-mod-http-geoip2 (1:3.4-5) unstable; urgency=medium + + * Better usage of dh-sequence-nginx + * d/rules: remove override_dh_auto_configure, override_dh_auto_test + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + * d/control: use Build-Depends libnginx-mod-stream instead of + libnginx-mod-stream (<<1.24.0.1~), libnginx-mod-stream (>=1.24.0) + * d/control: use Build-Depends nginx-dev (>= 1.24.0-2) + * d/control: remove Depends libnginx-mod-stream (<<1.24.0.1~), + libnginx-mod-stream (>=1.24.0) + + -- Jan Mojžíš Wed, 11 Oct 2023 07:37:12 +0200 + +libnginx-mod-http-geoip2 (1:3.4-4) unstable; urgency=medium + + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Tue, 27 Jun 2023 23:16:38 +0200 + +libnginx-mod-http-geoip2 (1:3.4-3) unstable; urgency=medium + + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/gbb.conf: switched to debian branch main (debian-branch = main) + * d/copyright: bump my copyright year + * d/copyright: reformat text to be compatible with 'cme update dpkg-copyright' + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 12:56:24 +0100 + +libnginx-mod-http-geoip2 (1:3.4-2) unstable; urgency=medium + + * d/control: added Multi-Arch: foreign + + -- Jan Mojžíš Fri, 09 Dec 2022 12:50:27 +0100 + +libnginx-mod-http-geoip2 (1:3.4-1) experimental; urgency=medium + + * Initial release. (Closes: 1024843) + + -- Jan Mojžíš Wed, 30 Nov 2022 14:46:51 +0100 diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/control b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/control new file mode 100644 index 0000000..3ccc4e3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/control @@ -0,0 +1,41 @@ +Source: libnginx-mod-http-geoip2 +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jan Mojžíš , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, + libmaxminddb-dev, + libnginx-mod-stream, + nginx-dev (>= 1.24.0-2), +Standards-Version: 4.7.2 +Homepage: https://github.com/leev/ngx_http_geoip2_module +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-geoip2.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-geoip2 +Rules-Requires-Root: no + +Package: libnginx-mod-http-geoip2 +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: GeoIP2 HTTP module for Nginx + The ngx_http_geoip2 module creates variables with values depending on the + client IP address, using the precompiled MaxMind GeoIP2 databases. + . + Those variables include country, region, city, latitude, longitude, postal + code, etc. + +Package: libnginx-mod-stream-geoip2 +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: GeoIP2 Stream module for Nginx + The ngx_stream_geoip2 module creates variables with values depending on the + client IP address, using the precompiled MaxMind GeoIP2 databases. + . + Those variables include country, region, city, latitude, longitude, postal + code, etc. diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/copyright b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/copyright new file mode 100644 index 0000000..ab01158 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/copyright @@ -0,0 +1,46 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ngx_http_geoip2_module +Upstream-Contact: Lee Valentine +Source: https://github.com/leev/ngx_http_geoip2_module + +Files: * +Copyright: 2014, Lee Valentine +License: BSD-2-clause + +Files: debian/* +Copyright: 2022, Miao Wang + 2022-2025, Jan Mojzis +License: BSD-2-clause + +Files: ngx_http_geoip2_module.c +Copyright: Lee Valentine +License: BSD-2-clause + +Files: ngx_stream_geoip2_module.c +Copyright: Lee Valentine + Andrei Belov +License: BSD-2-clause + +License: BSD-2-clause + All rights reserved. + . + Redistribution and use in source and binary forms, with or without modification, + are permitted provided that the following conditions are met: + . + * Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + . + * Redistributions in binary form must reproduce the above copyright notice, this + list of conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR + ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/gbp.conf b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/gbp.conf new file mode 100644 index 0000000..38c12c1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/gbp.conf @@ -0,0 +1,9 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = True +sign-tags = True + +[import-orig] +merge-mode = replace diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-http-geoip2.install b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-http-geoip2.install new file mode 100644 index 0000000..2692817 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-http-geoip2.install @@ -0,0 +1 @@ +/usr/lib/nginx/modules/ngx_http_geoip2_module.so diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-stream-geoip2.install b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-stream-geoip2.install new file mode 100644 index 0000000..9f45e96 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/libnginx-mod-stream-geoip2.install @@ -0,0 +1 @@ +/usr/lib/nginx/modules/ngx_stream_geoip2_module.so diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/rules b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/rules new file mode 100755 index 0000000..d8309f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/source/format b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/control b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/control new file mode 100644 index 0000000..ca20b9f --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/control @@ -0,0 +1,6 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/generic b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/upstream/metadata b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/upstream/metadata new file mode 100644 index 0000000..5f50585 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/leev/ngx_http_geoip2_module/issues +Bug-Submit: https://github.com/leev/ngx_http_geoip2_module/issues/new +Repository-Browse: https://github.com/leev/ngx_http_geoip2_module \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/debian/watch b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/watch new file mode 100644 index 0000000..04e3a51 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/leev/ngx_http_geoip2_module/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/ngx_http_geoip2_module.c b/modules_deb/libnginx-mod-http-geoip2-3.4/ngx_http_geoip2_module.c new file mode 100644 index 0000000..4b3461c --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/ngx_http_geoip2_module.c @@ -0,0 +1,803 @@ +/* + * Copyright (C) Lee Valentine + * + * Based on nginx's 'ngx_http_geoip_module.c' by Igor Sysoev + */ + + +#include +#include +#include + +#include + + +typedef struct { + MMDB_s mmdb; + MMDB_lookup_result_s result; + time_t last_check; + time_t last_change; + time_t check_interval; +#if (NGX_HAVE_INET6) + uint8_t address[16]; +#else + unsigned long address; +#endif + ngx_queue_t queue; +} ngx_http_geoip2_db_t; + +typedef struct { + ngx_queue_t databases; + ngx_array_t *proxies; + ngx_flag_t proxy_recursive; +} ngx_http_geoip2_conf_t; + +typedef struct { + ngx_http_geoip2_db_t *database; + const char **lookup; + ngx_str_t default_value; + ngx_http_complex_value_t source; +} ngx_http_geoip2_ctx_t; + +typedef struct { + ngx_http_geoip2_db_t *database; + ngx_str_t metavalue; +} ngx_http_geoip2_metadata_t; + + +static ngx_int_t ngx_http_geoip2_variable(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_http_geoip2_metadata(ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); +static void *ngx_http_geoip2_create_conf(ngx_conf_t *cf); +static char *ngx_http_geoip2_init_conf(ngx_conf_t *cf, void *conf); +static char *ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_http_geoip2_parse_config(ngx_conf_t *cf, ngx_command_t *dummy, + void *conf); +static char *ngx_http_geoip2_add_variable(ngx_conf_t *cf, ngx_command_t *dummy, + void *conf); +static char *ngx_http_geoip2_add_variable_geodata(ngx_conf_t *cf, + ngx_http_geoip2_db_t *database); +static char *ngx_http_geoip2_add_variable_metadata(ngx_conf_t *cf, + ngx_http_geoip2_db_t *database); +static char *ngx_http_geoip2_proxy(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static ngx_int_t ngx_http_geoip2_cidr_value(ngx_conf_t *cf, ngx_str_t *net, + ngx_cidr_t *cidr); +static void ngx_http_geoip2_cleanup(void *data); +static ngx_int_t ngx_http_geoip2_init(ngx_conf_t *cf); + + +#define FORMAT(fmt, ...) do { \ + p = ngx_palloc(r->pool, NGX_OFF_T_LEN); \ + if (p == NULL) { \ + return NGX_ERROR; \ + } \ + v->len = ngx_sprintf(p, fmt, __VA_ARGS__) - p; \ + v->data = p; \ +} while (0) + +static ngx_command_t ngx_http_geoip2_commands[] = { + + { ngx_string("geoip2"), + NGX_HTTP_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE1, + ngx_http_geoip2, + NGX_HTTP_MAIN_CONF_OFFSET, + 0, + NULL }, + + { ngx_string("geoip2_proxy"), + NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1, + ngx_http_geoip2_proxy, + NGX_HTTP_MAIN_CONF_OFFSET, + 0, + NULL }, + + { ngx_string("geoip2_proxy_recursive"), + NGX_HTTP_MAIN_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_MAIN_CONF_OFFSET, + offsetof(ngx_http_geoip2_conf_t, proxy_recursive), + NULL }, + + ngx_null_command +}; + + +static ngx_http_module_t ngx_http_geoip2_module_ctx = { + NULL, /* preconfiguration */ + ngx_http_geoip2_init, /* postconfiguration */ + + ngx_http_geoip2_create_conf, /* create main configuration */ + ngx_http_geoip2_init_conf, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + NULL, /* create location configuration */ + NULL /* merge location configuration */ +}; + + +ngx_module_t ngx_http_geoip2_module = { + NGX_MODULE_V1, + &ngx_http_geoip2_module_ctx, /* module context */ + ngx_http_geoip2_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + + +static ngx_int_t +ngx_http_geoip2_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, + uintptr_t data) +{ + ngx_http_geoip2_ctx_t *geoip2 = (ngx_http_geoip2_ctx_t *) data; + ngx_http_geoip2_db_t *database = geoip2->database; + int mmdb_error; + MMDB_entry_data_s entry_data; + ngx_http_geoip2_conf_t *gcf; + ngx_addr_t addr; +#if defined(nginx_version) && nginx_version >= 1023000 + ngx_table_elt_t *xfwd; +#else + ngx_array_t *xfwd; +#endif + u_char *p; + ngx_str_t val; + +#if (NGX_HAVE_INET6) + uint8_t address[16], *addressp = address; +#else + unsigned long address; +#endif + + if (geoip2->source.value.len > 0) { + if (ngx_http_complex_value(r, &geoip2->source, &val) != NGX_OK) { + goto not_found; + } + + if (ngx_parse_addr(r->pool, &addr, val.data, val.len) != NGX_OK) { + goto not_found; + } + } else { + gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip2_module); + addr.sockaddr = r->connection->sockaddr; + addr.socklen = r->connection->socklen; + +#if defined(nginx_version) && nginx_version >= 1023000 + xfwd = r->headers_in.x_forwarded_for; + + if (xfwd != NULL && gcf->proxies != NULL) { +#else + xfwd = &r->headers_in.x_forwarded_for; + + if (xfwd->nelts > 0 && gcf->proxies != NULL) { +#endif + (void) ngx_http_get_forwarded_addr(r, &addr, xfwd, NULL, + gcf->proxies, gcf->proxy_recursive); + } + } + + switch (addr.sockaddr->sa_family) { + case AF_INET: +#if (NGX_HAVE_INET6) + ngx_memset(addressp, 0, 12); + ngx_memcpy(addressp + 12, &((struct sockaddr_in *) + addr.sockaddr)->sin_addr.s_addr, 4); + break; + + case AF_INET6: + ngx_memcpy(addressp, &((struct sockaddr_in6 *) + addr.sockaddr)->sin6_addr.s6_addr, 16); +#else + address = ((struct sockaddr_in *)addr.sockaddr)->sin_addr.s_addr; +#endif + break; + + default: + goto not_found; + } + +#if (NGX_HAVE_INET6) + if (ngx_memcmp(&address, &database->address, sizeof(address)) + != 0) { +#else + if (address != database->address) { +#endif + memcpy(&database->address, &address, sizeof(address)); + database->result = MMDB_lookup_sockaddr(&database->mmdb, + addr.sockaddr, &mmdb_error); + + if (mmdb_error != MMDB_SUCCESS) { + goto not_found; + } + } + + if (!database->result.found_entry + || MMDB_aget_value(&database->result.entry, &entry_data, + geoip2->lookup) != MMDB_SUCCESS) { + goto not_found; + } + + if (!entry_data.has_data) { + goto not_found; + } + + switch (entry_data.type) { + case MMDB_DATA_TYPE_BOOLEAN: + FORMAT("%d", entry_data.boolean); + break; + case MMDB_DATA_TYPE_UTF8_STRING: + v->len = entry_data.data_size; + v->data = ngx_pnalloc(r->pool, v->len); + if (v->data == NULL) { + return NGX_ERROR; + } + ngx_memcpy(v->data, (u_char *) entry_data.utf8_string, v->len); + break; + case MMDB_DATA_TYPE_BYTES: + v->len = entry_data.data_size; + v->data = ngx_pnalloc(r->pool, v->len); + if (v->data == NULL) { + return NGX_ERROR; + } + ngx_memcpy(v->data, (u_char *) entry_data.bytes, v->len); + break; + case MMDB_DATA_TYPE_FLOAT: + FORMAT("%.5f", entry_data.float_value); + break; + case MMDB_DATA_TYPE_DOUBLE: + FORMAT("%.5f", entry_data.double_value); + break; + case MMDB_DATA_TYPE_UINT16: + FORMAT("%uD", entry_data.uint16); + break; + case MMDB_DATA_TYPE_UINT32: + FORMAT("%uD", entry_data.uint32); + break; + case MMDB_DATA_TYPE_INT32: + FORMAT("%D", entry_data.int32); + break; + case MMDB_DATA_TYPE_UINT64: + FORMAT("%uL", entry_data.uint64); + break; + case MMDB_DATA_TYPE_UINT128: ; +#if MMDB_UINT128_IS_BYTE_ARRAY + uint8_t *val = (uint8_t *)entry_data.uint128; + FORMAT( "0x%02x%02x%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x%02x%02x", + val[0], val[1], val[2], val[3], + val[4], val[5], val[6], val[7], + val[8], val[9], val[10], val[11], + val[12], val[13], val[14], val[15]); +#else + mmdb_uint128_t val = entry_data.uint128; + FORMAT("0x%016uxL%016uxL", + (uint64_t) (val >> 64), (uint64_t) val); +#endif + break; + default: + goto not_found; + } + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; + +not_found: + if (geoip2->default_value.len > 0) { + v->data = geoip2->default_value.data; + v->len = geoip2->default_value.len; + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + } else { + v->not_found = 1; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_geoip2_metadata(ngx_http_request_t *r, ngx_http_variable_value_t *v, + uintptr_t data) +{ + ngx_http_geoip2_metadata_t *metadata = (ngx_http_geoip2_metadata_t *) data; + ngx_http_geoip2_db_t *database = metadata->database; + u_char *p; + + if (ngx_strncmp(metadata->metavalue.data, "build_epoch", 11) == 0) { + FORMAT("%uL", database->mmdb.metadata.build_epoch); + } else if (ngx_strncmp(metadata->metavalue.data, "last_check", 10) == 0) { + FORMAT("%T", database->last_check); + } else if (ngx_strncmp(metadata->metavalue.data, "last_change", 11) == 0) { + FORMAT("%T", database->last_change); + } else { + v->not_found = 1; + return NGX_OK; + } + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} + + +static void * +ngx_http_geoip2_create_conf(ngx_conf_t *cf) +{ + ngx_pool_cleanup_t *cln; + ngx_http_geoip2_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_geoip2_conf_t)); + if (conf == NULL) { + return NULL; + } + + conf->proxy_recursive = NGX_CONF_UNSET; + + cln = ngx_pool_cleanup_add(cf->pool, 0); + if (cln == NULL) { + return NULL; + } + + ngx_queue_init(&conf->databases); + + cln->handler = ngx_http_geoip2_cleanup; + cln->data = conf; + + return conf; +} + + +static char * +ngx_http_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_geoip2_conf_t *gcf = conf; + ngx_str_t *value; + int status; + ngx_http_geoip2_db_t *database; + char *rv; + ngx_conf_t save; + ngx_queue_t *q; + + value = cf->args->elts; + + if (value[1].data && value[1].data[0] != '/') { + if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) { + return NGX_CONF_ERROR; + } + } + + if (!ngx_queue_empty(&gcf->databases)) { + for (q = ngx_queue_head(&gcf->databases); + q != ngx_queue_sentinel(&gcf->databases); + q = ngx_queue_next(q)) + { + database = ngx_queue_data(q, ngx_http_geoip2_db_t, queue); + if (ngx_strcmp(value[1].data, database->mmdb.filename) == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "Duplicate GeoIP2 mmdb - %V", &value[1]); + return NGX_CONF_ERROR; + } + } + } + + database = ngx_pcalloc(cf->pool, sizeof(ngx_http_geoip2_db_t)); + if (database == NULL) { + return NGX_CONF_ERROR; + } + + ngx_queue_insert_tail(&gcf->databases, &database->queue); + database->last_check = database->last_change = ngx_time(); + + status = MMDB_open((char *) value[1].data, MMDB_MODE_MMAP, &database->mmdb); + + if (status != MMDB_SUCCESS) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "MMDB_open(\"%V\") failed - %s", &value[1], + MMDB_strerror(status)); + return NGX_CONF_ERROR; + } + + save = *cf; + cf->handler = ngx_http_geoip2_parse_config; + cf->handler_conf = (void *) database; + + rv = ngx_conf_parse(cf, NULL); + *cf = save; + return rv; +} + + +static char * +ngx_http_geoip2_parse_config(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +{ + ngx_http_geoip2_db_t *database; + ngx_str_t *value; + time_t interval; + + value = cf->args->elts; + + if (value[0].data[0] == '$') { + return ngx_http_geoip2_add_variable(cf, dummy, conf); + } + + if (value[0].len == 11 + && ngx_strncmp(value[0].data, "auto_reload", 11) == 0) { + if ((int) cf->args->nelts != 2) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid number of arguments for auto_reload"); + return NGX_CONF_ERROR; + } + + interval = ngx_parse_time(&value[1], true); + + if (interval == (time_t) NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid interval for auto_reload \"%V\"", + value[1]); + return NGX_CONF_ERROR; + } + + + database = (ngx_http_geoip2_db_t *) conf; + database->check_interval = interval; + return NGX_CONF_OK; + } + + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid setting \"%V\"", &value[0]); + return NGX_CONF_ERROR; +} + + +static char * +ngx_http_geoip2_add_variable(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +{ + ngx_http_geoip2_db_t *database; + ngx_str_t *value; + int nelts; + + value = cf->args->elts; + + if (value[0].data[0] != '$') { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"%V\"", &value[0]); + return NGX_CONF_ERROR; + } + + value[0].len--; + value[0].data++; + + nelts = (int) cf->args->nelts; + database = (ngx_http_geoip2_db_t *) conf; + + if (nelts > 0 && value[1].len == 8 && ngx_strncmp(value[1].data, "metadata", 8) == 0) { + return ngx_http_geoip2_add_variable_metadata(cf, database); + } + + return ngx_http_geoip2_add_variable_geodata(cf, database); +} + + +static char * +ngx_http_geoip2_add_variable_metadata(ngx_conf_t *cf, ngx_http_geoip2_db_t *database) +{ + ngx_http_geoip2_metadata_t *metadata; + ngx_str_t *value, name; + ngx_http_variable_t *var; + + metadata = ngx_pcalloc(cf->pool, sizeof(ngx_http_geoip2_metadata_t)); + if (metadata == NULL) { + return NGX_CONF_ERROR; + } + + value = cf->args->elts; + name = value[0]; + + metadata->database = database; + metadata->metavalue = value[2]; + + var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); + if (var == NULL) { + return NGX_CONF_ERROR; + } + + var->get_handler = ngx_http_geoip2_metadata; + var->data = (uintptr_t) metadata; + + return NGX_CONF_OK; +} + + +static char * +ngx_http_geoip2_add_variable_geodata(ngx_conf_t *cf, ngx_http_geoip2_db_t *database) +{ + ngx_http_geoip2_ctx_t *geoip2; + ngx_http_compile_complex_value_t ccv; + ngx_str_t *value, name, source; + ngx_http_variable_t *var; + int i, nelts, idx; + + geoip2 = ngx_pcalloc(cf->pool, sizeof(ngx_http_geoip2_ctx_t)); + if (geoip2 == NULL) { + return NGX_CONF_ERROR; + } + + geoip2->database = database; + ngx_str_null(&source); + + value = cf->args->elts; + name = value[0]; + + nelts = (int) cf->args->nelts; + idx = 1; + + if (nelts > idx) { + for (i = idx; i < nelts; i++) { + if (ngx_strnstr(value[idx].data, "=", value[idx].len) == NULL) { + break; + } + + if (value[idx].len > 8 && ngx_strncmp(value[idx].data, "default=", 8) == 0) { + if (geoip2->default_value.len > 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "default has already been declared for \"$%V\"", &name); + return NGX_CONF_ERROR; + } + + geoip2->default_value.len = value[idx].len - 8; + geoip2->default_value.data = value[idx].data + 8; + } else if (value[idx].len > 7 && ngx_strncmp(value[idx].data, "source=", 7) == 0) { + if (source.len > 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "source has already been declared for \"$%V\"", &name); + return NGX_CONF_ERROR; + } + + source.len = value[idx].len - 7; + source.data = value[idx].data + 7; + + if (source.data[0] != '$') { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid source variable name \"%V\"", &source); + return NGX_CONF_ERROR; + } + + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + ccv.cf = cf; + ccv.value = &source; + ccv.complex_value = &geoip2->source; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "unable to compile \"%V\" for \"$%V\"", &source, &name); + return NGX_CONF_ERROR; + } + } else { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid setting \"%V\" for \"$%V\"", &value[idx], &name); + return NGX_CONF_ERROR; + } + + idx++; + } + } + + var = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); + if (var == NULL) { + return NGX_CONF_ERROR; + } + + geoip2->lookup = ngx_pcalloc(cf->pool, sizeof(const char *) * + (cf->args->nelts - (idx - 1))); + + if (geoip2->lookup == NULL) { + return NGX_CONF_ERROR; + } + + for (i = idx; i < nelts; i++) { + geoip2->lookup[i - idx] = (char *) value[i].data; + } + geoip2->lookup[i - idx] = NULL; + + var->get_handler = ngx_http_geoip2_variable; + var->data = (uintptr_t) geoip2; + + return NGX_CONF_OK; +} + + +static char * +ngx_http_geoip2_init_conf(ngx_conf_t *cf, void *conf) +{ + ngx_http_geoip2_conf_t *gcf = conf; + ngx_conf_init_value(gcf->proxy_recursive, 0); + return NGX_CONF_OK; +} + + +static char * +ngx_http_geoip2_proxy(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_http_geoip2_conf_t *gcf = conf; + ngx_str_t *value; + ngx_cidr_t cidr, *c; + + value = cf->args->elts; + + if (ngx_http_geoip2_cidr_value(cf, &value[1], &cidr) != NGX_OK) { + return NGX_CONF_ERROR; + } + + if (gcf->proxies == NULL) { + gcf->proxies = ngx_array_create(cf->pool, 4, sizeof(ngx_cidr_t)); + if (gcf->proxies == NULL) { + return NGX_CONF_ERROR; + } + } + + c = ngx_array_push(gcf->proxies); + if (c == NULL) { + return NGX_CONF_ERROR; + } + + *c = cidr; + + return NGX_CONF_OK; +} + + +static ngx_int_t +ngx_http_geoip2_cidr_value(ngx_conf_t *cf, ngx_str_t *net, ngx_cidr_t *cidr) +{ + ngx_int_t rc; + + if (ngx_strcmp(net->data, "255.255.255.255") == 0) { + cidr->family = AF_INET; + cidr->u.in.addr = 0xffffffff; + cidr->u.in.mask = 0xffffffff; + + return NGX_OK; + } + + rc = ngx_ptocidr(net, cidr); + + if (rc == NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid network \"%V\"", net); + return NGX_ERROR; + } + + if (rc == NGX_DONE) { + ngx_conf_log_error(NGX_LOG_WARN, cf, 0, + "low address bits of %V are meaningless", net); + } + + return NGX_OK; +} + + +static void +ngx_http_geoip2_cleanup(void *data) +{ + ngx_http_geoip2_conf_t *gcf = data; + ngx_queue_t *q; + ngx_http_geoip2_db_t *database; + + while (!ngx_queue_empty(&gcf->databases)) { + q = ngx_queue_head(&gcf->databases); + ngx_queue_remove(q); + database = ngx_queue_data(q, ngx_http_geoip2_db_t, queue); + MMDB_close(&database->mmdb); + } +} + + +static ngx_int_t +ngx_http_geoip2_log_handler(ngx_http_request_t *r) +{ + int status; + MMDB_s tmpdb; + ngx_queue_t *q; + ngx_file_info_t fi; + ngx_http_geoip2_db_t *database; + ngx_http_geoip2_conf_t *gcf; + + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "geoip2 http log handler"); + + gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip2_module); + + if (ngx_queue_empty(&gcf->databases)) { + return NGX_OK; + } + + for (q = ngx_queue_head(&gcf->databases); + q != ngx_queue_sentinel(&gcf->databases); + q = ngx_queue_next(q)) + { + database = ngx_queue_data(q, ngx_http_geoip2_db_t, queue); + if (database->check_interval == 0) { + continue; + } + + if ((database->last_check + database->check_interval) + > ngx_time()) + { + continue; + } + + database->last_check = ngx_time(); + + if (ngx_file_info(database->mmdb.filename, &fi) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_EMERG, r->connection->log, ngx_errno, + ngx_file_info_n " \"%s\" failed", + database->mmdb.filename); + + continue; + } + + if (ngx_file_mtime(&fi) <= database->last_change) { + continue; + } + + /* do the reload */ + + ngx_memzero(&tmpdb, sizeof(MMDB_s)); + status = MMDB_open(database->mmdb.filename, MMDB_MODE_MMAP, &tmpdb); + + if (status != MMDB_SUCCESS) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "MMDB_open(\"%s\") failed to reload - %s", + database->mmdb.filename, MMDB_strerror(status)); + + continue; + } + + database->last_change = ngx_file_mtime(&fi); + MMDB_close(&database->mmdb); + database->mmdb = tmpdb; + + ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, + "Reload MMDB \"%s\"", + database->mmdb.filename); + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_geoip2_init(ngx_conf_t *cf) +{ + ngx_http_handler_pt *h; + ngx_http_core_main_conf_t *cmcf; + + cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); + + h = ngx_array_push(&cmcf->phases[NGX_HTTP_LOG_PHASE].handlers); + if (h == NULL) { + return NGX_ERROR; + } + + *h = ngx_http_geoip2_log_handler; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-geoip2-3.4/ngx_stream_geoip2_module.c b/modules_deb/libnginx-mod-http-geoip2-3.4/ngx_stream_geoip2_module.c new file mode 100644 index 0000000..eb59082 --- /dev/null +++ b/modules_deb/libnginx-mod-http-geoip2-3.4/ngx_stream_geoip2_module.c @@ -0,0 +1,694 @@ +/* + * Copyright (C) Lee Valentine + * Copyright (C) Andrei Belov + * + * Based on nginx's 'ngx_stream_geoip_module.c' by Igor Sysoev + */ + + +#include +#include +#include + +#include + + +typedef struct { + MMDB_s mmdb; + MMDB_lookup_result_s result; + time_t last_check; + time_t last_change; + time_t check_interval; +#if (NGX_HAVE_INET6) + uint8_t address[16]; +#else + unsigned long address; +#endif + ngx_queue_t queue; +} ngx_stream_geoip2_db_t; + +typedef struct { + ngx_queue_t databases; +} ngx_stream_geoip2_conf_t; + +typedef struct { + ngx_stream_geoip2_db_t *database; + const char **lookup; + ngx_str_t default_value; + ngx_stream_complex_value_t source; +} ngx_stream_geoip2_ctx_t; + +typedef struct { + ngx_stream_geoip2_db_t *database; + ngx_str_t metavalue; +} ngx_stream_geoip2_metadata_t; + + +static ngx_int_t ngx_stream_geoip2_variable(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static ngx_int_t ngx_stream_geoip2_metadata(ngx_stream_session_t *s, + ngx_stream_variable_value_t *v, uintptr_t data); +static void *ngx_stream_geoip2_create_conf(ngx_conf_t *cf); +static char *ngx_stream_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_stream_geoip2_parse_config(ngx_conf_t *cf, ngx_command_t *dummy, + void *conf); +static char *ngx_stream_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +static char *ngx_stream_geoip2_add_variable(ngx_conf_t *cf, ngx_command_t *dummy, + void *conf); +static char *ngx_stream_geoip2_add_variable_geodata(ngx_conf_t *cf, + ngx_stream_geoip2_db_t *database); +static char *ngx_stream_geoip2_add_variable_metadata(ngx_conf_t *cf, + ngx_stream_geoip2_db_t *database); +static void ngx_stream_geoip2_cleanup(void *data); +static ngx_int_t ngx_stream_geoip2_init(ngx_conf_t *cf); + + +#define FORMAT(fmt, ...) do { \ + p = ngx_palloc(s->connection->pool, NGX_OFF_T_LEN); \ + if (p == NULL) { \ + return NGX_ERROR; \ + } \ + v->len = ngx_sprintf(p, fmt, __VA_ARGS__) - p; \ + v->data = p; \ +} while (0) + +static ngx_command_t ngx_stream_geoip2_commands[] = { + + { ngx_string("geoip2"), + NGX_STREAM_MAIN_CONF|NGX_CONF_BLOCK|NGX_CONF_TAKE1, + ngx_stream_geoip2, + NGX_STREAM_MAIN_CONF_OFFSET, + 0, + NULL }, + + ngx_null_command +}; + + +static ngx_stream_module_t ngx_stream_geoip2_module_ctx = { + NULL, /* preconfiguration */ + ngx_stream_geoip2_init, /* postconfiguration */ + + ngx_stream_geoip2_create_conf, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL /* merge server configuration */ +}; + + +ngx_module_t ngx_stream_geoip2_module = { + NGX_MODULE_V1, + &ngx_stream_geoip2_module_ctx, /* module context */ + ngx_stream_geoip2_commands, /* module directives */ + NGX_STREAM_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + + +static ngx_int_t +ngx_stream_geoip2_variable(ngx_stream_session_t *s, ngx_stream_variable_value_t *v, + uintptr_t data) +{ + int mmdb_error; + u_char *p; + ngx_str_t val; + ngx_addr_t addr; + MMDB_entry_data_s entry_data; + ngx_stream_geoip2_ctx_t *geoip2 = (ngx_stream_geoip2_ctx_t *) data; + ngx_stream_geoip2_db_t *database = geoip2->database; + +#if (NGX_HAVE_INET6) + uint8_t address[16], *addressp = address; +#else + unsigned long address; +#endif + + if (geoip2->source.value.len > 0) { + if (ngx_stream_complex_value(s, &geoip2->source, &val) != NGX_OK) { + goto not_found; + } + + if (ngx_parse_addr(s->connection->pool, &addr, val.data, val.len) != NGX_OK) { + goto not_found; + } + } else { + addr.sockaddr = s->connection->sockaddr; + addr.socklen = s->connection->socklen; + } + + switch (addr.sockaddr->sa_family) { + case AF_INET: +#if (NGX_HAVE_INET6) + ngx_memset(addressp, 0, 12); + ngx_memcpy(addressp + 12, &((struct sockaddr_in *) + addr.sockaddr)->sin_addr.s_addr, 4); + break; + + case AF_INET6: + ngx_memcpy(addressp, &((struct sockaddr_in6 *) + addr.sockaddr)->sin6_addr.s6_addr, 16); +#else + address = ((struct sockaddr_in *)addr.sockaddr)->sin_addr.s_addr; +#endif + break; + + default: + goto not_found; + } + +#if (NGX_HAVE_INET6) + if (ngx_memcmp(&address, &database->address, sizeof(address)) != 0) { +#else + if (address != database->address) { +#endif + memcpy(&database->address, &address, sizeof(address)); + database->result = MMDB_lookup_sockaddr(&database->mmdb, + addr.sockaddr, &mmdb_error); + + if (mmdb_error != MMDB_SUCCESS) { + goto not_found; + } + } + + if (!database->result.found_entry + || MMDB_aget_value(&database->result.entry, &entry_data, geoip2->lookup) + != MMDB_SUCCESS) + { + goto not_found; + } + + if (!entry_data.has_data) { + goto not_found; + } + + switch (entry_data.type) { + case MMDB_DATA_TYPE_BOOLEAN: + FORMAT("%d", entry_data.boolean); + break; + case MMDB_DATA_TYPE_UTF8_STRING: + v->len = entry_data.data_size; + v->data = ngx_pnalloc(s->connection->pool, v->len); + if (v->data == NULL) { + return NGX_ERROR; + } + ngx_memcpy(v->data, (u_char *) entry_data.utf8_string, v->len); + break; + case MMDB_DATA_TYPE_BYTES: + v->len = entry_data.data_size; + v->data = ngx_pnalloc(s->connection->pool, v->len); + if (v->data == NULL) { + return NGX_ERROR; + } + ngx_memcpy(v->data, (u_char *) entry_data.bytes, v->len); + break; + case MMDB_DATA_TYPE_FLOAT: + FORMAT("%.5f", entry_data.float_value); + break; + case MMDB_DATA_TYPE_DOUBLE: + FORMAT("%.5f", entry_data.double_value); + break; + case MMDB_DATA_TYPE_UINT16: + FORMAT("%uD", entry_data.uint16); + break; + case MMDB_DATA_TYPE_UINT32: + FORMAT("%uD", entry_data.uint32); + break; + case MMDB_DATA_TYPE_INT32: + FORMAT("%D", entry_data.int32); + break; + case MMDB_DATA_TYPE_UINT64: + FORMAT("%uL", entry_data.uint64); + break; + case MMDB_DATA_TYPE_UINT128: ; +#if MMDB_UINT128_IS_BYTE_ARRAY + uint8_t *val = (uint8_t *) entry_data.uint128; + FORMAT("0x%02x%02x%02x%02x%02x%02x%02x%02x" + "%02x%02x%02x%02x%02x%02x%02x%02x", + val[0], val[1], val[2], val[3], + val[4], val[5], val[6], val[7], + val[8], val[9], val[10], val[11], + val[12], val[13], val[14], val[15]); +#else + mmdb_uint128_t val = entry_data.uint128; + FORMAT("0x%016uxL%016uxL", + (uint64_t) (val >> 64), (uint64_t) val); +#endif + break; + default: + goto not_found; + } + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; + +not_found: + if (geoip2->default_value.len > 0) { + v->data = geoip2->default_value.data; + v->len = geoip2->default_value.len; + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; + } + + v->not_found = 1; + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_geoip2_metadata(ngx_stream_session_t *s, ngx_stream_variable_value_t *v, + uintptr_t data) +{ + ngx_stream_geoip2_metadata_t *metadata = (ngx_stream_geoip2_metadata_t *) data; + ngx_stream_geoip2_db_t *database = metadata->database; + u_char *p; + + if (ngx_strncmp(metadata->metavalue.data, "build_epoch", 11) == 0) { + FORMAT("%uL", database->mmdb.metadata.build_epoch); + } else if (ngx_strncmp(metadata->metavalue.data, "last_check", 10) == 0) { + FORMAT("%T", database->last_check); + } else if (ngx_strncmp(metadata->metavalue.data, "last_change", 11) == 0) { + FORMAT("%T", database->last_change); + } else { + v->not_found = 1; + return NGX_OK; + } + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} + + +static void * +ngx_stream_geoip2_create_conf(ngx_conf_t *cf) +{ + ngx_pool_cleanup_t *cln; + ngx_stream_geoip2_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_stream_geoip2_conf_t)); + if (conf == NULL) { + return NULL; + } + + cln = ngx_pool_cleanup_add(cf->pool, 0); + if (cln == NULL) { + return NULL; + } + + ngx_queue_init(&conf->databases); + + cln->handler = ngx_stream_geoip2_cleanup; + cln->data = conf; + + return conf; +} + + +static char * +ngx_stream_geoip2(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + int status; + char *rv; + ngx_str_t *value; + ngx_conf_t save; + ngx_stream_geoip2_db_t *database; + ngx_stream_geoip2_conf_t *gcf = conf; + ngx_queue_t *q; + + value = cf->args->elts; + + if (value[1].data && value[1].data[0] != '/') { + if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) { + return NGX_CONF_ERROR; + } + } + + if (!ngx_queue_empty(&gcf->databases)) { + for (q = ngx_queue_head(&gcf->databases); + q != ngx_queue_sentinel(&gcf->databases); + q = ngx_queue_next(q)) + { + database = ngx_queue_data(q, ngx_stream_geoip2_db_t, queue); + if (ngx_strcmp(value[1].data, database->mmdb.filename) == 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "Duplicate GeoIP2 mmdb - %V", &value[1]); + return NGX_CONF_ERROR; + } + } + } + + database = ngx_pcalloc(cf->pool, sizeof(ngx_stream_geoip2_db_t)); + if (database == NULL) { + return NGX_CONF_ERROR; + } + + ngx_queue_insert_tail(&gcf->databases, &database->queue); + database->last_check = database->last_change = ngx_time(); + + status = MMDB_open((char *) value[1].data, MMDB_MODE_MMAP, &database->mmdb); + + if (status != MMDB_SUCCESS) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "MMDB_open(\"%V\") failed - %s", &value[1], + MMDB_strerror(status)); + return NGX_CONF_ERROR; + } + + save = *cf; + cf->handler = ngx_stream_geoip2_parse_config; + cf->handler_conf = (void *) database; + + rv = ngx_conf_parse(cf, NULL); + *cf = save; + return rv; +} + + +static char * +ngx_stream_geoip2_parse_config(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +{ + ngx_stream_geoip2_db_t *database; + ngx_str_t *value; + time_t interval; + + value = cf->args->elts; + + if (value[0].data[0] == '$') { + return ngx_stream_geoip2_add_variable(cf, dummy, conf); + } + + if (value[0].len == 11 + && ngx_strncmp(value[0].data, "auto_reload", 11) == 0) { + if ((int) cf->args->nelts != 2) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid number of arguments for auto_reload"); + return NGX_CONF_ERROR; + } + + interval = ngx_parse_time(&value[1], true); + + if (interval == (time_t) NGX_ERROR) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid interval for auto_reload \"%V\"", + value[1]); + return NGX_CONF_ERROR; + } + + + database = (ngx_stream_geoip2_db_t *) conf; + database->check_interval = interval; + return NGX_CONF_OK; + } + + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid setting \"%V\"", &value[0]); + return NGX_CONF_ERROR; +} + + +static char * +ngx_stream_geoip2_add_variable(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) +{ + ngx_stream_geoip2_db_t *database; + ngx_str_t *value; + int nelts; + + value = cf->args->elts; + + if (value[0].data[0] != '$') { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"%V\"", &value[0]); + return NGX_CONF_ERROR; + } + + value[0].len--; + value[0].data++; + + nelts = (int) cf->args->nelts; + database = (ngx_stream_geoip2_db_t *) conf; + + if (nelts > 0 && value[1].len == 8 && ngx_strncmp(value[1].data, "metadata", 8) == 0) { + return ngx_stream_geoip2_add_variable_metadata(cf, database); + } + + return ngx_stream_geoip2_add_variable_geodata(cf, database); +} + + +static char * +ngx_stream_geoip2_add_variable_metadata(ngx_conf_t *cf, ngx_stream_geoip2_db_t *database) +{ + ngx_stream_geoip2_metadata_t *metadata; + ngx_str_t *value, name; + ngx_stream_variable_t *var; + + metadata = ngx_pcalloc(cf->pool, sizeof(ngx_stream_geoip2_metadata_t)); + if (metadata == NULL) { + return NGX_CONF_ERROR; + } + + value = cf->args->elts; + name = value[0]; + + metadata->database = database; + metadata->metavalue = value[2]; + + var = ngx_stream_add_variable(cf, &name, NGX_STREAM_VAR_CHANGEABLE); + if (var == NULL) { + return NGX_CONF_ERROR; + } + + var->get_handler = ngx_stream_geoip2_metadata; + var->data = (uintptr_t) metadata; + + return NGX_CONF_OK; +} + + +static char * +ngx_stream_geoip2_add_variable_geodata(ngx_conf_t *cf, ngx_stream_geoip2_db_t *database) +{ + ngx_stream_geoip2_ctx_t *geoip2; + ngx_stream_compile_complex_value_t ccv; + ngx_str_t *value, name, source; + ngx_stream_variable_t *var; + int i, nelts, idx; + + geoip2 = ngx_pcalloc(cf->pool, sizeof(ngx_stream_geoip2_ctx_t)); + if (geoip2 == NULL) { + return NGX_CONF_ERROR; + } + + geoip2->database = database; + ngx_str_null(&source); + + value = cf->args->elts; + name = value[0]; + + nelts = (int) cf->args->nelts; + idx = 1; + + if (nelts > idx) { + for (i = idx; i < nelts; i++) { + if (ngx_strnstr(value[idx].data, "=", value[idx].len) == NULL) { + break; + } + + if (value[idx].len > 8 && ngx_strncmp(value[idx].data, "default=", 8) == 0) { + if (geoip2->default_value.len > 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "default has already been declared for \"$%V\"", &name); + return NGX_CONF_ERROR; + } + + geoip2->default_value.len = value[idx].len - 8; + geoip2->default_value.data = value[idx].data + 8; + + } else if (value[idx].len > 7 && ngx_strncmp(value[idx].data, "source=", 7) == 0) { + if (source.len > 0) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "source has already been declared for \"$%V\"", &name); + return NGX_CONF_ERROR; + } + + source.len = value[idx].len - 7; + source.data = value[idx].data + 7; + + if (source.data[0] != '$') { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid source variable name \"%V\"", &source); + return NGX_CONF_ERROR; + } + + ngx_memzero(&ccv, sizeof(ngx_stream_compile_complex_value_t)); + ccv.cf = cf; + ccv.value = &source; + ccv.complex_value = &geoip2->source; + + if (ngx_stream_compile_complex_value(&ccv) != NGX_OK) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "unable to compile \"%V\" for \"$%V\"", &source, &name); + return NGX_CONF_ERROR; + } + + } else { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid setting \"%V\" for \"$%V\"", &value[idx], &name); + return NGX_CONF_ERROR; + } + + idx++; + } + } + + var = ngx_stream_add_variable(cf, &name, NGX_STREAM_VAR_CHANGEABLE); + if (var == NULL) { + return NGX_CONF_ERROR; + } + + geoip2->lookup = ngx_pcalloc(cf->pool, + sizeof(const char *) * (cf->args->nelts - (idx - 1))); + + if (geoip2->lookup == NULL) { + return NGX_CONF_ERROR; + } + + for (i = idx; i < nelts; i++) { + geoip2->lookup[i - idx] = (char *) value[i].data; + } + geoip2->lookup[i - idx] = NULL; + + var->get_handler = ngx_stream_geoip2_variable; + var->data = (uintptr_t) geoip2; + + return NGX_CONF_OK; +} + + +static void +ngx_stream_geoip2_cleanup(void *data) +{ + ngx_queue_t *q; + ngx_stream_geoip2_db_t *database; + ngx_stream_geoip2_conf_t *gcf = data; + + while (!ngx_queue_empty(&gcf->databases)) { + q = ngx_queue_head(&gcf->databases); + ngx_queue_remove(q); + database = ngx_queue_data(q, ngx_stream_geoip2_db_t, queue); + MMDB_close(&database->mmdb); + } +} + + +static ngx_int_t +ngx_stream_geoip2_log_handler(ngx_stream_session_t *s) +{ + int status; + MMDB_s tmpdb; + ngx_queue_t *q; + ngx_file_info_t fi; + ngx_stream_geoip2_db_t *database; + ngx_stream_geoip2_conf_t *gcf; + + ngx_log_debug0(NGX_LOG_DEBUG_STREAM, s->connection->log, 0, + "geoip2 stream log handler"); + + gcf = ngx_stream_get_module_main_conf(s, ngx_stream_geoip2_module); + + if (ngx_queue_empty(&gcf->databases)) { + return NGX_OK; + } + + for (q = ngx_queue_head(&gcf->databases); + q != ngx_queue_sentinel(&gcf->databases); + q = ngx_queue_next(q)) + { + database = ngx_queue_data(q, ngx_stream_geoip2_db_t, queue); + if (database->check_interval == 0) { + continue; + } + + if ((database->last_check + database->check_interval) + > ngx_time()) + { + continue; + } + + database->last_check = ngx_time(); + + if (ngx_file_info(database->mmdb.filename, &fi) == NGX_FILE_ERROR) { + ngx_log_error(NGX_LOG_EMERG, s->connection->log, ngx_errno, + ngx_file_info_n " \"%s\" failed", + database->mmdb.filename); + + continue; + } + + if (ngx_file_mtime(&fi) <= database->last_change) { + continue; + } + + /* do the reload */ + + ngx_memzero(&tmpdb, sizeof(MMDB_s)); + status = MMDB_open(database->mmdb.filename, MMDB_MODE_MMAP, &tmpdb); + + if (status != MMDB_SUCCESS) { + ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, + "MMDB_open(\"%s\") failed to reload - %s", + database->mmdb.filename, MMDB_strerror(status)); + + continue; + } + + database->last_change = ngx_file_mtime(&fi); + MMDB_close(&database->mmdb); + database->mmdb = tmpdb; + + ngx_log_error(NGX_LOG_INFO, s->connection->log, 0, + "Reload MMDB \"%s\"", + database->mmdb.filename); + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_stream_geoip2_init(ngx_conf_t *cf) +{ + ngx_stream_handler_pt *h; + ngx_stream_core_main_conf_t *cmcf; + + cmcf = ngx_stream_conf_get_module_main_conf(cf, ngx_stream_core_module); + + h = ngx_array_push(&cmcf->phases[NGX_STREAM_LOG_PHASE].handlers); + if (h == NULL) { + return NGX_ERROR; + } + + *h = ngx_stream_geoip2_log_handler; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitattributes b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitattributes new file mode 100644 index 0000000..6fe6f35 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitattributes @@ -0,0 +1 @@ +*.t linguist-language=Text diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitignore b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitignore new file mode 100644 index 0000000..39c82fa --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.gitignore @@ -0,0 +1,54 @@ +reindex +.libs +*.swp +*.slo +*.la +*.swo +*.lo +*~ +*.o +print.txt +.rsync +*.tar.gz +dist +build[78] +build +tags +update-readme +*.tmp +test/Makefile +test/blib +test.sh +t.sh +t/t.sh +test/t/servroot/ +releng +reset +*.t_ +genmobi.sh +*.mobi +misc/chunked +src/headers.c +src/headers.h +src/module.c +src/module.h +src/util.c +src/util.h +go +ctags +src/in.c +src/in.h +src/out.c +src/out.h +build[89] +build1[0-9] +buildroot/ +work/ +all +t/servroot +analyze +cov +nginx +*.plist +a.patch +Makefile diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.travis.yml b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.travis.yml new file mode 100644 index 0000000..6b346a8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/.travis.yml @@ -0,0 +1,58 @@ +sudo: required +dist: focal + +branches: + only: + - "master" + +os: linux + +language: c + +compiler: + - gcc + +addons: + apt: + packages: + - axel + - cpanminus + +env: + global: + - LUAJIT_PREFIX=/opt/luajit21 + - LUAJIT_LIB=$LUAJIT_PREFIX/lib + - LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 + - LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH + matrix: + - NGINX_VERSION=1.25.3 WITHOUT_PCRE2=1 + - NGINX_VERSION=1.27.1 WITHOUT_PCRE2=1 + +before_install: + - sudo apt-get update -y + - sudo apt-get install -y ca-certificates + - sudo cpanm -v --notest Test::Nginx > build.log 2>&1 || (cat build.log && exit 1) + +install: + - git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module + - git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module + - git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core + - git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache + - git clone https://github.com/openresty/nginx-eval-module.git ../eval-nginx-module + - git clone https://github.com/openresty/openresty.git ../openresty + - git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx + - git clone https://github.com/openresty/nginx-devel-utils.git + - git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git luajit2 + +before_script: + - cd luajit2/ + - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT -msse4.2' > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + +script: + - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH + - export NGX_BUILD_CC=$CC + - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1) + - prove -I. -r t + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/LICENSE b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/LICENSE new file mode 100644 index 0000000..c14f60a --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/LICENSE @@ -0,0 +1,20 @@ +This module is licensed under the terms of the BSD license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown new file mode 100644 index 0000000..6baea91 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/README.markdown @@ -0,0 +1,538 @@ +Name +==== + +**ngx_headers_more** - Set and clear input and output headers...more than "add"! + +*This module is not distributed with the Nginx source.* See [the installation instructions](#installation). + +Table of Contents +================= + +* [Name](#name) +* [Version](#version) +* [Synopsis](#synopsis) +* [Description](#description) +* [Directives](#directives) + * [more_set_headers](#more_set_headers) + * [more_clear_headers](#more_clear_headers) + * [more_set_input_headers](#more_set_input_headers) + * [more_clear_input_headers](#more_clear_input_headers) +* [Limitations](#limitations) +* [Installation](#installation) +* [Compatibility](#compatibility) +* [Community](#community) + * [English Mailing List](#english-mailing-list) + * [Chinese Mailing List](#chinese-mailing-list) +* [Bugs and Patches](#bugs-and-patches) +* [Source Repository](#source-repository) +* [Changes](#changes) +* [Test Suite](#test-suite) +* [TODO](#todo) +* [Getting involved](#getting-involved) +* [Authors](#authors) +* [Copyright & License](#copyright--license) +* [See Also](#see-also) + +Version +======= + +This document describes headers-more-nginx-module [v0.34](https://github.com/openresty/headers-more-nginx-module/tags) released on 17 July 2022. + +Synopsis +======== + +```nginx + + # set the Server output header + more_set_headers 'Server: my-server'; + + # set and clear output headers + location /bar { + more_set_headers 'X-MyHeader: blah' 'X-MyHeader2: foo'; + more_set_headers -t 'text/plain text/css' 'Content-Type: text/foo'; + more_set_headers -s '400 404 500 503' -s 413 'Foo: Bar'; + more_clear_headers 'Content-Type'; + + # your proxy_pass/memcached_pass/or any other config goes here... + } + + # set output headers + location /type { + more_set_headers 'Content-Type: text/plain'; + # ... + } + + # set input headers + location /foo { + set $my_host 'my dog'; + more_set_input_headers 'Host: $my_host'; + more_set_input_headers -t 'text/plain' 'X-Foo: bah'; + + # now $host and $http_host have their new values... + # ... + } + + # replace input header X-Foo *only* if it already exists + more_set_input_headers -r 'X-Foo: howdy'; +``` + +Description +=========== + +This module allows you to add, set, or clear any output +or input header that you specify. + +This is an enhanced version of the standard +[headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module because it provides more utilities like +resetting or clearing "builtin headers" like `Content-Type`, +`Content-Length`, and `Server`. + +It also allows you to specify an optional HTTP status code +criteria using the `-s` option and an optional content +type criteria using the `-t` option while modifying the +output headers with the [more_set_headers](#more_set_headers) and +[more_clear_headers](#more_clear_headers) directives. For example, + +```nginx + more_set_headers -s 404 -t 'text/html' 'X-Foo: Bar'; +``` + +You can also specify multiple MIME types to filter out in a single `-t` option. +For example, + +```nginx +more_set_headers -t 'text/html text/plain' 'X-Foo: Bar'; +``` + +Never use other parameters like `charset=utf-8` in the `-t` option values; they will not +work as you would expect. + +Input headers can be modified as well. For example + +```nginx + location /foo { + more_set_input_headers 'Host: foo' 'User-Agent: faked'; + # now $host, $http_host, $user_agent, and + # $http_user_agent all have their new values. + } +``` + +The option `-t` is also available in the +[more_set_input_headers](#more_set_input_headers) and +[more_clear_input_headers](#more_clear_input_headers) directives (for request header filtering) while the `-s` option +is not allowed. + +Unlike the standard [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module, this module's directives will by +default apply to all the status codes, including `4xx` and `5xx`. + +[Back to TOC](#table-of-contents) + +Directives +========== + +[Back to TOC](#table-of-contents) + +more_set_headers +---------------- +**syntax:** *more_set_headers [-t <content-type list>]... [-s <status-code list>]... [-a] <new-header>...* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +Replaces (if any) or adds (if not any) the specified output headers when the response status code matches the codes specified by the `-s` option *AND* the response content type matches the types specified by the `-t` option. + +If the "-a" option is specified, the specified output headers can be appended directly without clearing the old fields. The behavior of builtin headers such as "Content-Type", "Content-Length", "Server", etc. cannot be changed. + +If either `-s` or `-t` is not specified or has an empty list value, then no match is required. Therefore, the following directive set the `Server` output header to the custom value for *any* status code and *any* content type: + +```nginx + + more_set_headers "Server: my_server"; +``` + +Existing response headers with the same name are always overridden. If you want to add headers incrementally, use the standard [add_header](http://nginx.org/en/docs/http/ngx_http_headers_module.html#add_header) directive instead. + +A single directive can set/add multiple output headers. For example + +```nginx + + more_set_headers 'Foo: bar' 'Baz: bah'; +``` + +Multiple occurrences of the options are allowed in a single directive. Their values will be merged together. For instance + +```nginx + + more_set_headers -s 404 -s '500 503' 'Foo: bar'; +``` + +is equivalent to + +```nginx + + more_set_headers -s '404 500 503' 'Foo: bar'; +``` + +The new header should be the one of the forms: + +1. `Name: Value` +1. `Name: ` +1. `Name` + +The last two effectively clear the value of the header `Name`. + +Nginx variables are allowed in header values. For example: + +```nginx + + set $my_var "dog"; + more_set_headers "Server: $my_var"; +``` + +But variables won't work in header keys due to performance considerations. + +Multiple set/clear header directives are allowed in a single location, and they're executed sequentially. + +Directives inherited from an upper level scope (say, http block or server blocks) are executed before the directives in the location block. + +Note that although `more_set_headers` is allowed in *location* if blocks, it is *not* allowed in the *server* if blocks, as in + +```nginx + + ? # This is NOT allowed! + ? server { + ? if ($args ~ 'download') { + ? more_set_headers 'Foo: Bar'; + ? } + ? ... + ? } +``` + +Behind the scene, use of this directive and its friend [more_clear_headers](#more_clear_headers) will (lazily) register an ouput header filter that modifies `r->headers_out` the way you specify. + +[Back to TOC](#table-of-contents) + +more_clear_headers +------------------ +**syntax:** *more_clear_headers [-t <content-type list>]... [-s <status-code list>]... <new-header>...* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +Clears the specified output headers. + +In fact, + +```nginx + + more_clear_headers -s 404 -t 'text/plain' Foo Baz; +``` + +is exactly equivalent to + +```nginx + + more_set_headers -s 404 -t 'text/plain' "Foo: " "Baz: "; +``` + +or + +```nginx + + more_set_headers -s 404 -t 'text/plain' Foo Baz +``` + +See [more_set_headers](#more_set_headers) for more details. + +The wildcard character, `*`, can also be used at the end of the header name to specify a pattern. For example, the following directive +effectively clears *any* output headers starting by "`X-Hidden-`": + +```nginx + + more_clear_headers 'X-Hidden-*'; +``` + +The `*` wildcard support was first introduced in [v0.09](#v009). + +[Back to TOC](#table-of-contents) + +more_set_input_headers +---------------------- +**syntax:** *more_set_input_headers [-r] [-t <content-type list>]... <new-header>...* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *rewrite tail* + +Very much like [more_set_headers](#more_set_headers) except that it operates on input headers (or request headers) and it only supports the `-t` option. + +Note that using the `-t` option in this directive means filtering by the `Content-Type` *request* header, rather than the response header. + +Behind the scene, use of this directive and its friend [more_clear_input_headers](#more_clear_input_headers) will (lazily) +register a `rewrite phase` handler that modifies `r->headers_in` the way you specify. Note that it always run at the *end* of +the `rewrite` phase so that it runs *after* the standard [rewrite module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html) +and works in subrequests as well. + +If the `-r` option is specified, then the headers will be replaced to the new values *only if* they already exist. + +[Back to TOC](#table-of-contents) + +more_clear_input_headers +------------------------ +**syntax:** *more_clear_input_headers [-t <content-type list>]... <new-header>...* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *rewrite tail* + +Clears the specified input headers. + +In fact, + +```nginx + + more_clear_input_headers -t 'text/plain' Foo Baz; +``` + +is exactly equivalent to + +```nginx + + more_set_input_headers -t 'text/plain' "Foo: " "Baz: "; +``` + +or + +```nginx + + more_set_input_headers -t 'text/plain' Foo Baz +``` + +To remove request headers "Foo" and "Baz" for all incoming requests regardless of the content type, we can write + +```nginx + + more_clear_input_headers "Foo" "Baz"; +``` + +See [more_set_input_headers](#more_set_input_headers) for more details. + +The wildcard character, `*`, can also be used at the end of the header name to specify a pattern. For example, the following directive +effectively clears *any* input headers starting by "`X-Hidden-`": + +```nginx + + more_clear_input_headers 'X-Hidden-*'; +``` + +[Back to TOC](#table-of-contents) + +Limitations +=========== + +* Unlike the standard [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module, this module does not automatically take care of the constraint among the `Expires`, `Cache-Control`, and `Last-Modified` headers. You have to get them right yourself or use the [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module together with this module. +* You cannot remove the `Connection` response header using this module because the `Connection` response header is generated by the standard `ngx_http_header_filter_module` in the Nginx core, whose output header filter runs always *after* the filter of this module. The only way to actually remove the `Connection` header is to patch the Nginx core, that is, editing the C function `ngx_http_header_filter` in the `src/http/ngx_http_header_filter_module.c` file. + +[Back to TOC](#table-of-contents) + +Installation +============ + +Grab the nginx source code from [nginx.org](http://nginx.org/), for example, +the version 1.17.8 (see [nginx compatibility](#compatibility)), and then build the source with this module: + +```bash + + wget 'http://nginx.org/download/nginx-1.17.8.tar.gz' + tar -xzvf nginx-1.17.8.tar.gz + cd nginx-1.17.8/ + + # Here we assume you would install you nginx under /opt/nginx/. + ./configure --prefix=/opt/nginx \ + --add-module=/path/to/headers-more-nginx-module + + make + make install +``` + +Download the latest version of the release tarball of this module from [headers-more-nginx-module file list](https://github.com/openresty/headers-more-nginx-module/tags). + +Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the +`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) +directive, for example, + +```nginx +load_module /path/to/modules/ngx_http_headers_more_filter_module.so; +``` + +Also, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org). + +[Back to TOC](#table-of-contents) + +Compatibility +============= + +The following versions of Nginx should work with this module: + +* **1.21.x** (last tested: 1.21.4) +* **1.19.x** (last tested: 1.19.9) +* **1.17.x** (last tested: 1.17.8) +* **1.16.x** +* **1.15.x** (last tested: 1.15.8) +* **1.14.x** +* **1.13.x** (last tested: 1.13.6) +* **1.12.x** +* **1.11.x** (last tested: 1.11.2) +* **1.10.x** +* **1.9.x** (last tested: 1.9.15) +* **1.8.x** +* **1.7.x** (last tested: 1.7.10) +* **1.6.x** (last tested: 1.6.2) +* **1.5.x** (last tested: 1.5.8) +* **1.4.x** (last tested: 1.4.4) +* **1.3.x** (last tested: 1.3.7) +* **1.2.x** (last tested: 1.2.9) +* **1.1.x** (last tested: 1.1.5) +* **1.0.x** (last tested: 1.0.11) +* **0.9.x** (last tested: 0.9.4) +* **0.8.x** (last tested: 0.8.54) +* **0.7.x >= 0.7.44** (last tested: 0.7.68) + +Earlier versions of Nginx like 0.6.x and 0.5.x will *not* work. + +If you find that any particular version of Nginx above 0.7.44 does not work with this module, please consider [reporting a bug](#report-bugs). + +[Back to TOC](#table-of-contents) + +Community +========= + +[Back to TOC](#table-of-contents) + +English Mailing List +-------------------- + +The [openresty-en](https://groups.google.com/group/openresty-en) mailing list is for English speakers. + +[Back to TOC](#table-of-contents) + +Chinese Mailing List +-------------------- + +The [openresty](https://groups.google.com/group/openresty) mailing list is for Chinese speakers. + +[Back to TOC](#table-of-contents) + +Bugs and Patches +================ + +Please submit bug reports, wishlists, or patches by + +1. creating a ticket on the [GitHub Issue Tracker](https://github.com/chaoslawful/lua-nginx-module/issues), +1. or posting to the [OpenResty community](#community). + +[Back to TOC](#table-of-contents) + +Source Repository +================= + +Available on github at [openresty/headers-more-nginx-module](https://github.com/openresty/headers-more-nginx-module). + +[Back to TOC](#table-of-contents) + +Changes +======= + +The changes of every release of this module can be obtained from the OpenResty bundle's change logs: + + + +[Back to TOC](#table-of-contents) + +Test Suite +========== + +This module comes with a Perl-driven test suite. The [test cases](https://github.com/openresty/headers-more-nginx-module/tree/master/t/) are +[declarative](https://github.com/openresty/headers-more-nginx-module/blob/master/t/sanity.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. + +To run it on your side: + +```bash + + $ PATH=/path/to/your/nginx-with-headers-more-module:$PATH prove -r t +``` + +To run the test suite with valgrind's memcheck, use the following commands: + +```bash + + $ export PATH=/path/to/your/nginx-with-headers-more-module:$PATH + $ TEST_NGINX_USE_VALGRIND=1 prove -r t +``` + +You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. + +Because a single nginx server (by default, `localhost:1984`) is used across all the test scripts (`.t` files), it's meaningless to run the test suite in parallel by specifying `-jN` when invoking the `prove` utility. + +Some parts of the test suite requires modules [proxy](http://nginx.org/en/docs/http/ngx_http_proxy_module.html), [rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html), and [echo](https://github.com/openresty/echo-nginx-module) to be enabled as well when building Nginx. + +[Back to TOC](#table-of-contents) + +TODO +==== + +* Support variables in new headers' keys. + +[Back to TOC](#table-of-contents) + +Getting involved +================ + +You'll be very welcomed to submit patches to the [author](#author) or just ask for a commit bit to the [source repository](#source-repository) on GitHub. + +[Back to TOC](#table-of-contents) + +Authors +======= + +* Yichun "agentzh" Zhang (章亦春) *<agentzh@gmail.com>*, OpenResty Inc. +* Bernd Dorn ( ) + +This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. + +[Back to TOC](#table-of-contents) + +Copyright & License +=================== + +The code base is borrowed directly from the standard [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module in Nginx 0.8.24. This part of code is copyrighted by Igor Sysoev. + +Copyright (c) 2009-2017, Yichun "agentzh" Zhang (章亦春) , OpenResty Inc. + +Copyright (c) 2010-2013, Bernd Dorn. + +The license text is available in the [LICENSE](LICENSE) file located in the root directory of the project. + +[Back to TOC](#table-of-contents) + +See Also +======== + +* The original thread on the Nginx mailing list that inspires this module's development: ["A question about add_header replication"](http://forum.nginx.org/read.php?2,11206,11738). +* The orginal announcement thread on the Nginx mailing list: ["The "headers_more" module: Set and clear output headers...more than 'add'!"](http://forum.nginx.org/read.php?2,23460). +* The original [blog post](http://agentzh.blogspot.com/2009/11/headers-more-module-scripting-input-and.html) about this module's initial development. +* The [echo module](https://github.com/openresty/echo-nginx-module) for Nginx module's automated testing. +* The standard [headers](http://nginx.org/en/docs/http/ngx_http_headers_module.html) module. + +[Back to TOC](#table-of-contents) + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/config b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/config new file mode 100644 index 0000000..5707cc4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/config @@ -0,0 +1,32 @@ +ngx_addon_name=ngx_http_headers_more_filter_module + +HEADERS_MORE_SRCS=" \ + $ngx_addon_dir/src/ngx_http_headers_more_filter_module.c \ + $ngx_addon_dir/src/ngx_http_headers_more_headers_out.c \ + $ngx_addon_dir/src/ngx_http_headers_more_headers_in.c \ + $ngx_addon_dir/src/ngx_http_headers_more_util.c \ + " + +HEADERS_MORE_DEPS=" \ + $ngx_addon_dir/src/ddebug.h \ + $ngx_addon_dir/src/ngx_http_headers_more_filter_module.h \ + $ngx_addon_dir/src/ngx_http_headers_more_headers_in.h \ + $ngx_addon_dir/src/ngx_http_headers_more_headers_out.h \ + $ngx_addon_dir/src/ngx_http_headers_more_headers_in.h \ + $ngx_addon_dir/src/ngx_http_headers_more_util.h \ + " + +if test -n "$ngx_module_link"; then + ngx_module_type=HTTP_AUX_FILTER + ngx_module_name=$ngx_addon_name + ngx_module_incs= + ngx_module_deps="$HEADERS_MORE_DEPS" + ngx_module_srcs="$HEADERS_MORE_SRCS" + ngx_module_libs= + + . auto/module +else + HTTP_AUX_FILTER_MODULES="$HTTP_AUX_FILTER_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $HEADERS_MORE_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $HEADERS_MORE_DEPS" +fi diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/changelog b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/changelog new file mode 100644 index 0000000..0fd56e3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/changelog @@ -0,0 +1,72 @@ +libnginx-mod-http-headers-more-filter (1:0.38-2) unstable; urgency=medium + + * d/control: bump Standards-Version: 4.7.2, no changes + + -- Jan Mojžíš Fri, 11 Apr 2025 14:26:59 +0200 + +libnginx-mod-http-headers-more-filter (1:0.38-1) unstable; urgency=medium + + * New upstream version 0.38 + * d/{control,copyright}: update my email to "janmojzis@debian.org" + * d/copyright: bump debian/* copyright year + * d/watch: use more generic template + * d/control: bump Standards-Version: 4.7.0, no changes + + -- Jan Mojžíš Mon, 10 Feb 2025 19:20:06 +0100 + +libnginx-mod-http-headers-more-filter (1:0.37-2) unstable; urgency=medium + + * d/watch: use new recommended github template + + -- Jan Mojžíš Sat, 13 Jan 2024 22:22:57 +0100 + +libnginx-mod-http-headers-more-filter (1:0.37-1) unstable; urgency=medium + + * New upstream version 0.37 + * d/gbp.conf: add [pull] track-missing = True + * d/copyright: bump my copyright year + * d/watch: remove filenamemangle + + -- Jan Mojžíš Sun, 07 Jan 2024 23:40:37 +0100 + +libnginx-mod-http-headers-more-filter (1:0.36-1) unstable; urgency=medium + + * New upstream version 0.36 + + -- Jan Mojžíš Mon, 18 Dec 2023 16:55:54 +0100 + +libnginx-mod-http-headers-more-filter (1:0.34-5) unstable; urgency=medium + + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + + -- Jan Mojžíš Sat, 07 Oct 2023 15:31:27 +0200 + +libnginx-mod-http-headers-more-filter (1:0.34-4) unstable; urgency=medium + + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Tue, 27 Jun 2023 23:16:38 +0200 + +libnginx-mod-http-headers-more-filter (1:0.34-3) unstable; urgency=medium + + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/gbb.conf: switched to debian branch main (debian-branch = main) + * d/copyright: bump my copyright year + * d/copyright: reformat text to be compatible with 'cme update dpkg-copyright' + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 12:56:26 +0100 + +libnginx-mod-http-headers-more-filter (1:0.34-2) unstable; urgency=medium + + * d/control: added Multi-Arch: foreign + + -- Jan Mojžíš Fri, 09 Dec 2022 12:50:28 +0100 + +libnginx-mod-http-headers-more-filter (1:0.34-1) experimental; urgency=medium + + * Initial release. (Closes: 1024151) + + -- Jan Mojžíš Wed, 30 Nov 2022 14:46:53 +0100 diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/control b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/control new file mode 100644 index 0000000..a8ebd83 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/control @@ -0,0 +1,26 @@ +Source: libnginx-mod-http-headers-more-filter +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jan Mojžíš , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, +Standards-Version: 4.7.2 +Homepage: https://github.com/openresty/headers-more-nginx-module +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-headers-more-filter.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-headers-more-filter +Rules-Requires-Root: no + +Package: libnginx-mod-http-headers-more-filter +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: Set and clear input and output headers for Nginx + The Headers More module allows you to add, set, or clear any output or input + header that you specify. + . + This is an enhanced version of the standard headers module because it provides + more utilities like resetting or clearing "builtin headers" like Content-Type, + Content-Length, and Server. diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/copyright b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/copyright new file mode 100644 index 0000000..251922c --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/copyright @@ -0,0 +1,62 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: headers-more-nginx-module +Upstream-Contact: Yichun "agentzh" Zhang (章亦春) +Source: https://github.com/openresty/headers-more-nginx-module + +Files: * +Copyright: 2010-2013, Bernd Dorn. + 2009-2017, Yichun "agentzh" Zhang (\x{7ae0}\x{4ea6}\x{6625}) , OpenResty Inc. +License: BSD-2-clause + +Files: config +Copyright: Igor Sysoev + 2010-2013, Bernd Dorn + 2009-2017, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. +License: BSD-2-clause + +Files: debian/* +Copyright: 2022, Miao Wang + 2022-2025, Jan Mojzis +License: BSD-2-clause + +Files: src/* +Copyright: Yichun Zhang (agentzh) +License: BSD-2-clause + +Files: src/ddebug.h +Copyright: Igor Sysoev + 2010-2013, Bernd Dorn + 2009-2017, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. +License: BSD-2-clause + +Files: t/* +Copyright: Igor Sysoev + 2010-2013, Bernd Dorn + 2009-2017, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. +License: BSD-2-clause + +Files: util/* +Copyright: Igor Sysoev + 2010-2013, Bernd Dorn + 2009-2017, Yichun "agentzh" Zhang (章亦春) , CloudFlare Inc. +License: BSD-2-clause + +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/gbp.conf b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/gbp.conf new file mode 100644 index 0000000..97cd209 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/gbp.conf @@ -0,0 +1,12 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = True +sign-tags = True + +[import-orig] +merge-mode = replace + +[pull] +track-missing = True diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/rules b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/rules new file mode 100755 index 0000000..d8309f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/source/format b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/control b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/control new file mode 100644 index 0000000..b95c6ff --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/control @@ -0,0 +1,13 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, + +Tests: helloworld +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/generic b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/helloworld b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/helloworld new file mode 100644 index 0000000..6a2e85b --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/tests/helloworld @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +cat < "/etc/nginx/sites-enabled/default" +server { + listen 80 default_server; + + location /helloworld { + more_set_headers 'Content-Type: text/helloworld'; + more_set_headers -s '200' 'Content-Type: text/helloworld200'; + return 200; + } +} +EOF + +exp="content_type: text/helloworld200 +response_code: 200" + +nginx -t +invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; } + +out=`curl --fail -w "content_type: %{content_type}\nresponse_code: %{http_code}\n" http://127.0.0.1/helloworld` + +if [ x"${out}" != x"${exp}" ]; then + echo "output:" + echo "=====================" + echo "${out}" + echo "=====================" + echo "expected output:" + echo "=====================" + echo "${exp}" + echo "=====================" + exit 1 +fi diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/upstream/metadata b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/upstream/metadata new file mode 100644 index 0000000..185ca21 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/openresty/headers-more-nginx-module/issues +Bug-Submit: https://github.com/openresty/headers-more-nginx-module/issues/new +Repository-Browse: https://github.com/openresty/headers-more-nginx-module diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/watch b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/watch new file mode 100644 index 0000000..426294e --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/openresty/headers-more-nginx-module/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h new file mode 100644 index 0000000..13879af --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ddebug.h @@ -0,0 +1,124 @@ +#ifndef DDEBUG_H +#define DDEBUG_H + + +#include +#include +#include +#include + + +#if defined(DDEBUG) && (DDEBUG) + +# if (NGX_HAVE_VARIADIC_MACROS) + +# define dd(...) fprintf(stderr, "headers-more *** %s: ", __func__); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, " at %s line %d.\n", __FILE__, __LINE__) + +# else + +#include +#include + +#include + +static ngx_inline void +dd(const char * fmt, ...) { +} + +# endif + +# if DDEBUG > 1 + +# define dd_enter() dd_enter_helper(r, __func__) + +# if defined(nginx_version) && nginx_version >= 8011 +# define dd_main_req_count r->main->count +# else +# define dd_main_req_count 0 +# endif + +static ngx_inline void +dd_enter_helper(ngx_http_request_t *r, const char *func) +{ + ngx_http_posted_request_t *pr; + + fprintf(stderr, "headers-more *** enter %s %.*s %.*s?%.*s c:%d m:%p r:%p ar:%p pr:%p", + func, + (int) r->method_name.len, r->method_name.data, + (int) r->uri.len, r->uri.data, + (int) r->args.len, r->args.data, + (int) dd_main_req_count, r->main, + r, r->connection->data, r->parent); + + if (r->posted_requests) { + fprintf(stderr, " posted:"); + + for (pr = r->posted_requests; pr; pr = pr->next) { + fprintf(stderr, "%p,", pr); + } + } + + fprintf(stderr, "\n"); +} + +# else + +# define dd_enter() + +# endif + +#else + +# if (NGX_HAVE_VARIADIC_MACROS) + +# define dd(...) + +# define dd_enter() + +# else + +#include + +static ngx_inline void +dd(const char * fmt, ...) { +} + +static ngx_inline void +dd_enter() { +} + +# endif + +#endif + +#if defined(DDEBUG) && (DDEBUG) + +#define dd_check_read_event_handler(r) \ + dd("r->read_event_handler = %s", \ + r->read_event_handler == ngx_http_block_reading ? \ + "ngx_http_block_reading" : \ + r->read_event_handler == ngx_http_test_reading ? \ + "ngx_http_test_reading" : \ + r->read_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#define dd_check_write_event_handler(r) \ + dd("r->write_event_handler = %s", \ + r->write_event_handler == ngx_http_handler ? \ + "ngx_http_handler" : \ + r->write_event_handler == ngx_http_core_run_phases ? \ + "ngx_http_core_run_phases" : \ + r->write_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#else + +#define dd_check_read_event_handler(r) +#define dd_check_write_event_handler(r) + +#endif + +#endif /* DDEBUG_H */ + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c new file mode 100644 index 0000000..0bb6fec --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.c @@ -0,0 +1,348 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_headers_more_filter_module.h" +#include "ngx_http_headers_more_headers_out.h" +#include "ngx_http_headers_more_headers_in.h" +#include "ngx_http_headers_more_util.h" +#include + + +/* config handlers */ + +static void *ngx_http_headers_more_create_loc_conf(ngx_conf_t *cf); +static char *ngx_http_headers_more_merge_loc_conf(ngx_conf_t *cf, + void *parent, void *child); +static void *ngx_http_headers_more_create_main_conf(ngx_conf_t *cf); +static ngx_int_t ngx_http_headers_more_post_config(ngx_conf_t *cf); + +/* post-read-phase handler */ + +static ngx_int_t ngx_http_headers_more_handler(ngx_http_request_t *r); + +/* filter handlers */ + +static ngx_int_t ngx_http_headers_more_filter_init(ngx_conf_t *cf); + +ngx_uint_t ngx_http_headers_more_location_hash = 0; + + +static ngx_command_t ngx_http_headers_more_filter_commands[] = { + + { ngx_string("more_set_headers"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_1MORE, + ngx_http_headers_more_set_headers, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL}, + + { ngx_string("more_clear_headers"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_1MORE, + ngx_http_headers_more_clear_headers, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL}, + + { ngx_string("more_set_input_headers"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_1MORE, + ngx_http_headers_more_set_input_headers, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL}, + + { ngx_string("more_clear_input_headers"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF + |NGX_CONF_1MORE, + ngx_http_headers_more_clear_input_headers, + NGX_HTTP_LOC_CONF_OFFSET, + 0, + NULL}, + + ngx_null_command +}; + + +static ngx_http_module_t ngx_http_headers_more_filter_module_ctx = { + NULL, /* preconfiguration */ + ngx_http_headers_more_post_config, /* postconfiguration */ + + ngx_http_headers_more_create_main_conf, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_headers_more_create_loc_conf, /* create location configuration */ + ngx_http_headers_more_merge_loc_conf /* merge location configuration */ +}; + + +ngx_module_t ngx_http_headers_more_filter_module = { + NGX_MODULE_V1, + &ngx_http_headers_more_filter_module_ctx, /* module context */ + ngx_http_headers_more_filter_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + + +static ngx_http_output_header_filter_pt ngx_http_next_header_filter; + + +static volatile ngx_cycle_t *ngx_http_headers_more_prev_cycle = NULL; + + +static ngx_int_t +ngx_http_headers_more_filter(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_uint_t i; + ngx_http_headers_more_loc_conf_t *conf; + ngx_http_headers_more_cmd_t *cmd; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "headers more header filter, uri \"%V\"", &r->uri); + + conf = ngx_http_get_module_loc_conf(r, ngx_http_headers_more_filter_module); + + if (conf->cmds) { + cmd = conf->cmds->elts; + for (i = 0; i < conf->cmds->nelts; i++) { + if (cmd[i].is_input) { + continue; + } + + rc = ngx_http_headers_more_exec_cmd(r, &cmd[i]); + + if (rc != NGX_OK) { + return rc; + } + } + } + + return ngx_http_next_header_filter(r); +} + + +static ngx_int_t +ngx_http_headers_more_filter_init(ngx_conf_t *cf) +{ + ngx_http_next_header_filter = ngx_http_top_header_filter; + ngx_http_top_header_filter = ngx_http_headers_more_filter; + + return NGX_OK; +} + + +static void * +ngx_http_headers_more_create_loc_conf(ngx_conf_t *cf) +{ + ngx_http_headers_more_loc_conf_t *conf; + + conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_headers_more_loc_conf_t)); + if (conf == NULL) { + return NULL; + } + + /* + * set by ngx_pcalloc(): + * + * conf->cmds = NULL; + */ + + return conf; +} + + +static char * +ngx_http_headers_more_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) +{ + ngx_uint_t i; + ngx_uint_t orig_len; + ngx_http_headers_more_cmd_t *prev_cmd, *cmd; + ngx_http_headers_more_loc_conf_t *prev = parent; + ngx_http_headers_more_loc_conf_t *conf = child; + + if (conf->cmds == NULL || conf->cmds->nelts == 0) { + conf->cmds = prev->cmds; + + } else if (prev->cmds && prev->cmds->nelts) { + orig_len = conf->cmds->nelts; + + (void) ngx_array_push_n(conf->cmds, prev->cmds->nelts); + + cmd = conf->cmds->elts; + + for (i = 0; i < orig_len; i++) { + cmd[conf->cmds->nelts - 1 - i] = cmd[orig_len - 1 - i]; + } + + prev_cmd = prev->cmds->elts; + + for (i = 0; i < prev->cmds->nelts; i++) { + cmd[i] = prev_cmd[i]; + } + } + + return NGX_CONF_OK; +} + + +static ngx_int_t +ngx_http_headers_more_post_config(ngx_conf_t *cf) +{ + int multi_http_blocks; + ngx_int_t rc; + ngx_http_handler_pt *h; + ngx_http_core_main_conf_t *cmcf; + + ngx_http_headers_more_main_conf_t *hmcf; + + ngx_http_headers_more_location_hash = + ngx_http_headers_more_hash_literal("location"); + + hmcf = ngx_http_conf_get_module_main_conf(cf, + ngx_http_headers_more_filter_module); + + if (ngx_http_headers_more_prev_cycle != ngx_cycle) { + ngx_http_headers_more_prev_cycle = ngx_cycle; + multi_http_blocks = 0; + + } else { + multi_http_blocks = 1; + } + + if (multi_http_blocks || hmcf->requires_filter) { + rc = ngx_http_headers_more_filter_init(cf); + if (rc != NGX_OK) { + return rc; + } + } + + if (!hmcf->requires_handler) { + return NGX_OK; + } + + cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module); + + h = ngx_array_push(&cmcf->phases[NGX_HTTP_REWRITE_PHASE].handlers); + if (h == NULL) { + return NGX_ERROR; + } + + *h = ngx_http_headers_more_handler; + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_headers_more_handler(ngx_http_request_t *r) +{ + ngx_int_t rc; + ngx_uint_t i; + ngx_http_headers_more_loc_conf_t *conf; + ngx_http_headers_more_main_conf_t *hmcf; + ngx_http_headers_more_cmd_t *cmd; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "headers more rewrite handler, uri \"%V\"", &r->uri); + + hmcf = ngx_http_get_module_main_conf(r, + ngx_http_headers_more_filter_module); + + if (!hmcf->postponed_to_phase_end) { + ngx_http_core_main_conf_t *cmcf; + ngx_http_phase_handler_t tmp; + ngx_http_phase_handler_t *ph; + ngx_http_phase_handler_t *cur_ph; + ngx_http_phase_handler_t *last_ph; + + hmcf->postponed_to_phase_end = 1; + + cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); + + ph = cmcf->phase_engine.handlers; + cur_ph = &ph[r->phase_handler]; + last_ph = &ph[cur_ph->next - 1]; + + if (cur_ph < last_ph) { + dd("swaping the contents of cur_ph and last_ph..."); + + tmp = *cur_ph; + + memmove(cur_ph, cur_ph + 1, + (last_ph - cur_ph) * sizeof (ngx_http_phase_handler_t)); + + *last_ph = tmp; + + r->phase_handler--; /* redo the current ph */ + + return NGX_DECLINED; + } + } + + dd("running phase handler..."); + + conf = ngx_http_get_module_loc_conf(r, ngx_http_headers_more_filter_module); + + if (conf->cmds) { + if (r->http_version < NGX_HTTP_VERSION_10) { + return NGX_DECLINED; + } + + cmd = conf->cmds->elts; + for (i = 0; i < conf->cmds->nelts; i++) { + if (!cmd[i].is_input) { + continue; + } + + rc = ngx_http_headers_more_exec_input_cmd(r, &cmd[i]); + + if (rc != NGX_OK) { + return rc; + } + } + } + + return NGX_DECLINED; +} + + +static void * +ngx_http_headers_more_create_main_conf(ngx_conf_t *cf) +{ + ngx_http_headers_more_main_conf_t *hmcf; + + hmcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_headers_more_main_conf_t)); + if (hmcf == NULL) { + return NULL; + } + + /* set by ngx_pcalloc: + * hmcf->postponed_to_phase_end = 0; + * hmcf->requires_filter = 0; + * hmcf->requires_handler = 0; + */ + + return hmcf; +} diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h new file mode 100644 index 0000000..5f31ab4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_filter_module.h @@ -0,0 +1,81 @@ + +/* + * Copyright (c) Yichun Zhang (agentzh) + */ + + +#ifndef NGX_HTTP_HEADERS_MORE_FILTER_MODULE_H +#define NGX_HTTP_HEADERS_MORE_FILTER_MODULE_H + + +#include +#include +#include + + +typedef enum { + ngx_http_headers_more_opcode_set, + ngx_http_headers_more_opcode_clear +} ngx_http_headers_more_opcode_t; + + +typedef struct { + ngx_array_t *types; /* of ngx_str_t */ + ngx_array_t *statuses; /* of ngx_uint_t */ + ngx_array_t *headers; /* of ngx_http_header_val_t */ + ngx_flag_t is_input; +} ngx_http_headers_more_cmd_t; + + +typedef struct { + ngx_array_t *cmds; /* of ngx_http_headers_more_cmd_t */ +} ngx_http_headers_more_loc_conf_t; + + +typedef struct { + ngx_int_t postponed_to_phase_end; + ngx_int_t requires_filter; + ngx_int_t requires_handler; +} ngx_http_headers_more_main_conf_t; + + +typedef struct ngx_http_headers_more_header_val_s + ngx_http_headers_more_header_val_t; + + +typedef ngx_int_t (*ngx_http_headers_more_set_header_pt)(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); + + +typedef struct { + ngx_str_t name; + ngx_uint_t offset; + ngx_http_headers_more_set_header_pt handler; +} ngx_http_headers_more_set_header_t; + + +struct ngx_http_headers_more_header_val_s { + ngx_http_complex_value_t value; + ngx_uint_t hash; + ngx_str_t key; + ngx_http_headers_more_set_header_pt handler; + ngx_uint_t offset; + unsigned replace:1; + unsigned wildcard:1; + unsigned append:1; +}; + + +extern ngx_module_t ngx_http_headers_more_filter_module; + + +#ifndef ngx_str_set +#define ngx_str_set(str, text) \ + (str)->len = sizeof(text) - 1; (str)->data = (u_char *) text +#endif + + +#define ngx_http_headers_more_assert(a) assert(a) + + +#endif /* NGX_HTTP_HEADERS_MORE_FILTER_MODULE_H */ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c new file mode 100644 index 0000000..983be5b --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.c @@ -0,0 +1,959 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_headers_more_headers_in.h" +#include "ngx_http_headers_more_util.h" +#include + + +static char *ngx_http_headers_more_parse_directive(ngx_conf_t *cf, + ngx_command_t *ngx_cmd, void *conf, + ngx_http_headers_more_opcode_t opcode); +static int ngx_http_headers_more_check_type(ngx_http_request_t *r, + ngx_array_t *types); +static ngx_int_t ngx_http_set_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_header_helper(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value, + ngx_table_elt_t **output_header); +static ngx_int_t ngx_http_set_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_user_agent_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_clear_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_clear_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_host_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_connection_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_headers_more_validate_host(ngx_str_t *host, + ngx_pool_t *pool, ngx_uint_t alloc); + + +static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] + = { + + { ngx_string("Host"), + offsetof(ngx_http_headers_in_t, host), + ngx_http_set_host_header }, + + { ngx_string("Connection"), + offsetof(ngx_http_headers_in_t, connection), + ngx_http_set_connection_header }, + + { ngx_string("If-Modified-Since"), + offsetof(ngx_http_headers_in_t, if_modified_since), + ngx_http_set_builtin_header }, + +#if defined(nginx_version) && nginx_version >= 9002 + { ngx_string("If-Unmodified-Since"), + offsetof(ngx_http_headers_in_t, if_unmodified_since), + ngx_http_set_builtin_header }, +#endif + +#if defined(nginx_version) && nginx_version >= 1003003 + { ngx_string("If-Match"), + offsetof(ngx_http_headers_in_t, if_match), + ngx_http_set_builtin_header }, + + { ngx_string("If-None-Match"), + offsetof(ngx_http_headers_in_t, if_none_match), + ngx_http_set_builtin_header }, +#endif + + { ngx_string("User-Agent"), + offsetof(ngx_http_headers_in_t, user_agent), + ngx_http_set_user_agent_header }, + + { ngx_string("Referer"), + offsetof(ngx_http_headers_in_t, referer), + ngx_http_set_builtin_header }, + + { ngx_string("Content-Length"), + offsetof(ngx_http_headers_in_t, content_length), + ngx_http_set_content_length_header }, + + { ngx_string("Content-Type"), + offsetof(ngx_http_headers_in_t, content_type), + ngx_http_set_builtin_header }, + + { ngx_string("Range"), + offsetof(ngx_http_headers_in_t, range), + ngx_http_set_builtin_header }, + + { ngx_string("If-Range"), + offsetof(ngx_http_headers_in_t, if_range), + ngx_http_set_builtin_header }, + + { ngx_string("Transfer-Encoding"), + offsetof(ngx_http_headers_in_t, transfer_encoding), + ngx_http_set_builtin_header }, + + { ngx_string("Expect"), + offsetof(ngx_http_headers_in_t, expect), + ngx_http_set_builtin_header }, + +#if defined(nginx_version) && nginx_version >= 1003013 + { ngx_string("Upgrade"), + offsetof(ngx_http_headers_in_t, upgrade), + ngx_http_set_builtin_header }, +#endif + +#if (NGX_HTTP_GZIP) + { ngx_string("Accept-Encoding"), + offsetof(ngx_http_headers_in_t, accept_encoding), + ngx_http_set_builtin_header }, + + { ngx_string("Via"), offsetof(ngx_http_headers_in_t, via), + ngx_http_set_builtin_header }, +#endif + + { ngx_string("Authorization"), + offsetof(ngx_http_headers_in_t, authorization), + ngx_http_set_builtin_header }, + + { ngx_string("Keep-Alive"), + offsetof(ngx_http_headers_in_t, keep_alive), + ngx_http_set_builtin_header }, + +#if (NGX_HTTP_X_FORWARDED_FOR) + { ngx_string("X-Forwarded-For"), + offsetof(ngx_http_headers_in_t, x_forwarded_for), + ngx_http_set_builtin_multi_header }, + +#endif + +#if (NGX_HTTP_REALIP) + { ngx_string("X-Real-IP"), + offsetof(ngx_http_headers_in_t, x_real_ip), + ngx_http_set_builtin_header }, +#endif + +#if (NGX_HTTP_DAV) + { ngx_string("Depth"), offsetof(ngx_http_headers_in_t, depth), + ngx_http_set_builtin_header }, + + { ngx_string("Destination"), offsetof(ngx_http_headers_in_t, destination), + ngx_http_set_builtin_header }, + + { ngx_string("Overwrite"), offsetof(ngx_http_headers_in_t, overwrite), + ngx_http_set_builtin_header }, + + { ngx_string("Date"), offsetof(ngx_http_headers_in_t, date), + ngx_http_set_builtin_header }, +#endif + +#if defined(nginx_version) && nginx_version >= 1023000 + { ngx_string("Cookie"), + offsetof(ngx_http_headers_in_t, cookie), + ngx_http_set_builtin_multi_header }, +#else + { ngx_string("Cookie"), + offsetof(ngx_http_headers_in_t, cookies), + ngx_http_set_builtin_multi_header }, +#endif + + { ngx_null_string, 0, ngx_http_set_header } +}; + + +ngx_int_t +ngx_http_headers_more_exec_input_cmd(ngx_http_request_t *r, + ngx_http_headers_more_cmd_t *cmd) +{ + ngx_str_t value; + ngx_http_headers_more_header_val_t *h; + ngx_uint_t i; + + if (!cmd->headers) { + return NGX_OK; + } + + if (cmd->types && !ngx_http_headers_more_check_type(r, cmd->types)) { + return NGX_OK; + } + + h = cmd->headers->elts; + for (i = 0; i < cmd->headers->nelts; i++) { + + if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) { + return NGX_ERROR; + } + + if (value.len) { + value.len--; /* remove the trailing '\0' added by + ngx_http_headers_more_parse_header */ + } + + if (h[i].handler(r, &h[i], &value) != NGX_OK) { + return NGX_ERROR; + } + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_set_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + return ngx_http_set_header_helper(r, hv, value, NULL); +} + + +static ngx_int_t +ngx_http_set_header_helper(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value, + ngx_table_elt_t **output_header) +{ + ngx_table_elt_t *h, *matched; + ngx_list_part_t *part; + ngx_uint_t i; + ngx_uint_t rc; + + dd_enter(); + + matched = NULL; + +retry: + + part = &r->headers_in.headers.part; + h = part->elts; + + for (i = 0; /* void */; i++) { + dd("i: %d, part: %p", (int) i, part); + + if (i >= part->nelts) { + if (part->next == NULL) { + break; + } + + part = part->next; + h = part->elts; + i = 0; + } + + if (!hv->wildcard + && h[i].key.len == hv->key.len + && ngx_strncasecmp(h[i].key.data, hv->key.data, + h[i].key.len) == 0) + { + goto matched; + } + + if (hv->wildcard + && value->len == 0 + && h[i].key.len >= hv->key.len - 1 + && ngx_strncasecmp(h[i].key.data, hv->key.data, + hv->key.len - 1) == 0) + { + goto matched; + } + + /* not matched */ + continue; + +matched: + + if (value->len == 0 || (matched && matched != &h[i])) { + h[i].hash = 0; + + rc = ngx_http_headers_more_rm_header_helper( + &r->headers_in.headers, part, i); + + ngx_http_headers_more_assert( + !(r->headers_in.headers.part.next == NULL + && r->headers_in.headers.last + != &r->headers_in.headers.part)); + + if (rc == NGX_OK) { + if (output_header) { + *output_header = NULL; + } + + goto retry; + } + + return NGX_ERROR; + } + + h[i].value = *value; + + if (output_header) { + *output_header = &h[i]; + dd("setting existing builtin input header"); + } + + if (matched == NULL) { + matched = &h[i]; + } + } + + if (matched) { + return NGX_OK; + } + + if (value->len == 0 || hv->replace) { + return NGX_OK; + } + + if (r->headers_in.headers.last == NULL) { + /* must be 400 bad request */ + return NGX_OK; + } + + h = ngx_list_push(&r->headers_in.headers); + + if (h == NULL) { + return NGX_ERROR; + } + + dd("created new header for %.*s", (int) hv->key.len, hv->key.data); + + if (value->len == 0) { + h->hash = 0; + + } else { + h->hash = hv->hash; + } + + h->key = hv->key; + h->value = *value; +#if defined(nginx_version) && nginx_version >= 1023000 + h->next = NULL; +#endif + + h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); + if (h->lowcase_key == NULL) { + return NGX_ERROR; + } + + ngx_strlow(h->lowcase_key, h->key.data, h->key.len); + + if (output_header) { + *output_header = h; + + while (r != r->main) { + r->parent->headers_in = r->headers_in; + r = r->parent; + } + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_set_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + ngx_table_elt_t *h, **old; + + dd("entered set_builtin_header (input)"); + + if (hv->offset) { + old = (ngx_table_elt_t **) ((char *) &r->headers_in + hv->offset); + + } else { + old = NULL; + } + + dd("old builtin ptr ptr: %p", old); + if (old) { + dd("old builtin ptr: %p", *old); + } + + if (old == NULL || *old == NULL) { + dd("set normal header"); + return ngx_http_set_header_helper(r, hv, value, old); + } + + h = *old; + + if (value->len == 0) { + h->hash = 0; + h->value = *value; + + return ngx_http_set_header_helper(r, hv, value, old); + } + + h->hash = hv->hash; + h->value = *value; + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_set_host_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + ngx_str_t host; + + if (value->len) { + host= *value; + + if (ngx_http_headers_more_validate_host(&host, r->pool, 0) != NGX_OK) { + return NGX_ERROR; + } + + r->headers_in.server = host; + + } else { + r->headers_in.server = *value; + } + + return ngx_http_set_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_set_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + off_t len; + + if (value->len == 0) { + return ngx_http_clear_content_length_header(r, hv, value); + } + + len = ngx_atosz(value->data, value->len); + if (len == NGX_ERROR) { + return NGX_ERROR; + } + + dd("reset headers_in.content_length_n to %d", (int) len); + + r->headers_in.content_length_n = len; + + return ngx_http_set_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_clear_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + r->headers_in.content_length_n = -1; + + return ngx_http_clear_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_clear_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + value->len = 0; + return ngx_http_set_builtin_header(r, hv, value); +} + + +char * +ngx_http_headers_more_set_input_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf) +{ + return ngx_http_headers_more_parse_directive(cf, cmd, conf, + ngx_http_headers_more_opcode_set); +} + + +char * +ngx_http_headers_more_clear_input_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf) +{ + return ngx_http_headers_more_parse_directive(cf, cmd, conf, + ngx_http_headers_more_opcode_clear); +} + + +static int +ngx_http_headers_more_check_type(ngx_http_request_t *r, ngx_array_t *types) +{ + ngx_uint_t i; + ngx_str_t *t; + ngx_str_t actual_type; + + if (r->headers_in.content_type == NULL) { + return 0; + } + + actual_type = r->headers_in.content_type->value; + if (actual_type.len == 0) { + return 0; + } + + dd("headers_in->content_type: %.*s", + (int) actual_type.len, + actual_type.data); + + t = types->elts; + for (i = 0; i < types->nelts; i++) { + dd("...comparing with type [%.*s]", (int) t[i].len, t[i].data); + + if (actual_type.len == t[i].len + && ngx_strncmp(actual_type.data, t[i].data, t[i].len) == 0) + { + return 1; + } + } + + return 0; +} + + +static char * +ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, + void *conf, ngx_http_headers_more_opcode_t opcode) +{ + ngx_http_headers_more_loc_conf_t *hlcf = conf; + + ngx_uint_t i; + ngx_http_headers_more_cmd_t *cmd; + ngx_str_t *arg; + ngx_flag_t ignore_next_arg; + ngx_str_t *cmd_name; + ngx_int_t rc; + ngx_flag_t replace = 0; + ngx_http_headers_more_header_val_t *h; + + ngx_http_headers_more_main_conf_t *hmcf; + + if (hlcf->cmds == NULL) { + hlcf->cmds = ngx_array_create(cf->pool, 1, + sizeof(ngx_http_headers_more_cmd_t)); + + if (hlcf->cmds == NULL) { + return NGX_CONF_ERROR; + } + } + + cmd = ngx_array_push(hlcf->cmds); + + if (cmd == NULL) { + return NGX_CONF_ERROR; + } + + cmd->headers = ngx_array_create(cf->pool, 1, + sizeof(ngx_http_headers_more_header_val_t)); + + if (cmd->headers == NULL) { + return NGX_CONF_ERROR; + } + + cmd->types = ngx_array_create(cf->pool, 1, sizeof(ngx_str_t)); + if (cmd->types == NULL) { + return NGX_CONF_ERROR; + } + + cmd->statuses = NULL; + + arg = cf->args->elts; + + cmd_name = &arg[0]; + + ignore_next_arg = 0; + + for (i = 1; i < cf->args->nelts; i++) { + if (ignore_next_arg) { + ignore_next_arg = 0; + continue; + } + + if (arg[i].len == 0) { + continue; + } + + if (arg[i].data[0] != '-') { + rc = ngx_http_headers_more_parse_header(cf, cmd_name, + &arg[i], cmd->headers, + opcode, + ngx_http_headers_more_set_handlers); + + if (rc != NGX_OK) { + return NGX_CONF_ERROR; + } + + continue; + } + + if (arg[i].len == 2) { + if (arg[i].data[1] == 't') { + if (i == cf->args->nelts - 1) { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: option -t takes an argument.", + cmd_name); + + return NGX_CONF_ERROR; + } + + rc = ngx_http_headers_more_parse_types(cf->log, cmd_name, + &arg[i + 1], + cmd->types); + + if (rc != NGX_OK) { + return NGX_CONF_ERROR; + } + + ignore_next_arg = 1; + + continue; + } + + if (arg[i].data[1] == 'r') { + dd("Found replace flag"); + replace = 1; + continue; + } + } + + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: invalid option name: \"%V\"", cmd_name, &arg[i]); + + return NGX_CONF_ERROR; + } + + dd("Found %d types, and %d headers", + (int) cmd->types->nelts, + (int) cmd->headers->nelts); + + if (cmd->headers->nelts == 0) { + ngx_pfree(cf->pool, cmd->headers); + cmd->headers = NULL; + + } else { + h = cmd->headers->elts; + for (i = 0; i < cmd->headers->nelts; i++) { + h[i].replace = replace; + } + } + + if (cmd->types->nelts == 0) { + ngx_pfree(cf->pool, cmd->types); + cmd->types = NULL; + } + + cmd->is_input = 1; + + hmcf = ngx_http_conf_get_module_main_conf(cf, + ngx_http_headers_more_filter_module); + + hmcf->requires_handler = 1; + + return NGX_CONF_OK; +} + + +/* borrowed the code from ngx_http_request.c:ngx_http_process_user_agent */ +static ngx_int_t +ngx_http_set_user_agent_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + u_char *user_agent, *msie; + + /* clear existing settings */ + + r->headers_in.msie = 0; + r->headers_in.msie6 = 0; + r->headers_in.opera = 0; + r->headers_in.gecko = 0; + r->headers_in.chrome = 0; + r->headers_in.safari = 0; + r->headers_in.konqueror = 0; + + if (value->len == 0) { + return ngx_http_set_builtin_header(r, hv, value); + } + + /* check some widespread browsers */ + + user_agent = value->data; + + msie = ngx_strstrn(user_agent, "MSIE ", 5 - 1); + + if (msie && msie + 7 < user_agent + value->len) { + + r->headers_in.msie = 1; + + if (msie[6] == '.') { + + switch (msie[5]) { + case '4': + case '5': + r->headers_in.msie6 = 1; + break; + case '6': + if (ngx_strstrn(msie + 8, "SV1", 3 - 1) == NULL) { + r->headers_in.msie6 = 1; + } + break; + } + } + } + + if (ngx_strstrn(user_agent, "Opera", 5 - 1)) { + r->headers_in.opera = 1; + r->headers_in.msie = 0; + r->headers_in.msie6 = 0; + } + + if (!r->headers_in.msie && !r->headers_in.opera) { + + if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) { + r->headers_in.gecko = 1; + + } else if (ngx_strstrn(user_agent, "Chrome/", 7 - 1)) { + r->headers_in.chrome = 1; + + } else if (ngx_strstrn(user_agent, "Safari/", 7 - 1) + && ngx_strstrn(user_agent, "Mac OS X", 8 - 1)) + { + r->headers_in.safari = 1; + + } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) { + r->headers_in.konqueror = 1; + } + } + + return ngx_http_set_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_set_connection_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + r->headers_in.connection_type = 0; + + if (value->len == 0) { + return ngx_http_set_builtin_header(r, hv, value); + } + + if (ngx_strcasestrn(value->data, "close", 5 - 1)) { + r->headers_in.connection_type = NGX_HTTP_CONNECTION_CLOSE; + r->headers_in.keep_alive_n = -1; + r->keepalive = 0; + + } else if (ngx_strcasestrn(value->data, "keep-alive", 10 - 1)) { + r->headers_in.connection_type = NGX_HTTP_CONNECTION_KEEP_ALIVE; + } + + return ngx_http_set_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ +#if defined(nginx_version) && nginx_version >= 1023000 + ngx_table_elt_t **headers, **ph, *h; +#if (DDEBUG) + int nelts; +#endif + + if (r->headers_out.status == 400 || r->headers_in.headers.last == NULL) { + /* must be a 400 Bad Request */ + return NGX_OK; + } + + headers = (ngx_table_elt_t **) ((char *) &r->headers_in + hv->offset); + + if (*headers) { +#if (DDEBUG) + nelts = 0; + for (h = *headers; h; h = h->next) { + nelts++; + } + + dd("clear multi-value headers: %d", nelts); +#endif + + *headers = NULL; + } + + if (ngx_http_set_header_helper(r, hv, value, &h) == NGX_ERROR) { + return NGX_ERROR; + } + + if (value->len == 0) { + return NGX_OK; + } + + dd("new multi-value header: %p", h); + + if (*headers) { + for (ph = headers; *ph; ph = &(*ph)->next) { /* void */ } + *ph = h; + + } else { + *headers = h; + } + + h->next = NULL; + + return NGX_OK; +#else + ngx_array_t *headers; + ngx_table_elt_t **v, *h; + + if (r->headers_out.status == 400 || r->headers_in.headers.last == NULL) { + /* must be a 400 Bad Request */ + return NGX_OK; + } + + headers = (ngx_array_t *) ((char *) &r->headers_in + hv->offset); + + if (headers->nelts > 0) { + ngx_array_destroy(headers); + + if (ngx_array_init(headers, r->pool, 2, + sizeof(ngx_table_elt_t *)) + != NGX_OK) + { + return NGX_ERROR; + } + + dd("clear multi-value headers: %d", (int) headers->nelts); + } + +#if 1 + if (headers->nalloc == 0) { + if (ngx_array_init(headers, r->pool, 2, + sizeof(ngx_table_elt_t *)) + != NGX_OK) + { + return NGX_ERROR; + } + } +#endif + + h = NULL; + if (ngx_http_set_header_helper(r, hv, value, &h) == NGX_ERROR) { + return NGX_ERROR; + } + + if (value->len == 0) { + return NGX_OK; + } + + dd("new cookie header: %p", h); + + v = ngx_array_push(headers); + if (v == NULL) { + return NGX_ERROR; + } + + *v = h; + return NGX_OK; +#endif +} + + +static ngx_int_t +ngx_http_headers_more_validate_host(ngx_str_t *host, ngx_pool_t *pool, + ngx_uint_t alloc) +{ + u_char *h, ch; + size_t i, dot_pos, host_len; + + enum { + sw_usual = 0, + sw_literal, + sw_rest + } state; + + dot_pos = host->len; + host_len = host->len; + + h = host->data; + + state = sw_usual; + + for (i = 0; i < host->len; i++) { + ch = h[i]; + + switch (ch) { + + case '.': + if (dot_pos == i - 1) { + return NGX_DECLINED; + } + + dot_pos = i; + break; + + case ':': + if (state == sw_usual) { + host_len = i; + state = sw_rest; + } + break; + + case '[': + if (i == 0) { + state = sw_literal; + } + break; + + case ']': + if (state == sw_literal) { + host_len = i + 1; + state = sw_rest; + } + break; + + case '\0': + return NGX_DECLINED; + + default: + + if (ngx_path_separator(ch)) { + return NGX_DECLINED; + } + + if (ch >= 'A' && ch <= 'Z') { + alloc = 1; + } + + break; + } + } + + if (dot_pos == host_len - 1) { + host_len--; + } + + if (host_len == 0) { + return NGX_DECLINED; + } + + if (alloc) { + host->data = ngx_pnalloc(pool, host_len); + if (host->data == NULL) { + return NGX_ERROR; + } + + ngx_strlow(host->data, h, host_len); + } + + host->len = host_len; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h new file mode 100644 index 0000000..d2251da --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_in.h @@ -0,0 +1,26 @@ + +/* + * Copyright (c) Yichun Zhang (agentzh) + */ + + +#ifndef NGX_HTTP_HEADERS_MORE_INPUT_HEADERS_H +#define NGX_HTTP_HEADERS_MORE_INPUT_HEADERS_H + + +#include "ngx_http_headers_more_filter_module.h" + + +/* output header setters and clearers */ + +ngx_int_t ngx_http_headers_more_exec_input_cmd(ngx_http_request_t *r, + ngx_http_headers_more_cmd_t *cmd); + +char *ngx_http_headers_more_set_input_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); + +char *ngx_http_headers_more_clear_input_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); + + +#endif /* NGX_HTTP_HEADERS_MORE_INPUT_HEADERS_H */ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c new file mode 100644 index 0000000..2a95b5f --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.c @@ -0,0 +1,814 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_headers_more_headers_out.h" +#include "ngx_http_headers_more_util.h" +#include + + +static char * +ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, + void *conf, ngx_http_headers_more_opcode_t opcode); +static ngx_flag_t ngx_http_headers_more_check_type(ngx_http_request_t *r, + ngx_array_t *types); +static ngx_flag_t ngx_http_headers_more_check_status(ngx_http_request_t *r, + ngx_array_t *statuses); +static ngx_int_t ngx_http_set_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_header_helper(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value, + ngx_table_elt_t **output_header, ngx_flag_t no_create); +static ngx_int_t ngx_http_set_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_accept_ranges_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_content_type_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_clear_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_clear_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); +static ngx_int_t ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value); + + +static ngx_http_headers_more_set_header_t ngx_http_headers_more_set_handlers[] + = { + + { ngx_string("Server"), + offsetof(ngx_http_headers_out_t, server), + ngx_http_set_builtin_header }, + + { ngx_string("Date"), + offsetof(ngx_http_headers_out_t, date), + ngx_http_set_builtin_header }, + + { ngx_string("Content-Encoding"), + offsetof(ngx_http_headers_out_t, content_encoding), + ngx_http_set_builtin_header }, + + { ngx_string("Location"), + offsetof(ngx_http_headers_out_t, location), + ngx_http_set_builtin_header }, + + { ngx_string("Refresh"), + offsetof(ngx_http_headers_out_t, refresh), + ngx_http_set_builtin_header }, + + { ngx_string("Last-Modified"), + offsetof(ngx_http_headers_out_t, last_modified), + ngx_http_set_builtin_header }, + + { ngx_string("Content-Range"), + offsetof(ngx_http_headers_out_t, content_range), + ngx_http_set_builtin_header }, + + { ngx_string("Accept-Ranges"), + offsetof(ngx_http_headers_out_t, accept_ranges), + ngx_http_set_accept_ranges_header }, + + { ngx_string("WWW-Authenticate"), + offsetof(ngx_http_headers_out_t, www_authenticate), + ngx_http_set_builtin_header }, + + { ngx_string("Expires"), + offsetof(ngx_http_headers_out_t, expires), + ngx_http_set_builtin_header }, + + { ngx_string("E-Tag"), + offsetof(ngx_http_headers_out_t, etag), + ngx_http_set_builtin_header }, + + { ngx_string("Content-Length"), + offsetof(ngx_http_headers_out_t, content_length), + ngx_http_set_content_length_header }, + + { ngx_string("Content-Type"), + 0, + ngx_http_set_content_type_header }, + + { ngx_string("Cache-Control"), + offsetof(ngx_http_headers_out_t, cache_control), + ngx_http_set_builtin_multi_header }, + + { ngx_null_string, 0, ngx_http_set_header } +}; + + +ngx_int_t +ngx_http_headers_more_exec_cmd(ngx_http_request_t *r, + ngx_http_headers_more_cmd_t *cmd) +{ + ngx_str_t value; + ngx_http_headers_more_header_val_t *h; + ngx_uint_t i; + + if (!cmd->headers) { + return NGX_OK; + } + + if (cmd->types && !ngx_http_headers_more_check_type(r, cmd->types)) { + return NGX_OK; + } + + if (cmd->statuses + && !ngx_http_headers_more_check_status(r, cmd->statuses)) + { + return NGX_OK; + } + + h = cmd->headers->elts; + for (i = 0; i < cmd->headers->nelts; i++) { + + if (ngx_http_complex_value(r, &h[i].value, &value) != NGX_OK) { + return NGX_ERROR; + } + + if (value.len) { + value.len--; /* remove the trailing '\0' added by + ngx_http_headers_more_parse_header */ + } + + if (h[i].handler(r, &h[i], &value) != NGX_OK) { + return NGX_ERROR; + } + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_set_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + return ngx_http_set_header_helper(r, hv, value, NULL, 0); +} + + +static ngx_int_t +ngx_http_set_header_helper(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value, + ngx_table_elt_t **output_header, ngx_flag_t no_create) +{ + ngx_table_elt_t *h; + ngx_list_part_t *part; + ngx_uint_t i; + ngx_flag_t matched = 0; + + dd_enter(); + +#if 1 + if (r->headers_out.location + && r->headers_out.location->value.len + && r->headers_out.location->value.data[0] == '/') + { + /* XXX ngx_http_core_find_config_phase, for example, + * may not initialize the "key" and "hash" fields + * for a nasty optimization purpose, and + * we have to work-around it here */ + + r->headers_out.location->hash = ngx_http_headers_more_location_hash; + ngx_str_set(&r->headers_out.location->key, "Location"); + } +#endif + + if (hv->append) { + goto append; + } + + part = &r->headers_out.headers.part; + h = part->elts; + + for (i = 0; /* void */; i++) { + + if (i >= part->nelts) { + if (part->next == NULL) { + break; + } + + part = part->next; + h = part->elts; + i = 0; + } + + if (h[i].hash == 0) { + continue; + } + + if (!hv->wildcard + && h[i].key.len == hv->key.len + && ngx_strncasecmp(h[i].key.data, hv->key.data, + h[i].key.len) == 0) + { + goto matched; + } + + if (hv->wildcard + && h[i].key.len >= hv->key.len - 1 + && ngx_strncasecmp(h[i].key.data, hv->key.data, + hv->key.len - 1) == 0) + { + goto matched; + } + + /* not matched */ + continue; + +matched: + + if (value->len == 0 || matched) { + dd("clearing normal header for %.*s", (int) hv->key.len, + hv->key.data); + + h[i].value.len = 0; + h[i].hash = 0; + + } else { + h[i].value = *value; + h[i].hash = hv->hash; + } + + if (output_header) { + *output_header = &h[i]; + } + + matched = 1; + } + + if (matched){ + return NGX_OK; + } + + if ((hv->wildcard || no_create) && value->len == 0) { + return NGX_OK; + } + + /* XXX we still need to create header slot even if the value + * is empty because some builtin headers like Last-Modified + * relies on this to get cleared */ + +append: + + h = ngx_list_push(&r->headers_out.headers); + if (h == NULL) { + return NGX_ERROR; + } + + if (value->len == 0) { + h->hash = 0; + + } else { + h->hash = hv->hash; + } + + h->key = hv->key; + h->value = *value; + + h->lowcase_key = ngx_pnalloc(r->pool, h->key.len); + if (h->lowcase_key == NULL) { + return NGX_ERROR; + } + + ngx_strlow(h->lowcase_key, h->key.data, h->key.len); + + if (output_header) { + *output_header = h; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_set_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + ngx_table_elt_t *h, **old; + + dd_enter(); + + if (hv->offset) { + old = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset); + + } else { + old = NULL; + } + + if (old == NULL || *old == NULL) { + return ngx_http_set_header_helper(r, hv, value, old, 0); + } + + h = *old; + + if (value->len == 0) { + dd("clearing the builtin header"); + + h->hash = 0; + h->value = *value; + + return NGX_OK; + } + + h->hash = hv->hash; + h->key = hv->key; + h->value = *value; + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_set_builtin_multi_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ +#if defined(nginx_version) && nginx_version >= 1023000 + ngx_table_elt_t **headers, *h, *ho, **ph; + + headers = (ngx_table_elt_t **) ((char *) &r->headers_out + hv->offset); + + if (*headers) { + for (h = (*headers)->next; h; h = h->next) { + h->hash = 0; + h->value.len = 0; + } + + h = *headers; + + h->value = *value; + + if (value->len == 0) { + h->hash = 0; + + } else { + h->hash = hv->hash; + } + + return NGX_OK; + } + + for (ph = headers; *ph; ph = &(*ph)->next) { /* void */ } + + ho = ngx_list_push(&r->headers_out.headers); + if (ho == NULL) { + return NGX_ERROR; + } + + ho->value = *value; + ho->hash = hv->hash; + ngx_str_set(&ho->key, "Cache-Control"); + ho->next = NULL; + *ph = ho; + + return NGX_OK; +#else + ngx_array_t *pa; + ngx_table_elt_t *ho, **ph; + ngx_uint_t i; + + pa = (ngx_array_t *) ((char *) &r->headers_out + hv->offset); + + if (pa->elts == NULL) { + if (ngx_array_init(pa, r->pool, 2, sizeof(ngx_table_elt_t *)) + != NGX_OK) + { + return NGX_ERROR; + } + } + + /* override old values (if any) */ + + if (pa->nelts > 0) { + ph = pa->elts; + for (i = 1; i < pa->nelts; i++) { + ph[i]->hash = 0; + ph[i]->value.len = 0; + } + + ph[0]->value = *value; + + if (value->len == 0) { + ph[0]->hash = 0; + + } else { + ph[0]->hash = hv->hash; + } + + return NGX_OK; + } + + ph = ngx_array_push(pa); + if (ph == NULL) { + return NGX_ERROR; + } + + ho = ngx_list_push(&r->headers_out.headers); + if (ho == NULL) { + return NGX_ERROR; + } + + ho->value = *value; + ho->hash = hv->hash; + ngx_str_set(&ho->key, "Cache-Control"); + *ph = ho; + + return NGX_OK; +#endif +} + + +static ngx_int_t +ngx_http_set_content_type_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + u_char *p, *last, *end; + + r->headers_out.content_type_len = value->len; + r->headers_out.content_type = *value; + r->headers_out.content_type_hash = hv->hash; + r->headers_out.content_type_lowcase = NULL; + + p = value->data; + end = p + value->len; + + for (; p != end; p++) { + + if (*p != ';') { + continue; + } + + last = p; + + while (*++p == ' ') { /* void */ } + + if (p == end) { + break; + } + + if (ngx_strncasecmp(p, (u_char *) "charset=", 8) != 0) { + continue; + } + + p += 8; + + r->headers_out.content_type_len = last - value->data; + + if (*p == '"') { + p++; + } + + last = end; + + if (*(last - 1) == '"') { + last--; + } + + r->headers_out.charset.len = last - p; + r->headers_out.charset.data = p; + + break; + } + + value->len = 0; + + return ngx_http_set_header_helper(r, hv, value, NULL, 1); +} + + +static ngx_int_t +ngx_http_set_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + off_t len; + + if (value->len == 0) { + return ngx_http_clear_content_length_header(r, hv, value); + } + + len = ngx_atosz(value->data, value->len); + if (len == NGX_ERROR) { + return NGX_ERROR; + } + + r->headers_out.content_length_n = len; + + return ngx_http_set_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_set_accept_ranges_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + if (value->len == 0) { + r->allow_ranges = 0; + } + + return ngx_http_set_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_clear_content_length_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + r->headers_out.content_length_n = -1; + + return ngx_http_clear_builtin_header(r, hv, value); +} + + +static ngx_int_t +ngx_http_clear_builtin_header(ngx_http_request_t *r, + ngx_http_headers_more_header_val_t *hv, ngx_str_t *value) +{ + dd_enter(); + + value->len = 0; + + return ngx_http_set_builtin_header(r, hv, value); +} + + +char * +ngx_http_headers_more_set_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf) +{ + return ngx_http_headers_more_parse_directive(cf, cmd, conf, + ngx_http_headers_more_opcode_set); +} + + +char * +ngx_http_headers_more_clear_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf) +{ + return ngx_http_headers_more_parse_directive(cf, cmd, conf, + ngx_http_headers_more_opcode_clear); +} + + +static ngx_flag_t +ngx_http_headers_more_check_type(ngx_http_request_t *r, ngx_array_t *types) +{ + ngx_uint_t i; + ngx_str_t *t; + + dd("headers_out->content_type: %.*s (len %d)", + (int) r->headers_out.content_type.len, + r->headers_out.content_type.data, + (int) r->headers_out.content_type.len); + + t = types->elts; + + for (i = 0; i < types->nelts; i++) { + dd("...comparing with type [%.*s]", (int) t[i].len, t[i].data); + + if (r->headers_out.content_type_len == t[i].len + && ngx_strncmp(r->headers_out.content_type.data, + t[i].data, t[i].len) == 0) + { + return 1; + } + } + + return 0; +} + + +static ngx_flag_t +ngx_http_headers_more_check_status(ngx_http_request_t *r, ngx_array_t *statuses) +{ + ngx_uint_t i; + ngx_uint_t *status; + + dd("headers_out.status = %d", (int) r->headers_out.status); + + status = statuses->elts; + for (i = 0; i < statuses->nelts; i++) { + dd("...comparing with specified status %d", (int) status[i]); + + if (r->headers_out.status == status[i]) { + return 1; + } + } + + return 0; +} + + +static char * +ngx_http_headers_more_parse_directive(ngx_conf_t *cf, ngx_command_t *ngx_cmd, + void *conf, ngx_http_headers_more_opcode_t opcode) +{ + ngx_http_headers_more_loc_conf_t *hlcf = conf; + + ngx_uint_t i, j; + ngx_http_headers_more_cmd_t *cmd; + ngx_str_t *arg; + ngx_flag_t ignore_next_arg; + ngx_str_t *cmd_name; + ngx_int_t rc; + ngx_flag_t append = 0; + ngx_flag_t is_builtin_header = 0; + ngx_http_headers_more_header_val_t *h; + ngx_http_headers_more_set_header_t *handlers; + + ngx_http_headers_more_main_conf_t *hmcf; + + if (hlcf->cmds == NULL) { + hlcf->cmds = ngx_array_create(cf->pool, 1, + sizeof(ngx_http_headers_more_cmd_t)); + + if (hlcf->cmds == NULL) { + return NGX_CONF_ERROR; + } + } + + cmd = ngx_array_push(hlcf->cmds); + if (cmd == NULL) { + return NGX_CONF_ERROR; + } + + cmd->headers = + ngx_array_create(cf->pool, 1, + sizeof(ngx_http_headers_more_header_val_t)); + if (cmd->headers == NULL) { + return NGX_CONF_ERROR; + } + + cmd->types = ngx_array_create(cf->pool, 1, sizeof(ngx_str_t)); + if (cmd->types == NULL) { + return NGX_CONF_ERROR; + } + + cmd->statuses = ngx_array_create(cf->pool, 1, sizeof(ngx_uint_t)); + if (cmd->statuses == NULL) { + return NGX_CONF_ERROR; + } + + arg = cf->args->elts; + + cmd_name = &arg[0]; + + ignore_next_arg = 0; + + for (i = 1; i < cf->args->nelts; i++) { + + if (ignore_next_arg) { + ignore_next_arg = 0; + continue; + } + + if (arg[i].len == 0) { + continue; + } + + if (arg[i].data[0] != '-') { + rc = ngx_http_headers_more_parse_header(cf, cmd_name, + &arg[i], cmd->headers, + opcode, + ngx_http_headers_more_set_handlers); + + if (rc != NGX_OK) { + return NGX_CONF_ERROR; + } + + continue; + } + + if (arg[i].len == 2) { + if (arg[i].data[1] == 't') { + if (i == cf->args->nelts - 1) { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: option -t takes an argument.", + cmd_name); + + return NGX_CONF_ERROR; + } + + rc = ngx_http_headers_more_parse_types(cf->log, cmd_name, + &arg[i + 1], + cmd->types); + + if (rc != NGX_OK) { + return NGX_CONF_ERROR; + } + + ignore_next_arg = 1; + + continue; + + } else if (arg[i].data[1] == 's') { + + if (i == cf->args->nelts - 1) { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: option -s takes an argument.", + cmd_name); + + return NGX_CONF_ERROR; + } + + rc = ngx_http_headers_more_parse_statuses(cf->log, cmd_name, + &arg[i + 1], + cmd->statuses); + + if (rc != NGX_OK) { + return NGX_CONF_ERROR; + } + + ignore_next_arg = 1; + + continue; + + } else if (arg[i].data[1] == 'a') { + + if (ngx_strncasecmp((u_char *) "more_set_headers", + cmd_name->data, cmd_name->len) != 0) + { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: invalid option name: \"%V\"", + cmd_name, &arg[i]); + + return NGX_CONF_ERROR; + } + + dd("Found append flag"); + append = 1; + continue; + } + } + + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: invalid option name: \"%V\"", cmd_name, &arg[i]); + + return NGX_CONF_ERROR; + } + + dd("Found %d statuses, %d types, and %d headers", + (int) cmd->statuses->nelts, (int) cmd->types->nelts, + (int) cmd->headers->nelts); + + if (cmd->headers->nelts == 0) { + cmd->headers = NULL; + + } else { + + h = cmd->headers->elts; + for (i = 0; i < cmd->headers->nelts; i++) { + h[i].append = 0; + + handlers = ngx_http_headers_more_set_handlers; + + for (j = 0; handlers[j].name.len; j++) { + if (h[i].key.len == handlers[j].name.len + && ngx_strncasecmp(h[i].key.data, handlers[j].name.data, + h[i].key.len) == 0) + { + is_builtin_header = 1; + break; + } + } + + if (is_builtin_header && append) { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: can not append builtin headers \"%V\"", + cmd_name, &h[i].key); + + return NGX_CONF_ERROR; + } + + if (!is_builtin_header) { + h[i].append = append; + } + } + } + + if (cmd->types->nelts == 0) { + cmd->types = NULL; + } + + if (cmd->statuses->nelts == 0) { + cmd->statuses = NULL; + } + + cmd->is_input = 0; + + hmcf = ngx_http_conf_get_module_main_conf(cf, + ngx_http_headers_more_filter_module); + + hmcf->requires_filter = 1; + + return NGX_CONF_OK; +} diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h new file mode 100644 index 0000000..c939507 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_headers_out.h @@ -0,0 +1,26 @@ + +/* + * Copyright (c) Yichun Zhang (agentzh) + */ + + +#ifndef NGX_HTTP_HEADERS_MORE_OUTPUT_HEADERS_H +#define NGX_HTTP_HEADERS_MORE_OUTPUT_HEADERS_H + + +#include "ngx_http_headers_more_filter_module.h" + + +/* output header setters and clearers */ + +ngx_int_t ngx_http_headers_more_exec_cmd(ngx_http_request_t *r, + ngx_http_headers_more_cmd_t *cmd); + +char *ngx_http_headers_more_set_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); + +char *ngx_http_headers_more_clear_headers(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); + + +#endif /* NGX_HTTP_HEADERS_MORE_OUTPUT_HEADERS_H */ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c new file mode 100644 index 0000000..e1f3636 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.c @@ -0,0 +1,382 @@ + +/* + * Copyright (C) Yichun Zhang (agentzh) + */ + + +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_headers_more_util.h" +#include + + +ngx_int_t +ngx_http_headers_more_parse_header(ngx_conf_t *cf, ngx_str_t *cmd_name, + ngx_str_t *raw_header, ngx_array_t *headers, + ngx_http_headers_more_opcode_t opcode, + ngx_http_headers_more_set_header_t *handlers) +{ + ngx_http_headers_more_header_val_t *hv; + + ngx_uint_t i; + ngx_str_t key = ngx_null_string; + ngx_str_t value = ngx_null_string; + ngx_flag_t seen_end_of_key; + ngx_http_compile_complex_value_t ccv; + u_char *p; + + hv = ngx_array_push(headers); + if (hv == NULL) { + return NGX_ERROR; + } + + seen_end_of_key = 0; + for (i = 0; i < raw_header->len; i++) { + if (key.len == 0) { + if (isspace(raw_header->data[i])) { + continue; + } + + key.data = raw_header->data; + key.len = 1; + + continue; + } + + if (!seen_end_of_key) { + if (raw_header->data[i] == ':' + || isspace(raw_header->data[i])) + { + seen_end_of_key = 1; + continue; + } + + key.len++; + + continue; + } + + if (value.len == 0) { + if (raw_header->data[i] == ':' + || isspace(raw_header->data[i])) + { + continue; + } + + value.data = &raw_header->data[i]; + value.len = 1; + + continue; + } + + value.len++; + } + + if (key.len == 0) { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: no key found in the header argument: %V", + cmd_name, raw_header); + + return NGX_ERROR; + } + + hv->wildcard = (key.data[key.len - 1] == '*'); + if (hv->wildcard && key.len<2){ + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "%V: wildcard key too short: %V", + cmd_name, raw_header); + return NGX_ERROR; + } + + hv->hash = ngx_hash_key_lc(key.data, key.len); + hv->key = key; + + hv->offset = 0; + + for (i = 0; handlers[i].name.len; i++) { + if (hv->key.len != handlers[i].name.len + || ngx_strncasecmp(hv->key.data, handlers[i].name.data, + handlers[i].name.len) != 0) + { + dd("hv key comparison: %s <> %s", handlers[i].name.data, + hv->key.data); + + continue; + } + + hv->offset = handlers[i].offset; + hv->handler = handlers[i].handler; + + break; + } + + if (handlers[i].name.len == 0 && handlers[i].handler) { + hv->offset = handlers[i].offset; + hv->handler = handlers[i].handler; + } + + if (opcode == ngx_http_headers_more_opcode_clear) { + value.len = 0; + } + + if (value.len == 0) { + ngx_memzero(&hv->value, sizeof(ngx_http_complex_value_t)); + return NGX_OK; + + } + + /* Nginx request header value requires to be a null-terminated + * C string */ + + p = ngx_palloc(cf->pool, value.len + 1); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(p, value.data, value.len); + p[value.len] = '\0'; + value.data = p; + value.len++; /* we should also compile the trailing '\0' */ + + /* compile the header value as a complex value */ + + ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = &value; + ccv.complex_value = &hv->value; + + if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { + return NGX_ERROR; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_headers_more_parse_statuses(ngx_log_t *log, ngx_str_t *cmd_name, + ngx_str_t *value, ngx_array_t *statuses) +{ + u_char *p, *last; + ngx_uint_t *s = NULL; + + p = value->data; + last = p + value->len; + + for (; p != last; p++) { + if (s == NULL) { + if (isspace(*p)) { + continue; + } + + s = ngx_array_push(statuses); + if (s == NULL) { + return NGX_ERROR; + } + + if (*p >= '0' && *p <= '9') { + *s = *p - '0'; + + } else { + ngx_log_error(NGX_LOG_ERR, log, 0, + "%V: invalid digit \"%c\" found in " + "the status code list \"%V\"", + cmd_name, *p, value); + + return NGX_ERROR; + } + + continue; + } + + if (isspace(*p)) { + dd("Parsed status %d", (int) *s); + + s = NULL; + continue; + } + + if (*p >= '0' && *p <= '9') { + *s *= 10; + *s += *p - '0'; + + } else { + ngx_log_error(NGX_LOG_ERR, log, 0, + "%V: invalid digit \"%c\" found in " + "the status code list \"%V\"", + cmd_name, *p, value); + + return NGX_ERROR; + } + } + + if (s) { + dd("Parsed status %d", (int) *s); + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_headers_more_parse_types(ngx_log_t *log, ngx_str_t *cmd_name, + ngx_str_t *value, ngx_array_t *types) +{ + u_char *p, *last; + ngx_str_t *t = NULL; + + p = value->data; + last = p + value->len; + + for (; p != last; p++) { + if (t == NULL) { + if (isspace(*p) || *p == ';') { + continue; + } + + t = ngx_array_push(types); + if (t == NULL) { + return NGX_ERROR; + } + + t->len = 1; + t->data = p; + + continue; + } + + if (isspace(*p) || *p == ';') { + t = NULL; + continue; + } + + t->len++; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_headers_more_rm_header_helper(ngx_list_t *l, ngx_list_part_t *cur, + ngx_uint_t i) +{ + ngx_table_elt_t *data; + ngx_list_part_t *new, *part; + + dd("list rm item: part %p, i %d, nalloc %d", cur, (int) i, + (int) l->nalloc); + + data = cur->elts; + + dd("cur: nelts %d, nalloc %d", (int) cur->nelts, + (int) l->nalloc); + + if (i == 0) { + cur->elts = (char *) cur->elts + l->size; + cur->nelts--; + + if (cur == l->last) { + if (cur->nelts == 0) { +#if 1 + part = &l->part; + + if (part == cur) { + cur->elts = (char *) cur->elts - l->size; + /* do nothing */ + + } else { + while (part->next != cur) { + if (part->next == NULL) { + return NGX_ERROR; + } + + part = part->next; + } + + l->last = part; + part->next = NULL; + dd("part nelts: %d", (int) part->nelts); + l->nalloc = part->nelts; + } +#endif + + } else { + l->nalloc--; + } + + return NGX_OK; + } + + if (cur->nelts == 0) { + part = &l->part; + + if (part == cur) { + ngx_http_headers_more_assert(cur->next != NULL); + + dd("remove 'cur' from the list by rewriting 'cur': " + "l->last: %p, cur: %p, cur->next: %p, part: %p", + l->last, cur, cur->next, part); + + if (l->last == cur->next) { + dd("last is cur->next"); + l->part = *(cur->next); + l->last = part; + l->nalloc = part->nelts; + + } else { + l->part = *(cur->next); + } + + } else { + dd("remove 'cur' from the list"); + while (part->next != cur) { + if (part->next == NULL) { + return NGX_ERROR; + } + + part = part->next; + } + + part->next = cur->next; + } + + return NGX_OK; + } + + return NGX_OK; + } + + if (i == cur->nelts - 1) { + cur->nelts--; + + if (cur == l->last) { + l->nalloc = cur->nelts; + } + + return NGX_OK; + } + + new = ngx_palloc(l->pool, sizeof(ngx_list_part_t)); + if (new == NULL) { + return NGX_ERROR; + } + + new->elts = &data[i + 1]; + new->nelts = cur->nelts - i - 1; + new->next = cur->next; + + cur->nelts = i; + cur->next = new; + if (cur == l->last) { + l->last = new; + l->nalloc = new->nelts; + } + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h new file mode 100644 index 0000000..6c4614b --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/src/ngx_http_headers_more_util.h @@ -0,0 +1,52 @@ + +/* + * Copyright (c) Yichun Zhang (agentzh) + */ + + +#ifndef NGX_HTTP_HEADERS_MORE_UTIL_H +#define NGX_HTTP_HEADERS_MORE_UTIL_H + + +#include "ngx_http_headers_more_filter_module.h" + + +#define ngx_http_headers_more_hash_literal(s) \ + ngx_http_headers_more_hash_str((u_char *) s, sizeof(s) - 1) + + +static ngx_inline ngx_uint_t +ngx_http_headers_more_hash_str(u_char *src, size_t n) +{ + ngx_uint_t key; + + key = 0; + + while (n--) { + key = ngx_hash(key, *src); + src++; + } + + return key; +} + + +extern ngx_uint_t ngx_http_headers_more_location_hash; + + +ngx_int_t ngx_http_headers_more_parse_header(ngx_conf_t *cf, + ngx_str_t *cmd_name, ngx_str_t *raw_header, ngx_array_t *headers, + ngx_http_headers_more_opcode_t opcode, + ngx_http_headers_more_set_header_t *handlers); + +ngx_int_t ngx_http_headers_more_parse_statuses(ngx_log_t *log, + ngx_str_t *cmd_name, ngx_str_t *value, ngx_array_t *statuses); + +ngx_int_t ngx_http_headers_more_parse_types(ngx_log_t *log, + ngx_str_t *cmd_name, ngx_str_t *value, ngx_array_t *types); + +ngx_int_t ngx_http_headers_more_rm_header_helper(ngx_list_t *l, + ngx_list_part_t *cur, ngx_uint_t i); + + +#endif /* NGX_HTTP_HEADERS_MORE_UTIL_H */ diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t new file mode 100644 index 0000000..2339401 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/bug.t @@ -0,0 +1,416 @@ +# vi:filetype= + +use Test::Nginx::Socket; # 'no_plan'; + +repeat_each(2); + +plan tests => 56 * repeat_each(); + +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: set Server +--- config + #more_set_headers 'Last-Modified: x'; + more_clear_headers 'Last-Modified'; +--- request + GET /index.html +--- response_headers +! Last-Modified +--- response_body_like: It works! + + + +=== TEST 2: variables in the Ranges header +--- config + location /index.html { + set $rfrom 1; + set $rto 3; + more_set_input_headers 'Range: bytes=$rfrom - $rto'; + #more_set_input_headers 'Range: bytes=1 - 3'; + #echo $http_range; + } +--- request +GET /index.html +--- error_code: 206 +--- response_body chomp +htm + + + +=== TEST 3: mime type overriding (inlined types) +--- config + more_clear_headers 'X-Powered-By' 'X-Runtime' 'ETag'; + + types { + text/html html htm shtml; + text/css css; + } +--- user_files +>>> a.css +hello +--- request +GET /a.css +--- error_code: 200 +--- response_headers +Content-Type: text/css +--- response_body +hello + + + +=== TEST 4: mime type overriding (included types file) +--- config + more_clear_headers 'X-Powered-By' 'X-Runtime' 'ETag'; + include mime.types; +--- user_files +>>> a.css +hello +>>> ../conf/mime.types +types { + text/html html htm shtml; + text/css css; +} +--- request +GET /a.css +--- error_code: 200 +--- response_headers +Content-Type: text/css +--- response_body +hello + + + +=== TEST 5: empty variable as the header value +--- config + location /foo { + more_set_headers 'X-Foo: $arg_foo'; + echo hi; + } +--- request + GET /foo +--- response_headers +! X-Foo +--- response_body +hi + + + +=== TEST 6: range bug +--- config + location /index.html { + more_clear_input_headers "Range*" ; + more_clear_input_headers "Content-Range*" ; + + more_set_input_headers 'Range: bytes=1-5'; + more_set_headers 'Content-Range: bytes 1-5/1000'; + } +--- request + GET /index.html +--- more_headers +Range: bytes=1-3 +--- raw_response_headers_like: Content-Range: bytes 1-5/1000$ +--- response_body chop +html> +--- error_code: 206 +--- SKIP + + + +=== TEST 7: Allow-Ranges +--- config + location /index.html { + more_clear_headers 'Accept-Ranges'; + } +--- request + GET /index.html +--- response_headers +! Accept-Ranges +--- response_body_like: It works + + + +=== TEST 8: clear hand-written Allow-Ranges headers +--- config + location /index.html { + more_set_headers 'Accept-Ranges: bytes'; + more_clear_headers 'Accept-Ranges'; + } +--- request + GET /index.html +--- response_headers +! Accept-Ranges +--- response_body_like: It works + + + +=== TEST 9: clear first, then add +--- config + location /bug { + more_clear_headers 'Foo'; + more_set_headers 'Foo: a'; + echo hello; + } +--- request + GET /bug +--- raw_response_headers_like eval +".*Foo: a.*" +--- response_body +hello + + + +=== TEST 10: first add, then clear, then add again +--- config + location /bug { + more_set_headers 'Foo: a'; + more_clear_headers 'Foo'; + more_set_headers 'Foo: b'; + echo hello; + } +--- request + GET /bug +--- raw_response_headers_like eval +".*Foo: b.*" +--- response_body +hello + + + +=== TEST 11: override charset +--- config + location /foo { + charset iso-8859-1; + default_type "text/html"; + echo hiya; + } + + location /bug { + more_set_headers "Content-Type: text/html; charset=UTF-8"; + proxy_pass http://127.0.0.1:$server_port/foo; + } +--- request + GET /bug +--- response_body +hiya +--- response_headers +Content-Type: text/html; charset=UTF-8 + + + +=== TEST 12: set multi-value header to a single value +--- config + location /main { + set $footer ''; + proxy_pass http://127.0.0.1:$server_port/foo; + more_set_headers 'Foo: b'; + header_filter_by_lua ' + ngx.var.footer = ngx.header.Foo + '; + echo_after_body $footer; + } + location /foo { + echo foo; + add_header Foo a; + add_header Foo c; + } +--- request + GET /main +--- response_headers +Foo: b +--- response_body +foo +b + + + +=== TEST 13: set multi values to cache-control and override it with multiple values (to reproduce a bug) +--- config + location /lua { + content_by_lua ' + ngx.header.cache_control = { "private", "no-store", "foo", "bar", "baz" } + ngx.send_headers() + ngx.say("Cache-Control: ", ngx.var.sent_http_cache_control) + '; + more_clear_headers Cache-Control; + add_header Cache-Control "blah"; + } +--- request + GET /lua +--- response_headers +Cache-Control: blah +--- response_body +Cache-Control: blah + + + +=== TEST 14: set 20+ headers +--- config + location /test { + more_clear_input_headers "Authorization"; + echo $http_a1; + echo $http_authorization; + echo $http_a2; + echo $http_a3; + echo $http_a23; + echo $http_a24; + echo $http_a25; + } +--- request + GET /test +--- more_headers eval +my $i = 1; +my $s; +while ($i <= 25) { + $s .= "A$i: $i\n"; + if ($i == 22) { + $s .= "Authorization: blah\n"; + } + $i++; +} +#warn $s; +$s +--- response_body +1 + +2 +3 +23 +24 +25 + + + +=== TEST 15: github #20: segfault caused by the nasty optimization in the nginx core (set) +--- config + location = /t/ { + more_set_headers "Foo: 1"; + proxy_pass http://127.0.0.1:$server_port; + } +--- request +GET /t +--- more_headers +Foo: bar +Bah: baz +--- response_body_like: 301 Moved Permanently +--- error_code: 301 +--- no_error_log +[error] + + + +=== TEST 16: github #20: segfault caused by the nasty optimization in the nginx core (clear) +--- config + location = /t/ { + more_clear_headers Foo; + proxy_pass http://127.0.0.1:$server_port; + } +--- request +GET /t +--- more_headers +Foo: bar +Bah: baz +--- response_body_like: 301 Moved Permanently +--- error_code: 301 +--- no_error_log +[error] + + + +=== TEST 17: Content-Type response headers with a charset param (correct -t values) +--- config + location = /t { + more_set_headers -t 'text/html' 'X-Foo: Bar'; + proxy_pass http://127.0.0.1:$server_port/fake; + } + + location = /fake { + default_type text/html; + charset utf-8; + echo ok; + } +--- request +GET /t +--- response_headers +X-Foo: Bar +--- response_body +ok + + + +=== TEST 18: Content-Type response headers with a charset param (WRONG -t values) +--- config + location = /t { + more_set_headers -t 'text/html; charset=utf-8' 'X-Foo: Bar'; + proxy_pass http://127.0.0.1:$server_port/fake; + } + + location = /fake { + default_type text/html; + charset utf-8; + echo ok; + } +--- request +GET /t +--- response_headers +X-Foo: Bar +--- response_body +ok + + + +=== TEST 19: for bad requests (bad request method letter case) +--- config + error_page 400 = /err; + + location = /err { + more_set_input_headers "Foo: bar"; + echo ok; + } +--- raw_request +GeT / HTTP/1.1 +--- response_body +ok +--- no_check_leak + + + +=== TEST 20: for bad requests (bad request method names) +--- config + error_page 400 = /err; + + location = /err { + more_set_input_headers "Foo: bar"; + echo ok; + } +--- raw_request +GET x HTTP/1.1 +--- response_body +ok +--- no_check_leak + + + +=== TEST 21: override Cache-Control header sent by proxy module +--- config + location = /back { + content_by_lua_block { + ngx.header['Cache-Control'] = 'max-age=0, no-cache' + ngx.send_headers() + ngx.say("Cache-Control: ", ngx.var.sent_http_cache_control) + } + } + + location = /t { + more_set_headers "Cache-Control: max-age=1800"; + proxy_pass http://127.0.0.1:$server_port/back; + } +--- request + GET /t +--- response_headers +Cache-Control: max-age=1800 +--- response_body +Cache-Control: max-age=0, no-cache diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t new file mode 100644 index 0000000..27b20af --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/builtin.t @@ -0,0 +1,338 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; # 'no_plan'; + +plan tests => 60; + +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: set Server +--- config + location /foo { + echo hi; + more_set_headers 'Server: Foo'; + } +--- request + GET /foo +--- response_headers +Server: Foo +--- response_body +hi + + + +=== TEST 2: clear Server +--- config + location /foo { + echo hi; + more_clear_headers 'Server: '; + } +--- request + GET /foo +--- response_headers +! Server +--- response_body +hi + + + +=== TEST 3: set Content-Type +--- config + location /foo { + default_type 'text/plan'; + more_set_headers 'Content-Type: text/css'; + echo hi; + } +--- request + GET /foo +--- response_headers +Content-Type: text/css +--- response_body +hi + + + +=== TEST 4: set Content-Type +--- config + location /foo { + default_type 'text/plan'; + more_set_headers 'Content-Type: text/css'; + return 404; + } +--- request + GET /foo +--- response_headers +Content-Type: text/css +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 5: clear Content-Type +--- config + location /foo { + default_type 'text/plain'; + more_clear_headers 'Content-Type: '; + return 404; + } +--- request + GET /foo +--- response_headers +! Content-Type +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 6: clear Content-Type (colon not required) +--- config + location /foo { + default_type 'text/plain'; + more_set_headers 'Content-Type: Hello'; + more_clear_headers 'Content-Type'; + return 404; + } +--- request + GET /foo +--- response_headers +! Content-Type +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 7: clear Content-Type (value ignored) +--- config + location /foo { + default_type 'text/plain'; + more_set_headers 'Content-Type: Hello'; + more_clear_headers 'Content-Type: blah'; + return 404; + } +--- request + GET /foo +--- response_headers +! Content-Type +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 8: clear Content-Type (case insensitive) +--- config + location /foo { + default_type 'text/plain'; + more_set_headers 'Content-Type: Hello'; + more_clear_headers 'content-type: blah'; + return 404; + } +--- request + GET /foo +--- response_headers +! Content-Type +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 9: clear Content-Type using set empty +--- config + location /foo { + default_type 'text/plain'; + more_set_headers 'Content-Type: Hello'; + more_set_headers 'content-type:'; + return 404; + } +--- request + GET /foo +--- response_headers +! Content-Type +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 10: clear Content-Type using setting key only +--- config + location /foo { + default_type 'text/plain'; + more_set_headers 'Content-Type: Hello'; + more_set_headers 'content-type'; + return 404; + } +--- request + GET /foo +--- response_headers +! Content-Type +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 11: set content-length +--- config + location /len { + more_set_headers 'Content-Length: 2'; + echo hello; + } +--- request + GET /len +--- response_headers +Content-Length: 2 +--- response_body chop +he + + + +=== TEST 12: set content-length multiple times +--- config + location /len { + more_set_headers 'Content-Length: 2'; + more_set_headers 'Content-Length: 4'; + echo hello; + } +--- request + GET /len +--- response_headers +Content-Length: 4 +--- response_body chop +hell + + + +=== TEST 13: clear content-length +--- config + location /len { + more_set_headers 'Content-Length: 4'; + more_set_headers 'Content-Length:'; + echo hello; + } +--- request + GET /len +--- response_headers +! Content-Length +--- response_body +hello + + + +=== TEST 14: clear content-length (another way) +--- config + location /len { + more_set_headers 'Content-Length: 4'; + more_clear_headers 'Content-Length'; + echo hello; + } +--- request + GET /len +--- response_headers +! Content-Length +--- response_body +hello + + + +=== TEST 15: clear content-type +--- config + location /len { + default_type 'text/plain'; + more_set_headers 'Content-Type:'; + echo hello; + } +--- request + GET /len +--- response_headers +! Content-Type +--- response_body +hello + + + +=== TEST 16: clear content-type (the other way) +--- config + location /len { + default_type 'text/plain'; + more_clear_headers 'Content-Type:'; + echo hello; + } +--- request + GET /len +--- response_headers +! Content-Type +--- response_body +hello + + + +=== TEST 17: set Charset +--- config + location /len { + default_type 'text/plain'; + more_set_headers 'Charset: gbk'; + echo hello; + } +--- request + GET /len +--- response_headers +Charset: gbk +--- response_body +hello + + + +=== TEST 18: clear Charset +--- config + location /len { + default_type 'text/plain'; + more_set_headers 'Charset: gbk'; + more_clear_headers 'Charset'; + echo hello; + } +--- request + GET /len +--- response_headers +! Charset +--- response_body +hello + + + +=== TEST 19: clear Charset (the other way: using set) +--- config + location /len { + default_type 'text/plain'; + more_set_headers 'Charset: gbk'; + more_set_headers 'Charset: '; + echo hello; + } +--- request + GET /len +--- response_headers +! Charset +--- response_body +hello + + + +=== TEST 20: set Vary +--- config + location /foo { + more_set_headers 'Vary: gbk'; + echo hello; + } + location /len { + default_type 'text/plain'; + more_set_headers 'Vary: hello'; + proxy_pass http://127.0.0.1:$server_port/foo; + } +--- request + GET /len +--- response_headers +Vary: hello +--- response_body +hello diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t new file mode 100644 index 0000000..febd306 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/eval.t @@ -0,0 +1,36 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; # 'no_plan'; + +repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +#no_long_string(); +#no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: set request header at client side +--- config + location /foo { + eval_subrequest_in_memory off; + eval_override_content_type text/plain; + eval $res { + echo -n 1; + } + #echo "[$res]"; + if ($res = '1') { + more_set_input_headers 'Foo: Bar'; + echo "OK"; + break; + } + echo "NOT OK"; + } +--- request + GET /foo +--- response_body +OK diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t new file mode 100644 index 0000000..f53e80f --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-conn.t @@ -0,0 +1,137 @@ +# vim:set ft= ts=4 sw=4 et fdm=marker: + +use lib 'lib'; +use Test::Nginx::Socket; + +#worker_connections(1014); +#master_process_enabled(1); +#log_level('warn'); + +repeat_each(2); + +plan tests => repeat_each() * (4 * blocks()); + +#no_diff(); +no_long_string(); + +run_tests(); + +__DATA__ + +=== TEST 1: clear the Connection req header +--- config + location /req-header { + more_clear_input_headers Connection; + echo "connection: $http_connection"; + } +--- request +GET /req-header + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: conn type: %d\n", $r->headers_in->connection_type) +} + + +F(ngx_http_core_content_phase) { + printf("content: conn type: %d\n", $r->headers_in->connection_type) +} + +--- stap_out +rewrite: conn type: 1 +content: conn type: 0 + +--- response_body +connection: +--- no_error_log +[error] + + + +=== TEST 2: set custom Connection req header (close) +--- config + location /req-header { + more_set_input_headers "Connection: CLOSE"; + echo "connection: $http_connection"; + } +--- request +GET /req-header + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: conn type: %d\n", $r->headers_in->connection_type) +} + + +F(ngx_http_core_content_phase) { + printf("content: conn type: %d\n", $r->headers_in->connection_type) +} + +--- stap_out +rewrite: conn type: 1 +content: conn type: 1 + +--- response_body +connection: CLOSE +--- no_error_log +[error] + + + +=== TEST 3: set custom Connection req header (keep-alive) +--- config + location /req-header { + more_set_input_headers "Connection: keep-alive"; + echo "connection: $http_connection"; + } +--- request +GET /req-header + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: conn type: %d\n", $r->headers_in->connection_type) +} + + +F(ngx_http_core_content_phase) { + printf("content: conn type: %d\n", $r->headers_in->connection_type) +} + +--- stap_out +rewrite: conn type: 1 +content: conn type: 2 + +--- response_body +connection: keep-alive +--- no_error_log +[error] + + + +=== TEST 4: set custom Connection req header (bad) +--- config + location /req-header { + more_set_input_headers "Connection: bad"; + echo "connection: $http_connection"; + } +--- request +GET /req-header + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: conn type: %d\n", $r->headers_in->connection_type) +} + + +F(ngx_http_core_content_phase) { + printf("content: conn type: %d\n", $r->headers_in->connection_type) +} + +--- stap_out +rewrite: conn type: 1 +content: conn type: 0 + +--- response_body +connection: bad +--- no_error_log +[error] diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t new file mode 100644 index 0000000..3e5257b --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-cookie.t @@ -0,0 +1,183 @@ +# vim:set ft= ts=4 sw=4 et fdm=marker: + +use lib 'lib'; +use Test::Nginx::Socket; + +#worker_connections(1014); +#master_process_enabled(1); +#log_level('warn'); + +repeat_each(2); + +plan tests => repeat_each() * (4 * blocks()); + +#no_diff(); +no_long_string(); + +run_tests(); + +__DATA__ + +=== TEST 1: clear cookie (with existing cookies) +--- config + location /t { + more_clear_input_headers Cookie; + echo "Cookie foo: $cookie_foo"; + echo "Cookie baz: $cookie_baz"; + echo "Cookie: $http_cookie"; + } +--- request +GET /t +--- more_headers +Cookie: foo=bar +Cookie: baz=blah + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +F(ngx_http_core_content_phase) { + printf("content: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +--- stap_out +rewrite: cookies: 2 +content: cookies: 0 + +--- response_body +Cookie foo: +Cookie baz: +Cookie: + +--- no_error_log +[error] + + + +=== TEST 2: clear cookie (without existing cookies) +--- config + location /t { + more_clear_input_headers Cookie; + echo "Cookie foo: $cookie_foo"; + echo "Cookie baz: $cookie_baz"; + echo "Cookie: $http_cookie"; + } +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +F(ngx_http_core_content_phase) { + printf("content: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +--- stap_out +rewrite: cookies: 0 +content: cookies: 0 + +--- response_body +Cookie foo: +Cookie baz: +Cookie: + +--- no_error_log +[error] + + + +=== TEST 3: set one custom cookie (with existing cookies) +--- config + location /t { + more_set_input_headers "Cookie: boo=123"; + echo "Cookie foo: $cookie_foo"; + echo "Cookie baz: $cookie_baz"; + echo "Cookie boo: $cookie_boo"; + echo "Cookie: $http_cookie"; + } +--- request +GET /t +--- more_headers +Cookie: foo=bar +Cookie: baz=blah + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +F(ngx_http_core_content_phase) { + printf("content: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +--- stap_out +rewrite: cookies: 2 +content: cookies: 1 + +--- response_body +Cookie foo: +Cookie baz: +Cookie boo: 123 +Cookie: boo=123 + +--- no_error_log +[error] + + + +=== TEST 4: set one custom cookie (without existing cookies) +--- config + location /t { + more_set_input_headers "Cookie: boo=123"; + echo "Cookie foo: $cookie_foo"; + echo "Cookie baz: $cookie_baz"; + echo "Cookie boo: $cookie_boo"; + echo "Cookie: $http_cookie"; + } +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +F(ngx_http_core_content_phase) { + printf("content: cookies: %d\n", $r->headers_in->cookies->nelts) +} + +--- stap_out +rewrite: cookies: 0 +content: cookies: 1 + +--- response_body +Cookie foo: +Cookie baz: +Cookie boo: 123 +Cookie: boo=123 + +--- no_error_log +[error] + + + +=== TEST 5: for bad requests causing segfaults when setting & getting multi-value headers +--- config + error_page 400 = /err; + + location = /err { + more_set_input_headers "Cookie: foo=bar"; + echo -n $cookie_foo; + echo ok; + } +--- raw_request +GeT / HTTP/1.1 +--- response_body +ok +--- no_error_log +[warn] +[error] +--- no_check_leak diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t new file mode 100644 index 0000000..da9a60d --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input-ua.t @@ -0,0 +1,628 @@ +# vim:set ft= ts=4 sw=4 et fdm=marker: + +use lib 'lib'; +use Test::Nginx::Socket; + +#worker_connections(1014); +#master_process_enabled(1); +#log_level('warn'); + +repeat_each(2); + +plan tests => repeat_each() * (4 * blocks()); + +#no_diff(); +no_long_string(); + +run_tests(); + +__DATA__ + +=== TEST 1: clear Opera user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Opera/9.80 (Macintosh; Intel Mac OS X 10.7.4; U; en) Presto/2.10.229 Version/11.62 + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: opera: %d\n", $r->headers_in->opera) +} + +F(ngx_http_core_content_phase) { + printf("content: opera: %d\n", $r->headers_in->opera) +} + +--- stap_out +rewrite: opera: 1 +content: opera: 0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 2: clear MSIE 4 user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT 5.0) + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=1 msie6=1 +content: msie=0 msie6=0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 3: set custom MSIE 4 user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT 5.0)"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=0 msie6=0 +content: msie=1 msie6=1 + +--- response_body +User-Agent: Mozilla/4.0 (compatible; MSIE 4.01; Windows NT 5.0) +--- no_error_log +[error] + + + +=== TEST 4: clear MSIE 5 user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows 95; MSIECrawler) + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=1 msie6=1 +content: msie=0 msie6=0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 5: set custom MSIE 5 user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows 95; MSIECrawler)"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=0 msie6=0 +content: msie=1 msie6=1 + +--- response_body +User-Agent: Mozilla/4.0 (compatible; MSIE 5.01; Windows 95; MSIECrawler) +--- no_error_log +[error] + + + +=== TEST 6: clear MSIE 6 (without SV1) user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Google Wireless Transcoder;) + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=1 msie6=1 +content: msie=0 msie6=0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 7: set custom MSIE 6 (without SV1) user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Google Wireless Transcoder;)"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=0 msie6=0 +content: msie=1 msie6=1 + +--- response_body +User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; Google Wireless Transcoder;) +--- no_error_log +[error] + + + +=== TEST 8: clear MSIE 6 (with SV1) user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1) + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=1 msie6=0 +content: msie=0 msie6=0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 9: set custom MSIE 6 (with SV1) user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1)"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=0 msie6=0 +content: msie=1 msie6=0 + +--- response_body +User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; InfoPath.1) +--- no_error_log +[error] + + + +=== TEST 10: set custom MSIE 7 user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; winfx; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Zune 2.0)"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +F(ngx_http_core_content_phase) { + printf("content: msie=%d msie6=%d\n", + $r->headers_in->msie, + $r->headers_in->msie6) +} + +--- stap_out +rewrite: msie=0 msie6=0 +content: msie=1 msie6=0 + +--- response_body +User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; winfx; .NET CLR 1.1.4322; .NET CLR 2.0.50727; Zune 2.0) +--- no_error_log +[error] + + + +=== TEST 11: clear Gecko user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0 + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: gecko: %d\n", $r->headers_in->gecko) +} + + +F(ngx_http_core_content_phase) { + printf("content: gecko: %d\n", $r->headers_in->gecko) +} + +--- stap_out +rewrite: gecko: 1 +content: gecko: 0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 12: set custom Gecko user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: gecko: %d\n", $r->headers_in->gecko) +} + + +F(ngx_http_core_content_phase) { + printf("content: gecko: %d\n", $r->headers_in->gecko) +} + +--- stap_out +rewrite: gecko: 0 +content: gecko: 1 + +--- response_body +User-Agent: Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0 +--- no_error_log +[error] + + + +=== TEST 13: clear Chrome user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19 + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: chrome: %d\n", $r->headers_in->chrome) +} + + +F(ngx_http_core_content_phase) { + printf("content: chrome: %d\n", $r->headers_in->chrome) +} + +--- stap_out +rewrite: chrome: 1 +content: chrome: 0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 14: set custom Chrome user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: chrome: %d\n", $r->headers_in->chrome) +} + + +F(ngx_http_core_content_phase) { + printf("content: chrome: %d\n", $r->headers_in->chrome) +} + +--- stap_out +rewrite: chrome: 0 +content: chrome: 1 + +--- response_body +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.151 Safari/535.19 +--- no_error_log +[error] + + + +=== TEST 15: clear Safari (Mac OS X) user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8 + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: safari: %d\n", $r->headers_in->safari) +} + + +F(ngx_http_core_content_phase) { + printf("content: safari: %d\n", $r->headers_in->safari) +} + +--- stap_out +rewrite: safari: 1 +content: safari: 0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 16: set custom Safari user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: safari: %d\n", $r->headers_in->safari) +} + + +F(ngx_http_core_content_phase) { + printf("content: safari: %d\n", $r->headers_in->safari) +} + +--- stap_out +rewrite: safari: 0 +content: safari: 1 + +--- response_body +User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/125.2 (KHTML, like Gecko) Safari/125.8 +--- no_error_log +[error] + + + +=== TEST 17: clear Konqueror user-agent +--- config + location /t { + more_clear_input_headers User-Agent; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- more_headers +User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) (Kubuntu) + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: konqueror: %d\n", $r->headers_in->konqueror) +} + + +F(ngx_http_core_content_phase) { + printf("content: konqueror: %d\n", $r->headers_in->konqueror) +} + +--- stap_out +rewrite: konqueror: 1 +content: konqueror: 0 + +--- response_body +User-Agent: +--- no_error_log +[error] + + + +=== TEST 18: set custom Konqueror user-agent +--- config + location /t { + more_set_input_headers "User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) (Kubuntu)"; + echo "User-Agent: $http_user_agent"; + } + +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + printf("rewrite: konqueror: %d\n", $r->headers_in->konqueror) +} + + +F(ngx_http_core_content_phase) { + printf("content: konqueror: %d\n", $r->headers_in->konqueror) +} + +--- stap_out +rewrite: konqueror: 0 +content: konqueror: 1 + +--- response_body +User-Agent: Mozilla/5.0 (compatible; Konqueror/3.5; Linux) KHTML/3.5.10 (like Gecko) (Kubuntu) +--- no_error_log +[error] diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t new file mode 100644 index 0000000..01ae73f --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/input.t @@ -0,0 +1,1331 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; # 'no_plan'; + +repeat_each(2); + +plan tests => repeat_each() * 128; + +no_long_string(); +#no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: set request header at client side +--- config + location /foo { + #more_set_input_headers 'X-Foo: howdy'; + echo $http_x_foo; + } +--- request + GET /foo +--- more_headers +X-Foo: blah +--- response_headers +! X-Foo +--- response_body +blah + + + +=== TEST 2: set request header at client side and rewrite it +--- config + location /foo { + more_set_input_headers 'X-Foo: howdy'; + echo $http_x_foo; + } +--- request + GET /foo +--- more_headers +X-Foo: blah +--- response_headers +! X-Foo +--- response_body +howdy + + + +=== TEST 3: rewrite content length +--- config + location /bar { + more_set_input_headers 'Content-Length: 2048'; + echo_read_request_body; + echo_request_body; + } +--- request eval +"POST /bar\n" . +"a" x 4096 +--- response_body eval +"a" x 2048 +--- timeout: 15 + + + +=== TEST 4: try to rewrite content length using the rewrite module +Thisshould not take effect ;) +--- config + location /bar { + set $http_content_length 2048; + echo_read_request_body; + echo_request_body; + } +--- request eval +"POST /bar\n" . +"a" x 4096 +--- response_body eval +"a" x 4096 + + + +=== TEST 5: rewrite host and user-agent +--- config + location /bar { + more_set_input_headers 'Host: foo' 'User-Agent: blah'; + echo "Host: $host"; + echo "User-Agent: $http_user_agent"; + } +--- request +GET /bar +--- response_body +Host: foo +User-Agent: blah + + + +=== TEST 6: clear host and user-agent +$host always has a default value and cannot be really cleared. +--- config + location /bar { + more_clear_input_headers 'Host: foo' 'User-Agent: blah'; + echo "Host: $host"; + echo "Host (2): $http_host"; + echo "User-Agent: $http_user_agent"; + } +--- request +GET /bar +--- response_body +Host: localhost +Host (2): +User-Agent: + + + +=== TEST 7: clear host and user-agent (the other way) +--- config + location /bar { + more_set_input_headers 'Host:' 'User-Agent:' 'X-Foo:'; + echo "Host: $host"; + echo "User-Agent: $http_user_agent"; + echo "X-Foo: $http_x_foo"; + } +--- request +GET /bar +--- more_headers +X-Foo: bar +--- response_body +Host: localhost +User-Agent: +X-Foo: + + + +=== TEST 8: clear content-length +--- config + location /bar { + more_set_input_headers 'Content-Length: '; + echo "Content-Length: $http_content_length"; + } +--- request +POST /bar +hello +--- more_headers +--- response_body +Content-Length: + + + +=== TEST 9: clear content-length (the other way) +--- config + location /bar { + more_clear_input_headers 'Content-Length: '; + echo "Content-Length: $http_content_length"; + } +--- request +POST /bar +hello +--- more_headers +--- response_body +Content-Length: + + + +=== TEST 10: rewrite type +--- config + location /bar { + more_set_input_headers 'Content-Type: text/css'; + echo "Content-Type: $content_type"; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/plain +--- response_body +Content-Type: text/css + + + +=== TEST 11: clear type +--- config + location /bar { + more_set_input_headers 'Content-Type:'; + echo "Content-Type: $content_type"; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/plain +--- response_body +Content-Type: + + + +=== TEST 12: clear type (the other way) +--- config + location /bar { + more_clear_input_headers 'Content-Type:foo'; + echo "Content-Type: $content_type"; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/plain +--- response_body +Content-Type: + + + +=== TEST 13: add type constraints +--- config + location /bar { + more_set_input_headers -t 'text/plain' 'X-Blah:yay'; + echo $http_x_blah; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/plain +--- response_body +yay + + + +=== TEST 14: add type constraints (not matched) +--- config + location /bar { + more_set_input_headers -t 'text/plain' 'X-Blah:yay'; + echo $http_x_blah; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/css +--- response_body eval: "\n" + + + +=== TEST 15: add type constraints (OR'd) +--- config + location /bar { + more_set_input_headers -t 'text/plain text/css' 'X-Blah:yay'; + echo $http_x_blah; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/css +--- response_body +yay + + + +=== TEST 16: add type constraints (OR'd) +--- config + location /bar { + more_set_input_headers -t 'text/plain text/css' 'X-Blah:yay'; + echo $http_x_blah; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/plain +--- response_body +yay + + + +=== TEST 17: add type constraints (OR'd) (not matched) +--- config + location /bar { + more_set_input_headers -t 'text/plain text/css' 'X-Blah:yay'; + echo $http_x_blah; + } +--- request +POST /bar +hello +--- more_headers +Content-Type: text/html +--- response_body eval: "\n" + + + +=== TEST 18: mix input and output cmds +--- config + location /bar { + more_set_input_headers 'X-Blah:yay'; + more_set_headers 'X-Blah:hiya'; + echo $http_x_blah; + } +--- request +GET /bar +--- response_headers +X-Blah: hiya +--- response +yay + + + +=== TEST 19: set request header at client side and replace +--- config + location /foo { + more_set_input_headers -r 'X-Foo: howdy'; + echo $http_x_foo; + } +--- request + GET /foo +--- more_headers +X-Foo: blah +--- response_headers +! X-Foo +--- response_body +howdy + + + +=== TEST 20: do no set request header at client, so no replace with -r option +--- config + location /foo { + more_set_input_headers -r 'X-Foo: howdy'; + echo "empty_header:" $http_x_foo; + } +--- request + GET /foo +--- response_headers +! X-Foo +--- response_body +empty_header: + + + +=== TEST 21: clear input headers +--- config + location /foo { + set $val 'dog'; + + more_clear_input_headers 'User-Agent'; + + proxy_pass http://127.0.0.1:$server_port/proxy; + } + location /proxy { + echo -n $echo_client_request_headers; + } +--- request + GET /foo +--- more_headers +User-Agent: my-sock +--- response_body eval +"GET /proxy HTTP/1.0\r +Host: 127.0.0.1:\$ServerPort\r +Connection: close\r +\r +" +--- skip_nginx: 3: < 0.7.46 + + + +=== TEST 22: clear input headers +--- config + location /foo { + more_clear_input_headers 'User-Agent'; + + proxy_pass http://127.0.0.1:$server_port/proxy; + } + location /proxy { + echo -n $echo_client_request_headers; + } +--- request + GET /foo +--- response_body eval +"GET /proxy HTTP/1.0\r +Host: 127.0.0.1:\$ServerPort\r +Connection: close\r +\r +" +--- skip_nginx: 3: < 0.7.46 + + + +=== TEST 23: clear input headers +--- config + location /foo { + more_clear_input_headers 'X-Foo19'; + more_clear_input_headers 'X-Foo20'; + more_clear_input_headers 'X-Foo21'; + + proxy_pass http://127.0.0.1:$server_port/proxy; + } + location /proxy { + echo -n $echo_client_request_headers; + } +--- request + GET /foo +--- more_headers eval +my $s; +for my $i (3..21) { + $s .= "X-Foo$i: $i\n"; +} +$s; +--- response_body eval +"GET /proxy HTTP/1.0\r +Host: 127.0.0.1:\$ServerPort\r +Connection: close\r +X-Foo3: 3\r +X-Foo4: 4\r +X-Foo5: 5\r +X-Foo6: 6\r +X-Foo7: 7\r +X-Foo8: 8\r +X-Foo9: 9\r +X-Foo10: 10\r +X-Foo11: 11\r +X-Foo12: 12\r +X-Foo13: 13\r +X-Foo14: 14\r +X-Foo15: 15\r +X-Foo16: 16\r +X-Foo17: 17\r +X-Foo18: 18\r +\r +" +--- skip_nginx: 3: < 0.7.46 + + + +=== TEST 24: Accept-Encoding +--- config + location /bar { + default_type 'text/plain'; + more_set_input_headers 'Accept-Encoding: gzip'; + gzip on; + gzip_min_length 1; + gzip_buffers 4 8k; + gzip_types text/plain; + } +--- user_files +">>> bar +" . ("hello" x 512) +--- request +GET /bar +--- response_headers +Content-Encoding: gzip +--- response_body_like: . + + + +=== TEST 25: rewrite + set request header +--- config + location /t { + rewrite ^ /foo last; + } + + location /foo { + more_set_input_headers 'X-Foo: howdy'; + proxy_pass http://127.0.0.1:$server_port/echo; + } + + location /echo { + echo "X-Foo: $http_x_foo"; + } +--- request + GET /foo +--- response_headers +! X-Foo +--- response_body +X-Foo: howdy + + + +=== TEST 26: clear_header should clear all the instances of the user custom header +--- config + location = /t { + more_clear_input_headers Foo; + + proxy_pass http://127.0.0.1:$server_port/echo; + } + + location = /echo { + echo "Foo: [$http_foo]"; + echo "Test-Header: [$http_test_header]"; + } +--- request +GET /t +--- more_headers +Foo: foo +Foo: bah +Test-Header: 1 +--- response_body +Foo: [] +Test-Header: [1] + + + +=== TEST 27: clear_header should clear all the instances of the builtin header +--- config + location = /t { + more_clear_input_headers Content-Type; + + proxy_pass http://127.0.0.1:$server_port/echo; + } + + location = /echo { + echo "Content-Type: [$http_content_type]"; + echo "Test-Header: [$http_test_header]"; + #echo $echo_client_request_headers; + } +--- request +GET /t +--- more_headers +Content-Type: foo +Content-Type: bah +Test-Header: 1 +--- response_body +Content-Type: [] +Test-Header: [1] + + + +=== TEST 28: Converting POST to GET - clearing headers (bug found by Matthieu Tourne, 411 error page) +--- config + location /t { + more_clear_input_headers Content-Type; + more_clear_input_headers Content-Length; + + #proxy_pass http://127.0.0.1:8888; + proxy_pass http://127.0.0.1:$server_port/back; + } + + location /back { + echo $echo_client_request_headers; + } +--- request +POST /t +hello world +--- more_headers +Content-Type: application/ocsp-request +Test-Header: 1 +--- response_body_like eval +qr/Connection: close\r +Test-Header: 1\r +\r +$/ +--- no_error_log +[error] + + + +=== TEST 29: clear_header() does not duplicate subsequent headers (old bug) +--- config + location = /t { + more_clear_input_headers Foo; + + proxy_pass http://127.0.0.1:$server_port/echo; + } + + location = /echo { + echo $echo_client_request_headers; + } +--- request +GET /t +--- more_headers +Bah: bah +Foo: foo +Test-Header: 1 +Foo1: foo1 +Foo2: foo2 +Foo3: foo3 +Foo4: foo4 +Foo5: foo5 +Foo6: foo6 +Foo7: foo7 +Foo8: foo8 +Foo9: foo9 +Foo10: foo10 +Foo11: foo11 +Foo12: foo12 +Foo13: foo13 +Foo14: foo14 +Foo15: foo15 +Foo16: foo16 +Foo17: foo17 +Foo18: foo18 +Foo19: foo19 +Foo20: foo20 +Foo21: foo21 +Foo22: foo22 +--- response_body_like eval +qr/Bah: bah\r +Test-Header: 1\r +Foo1: foo1\r +Foo2: foo2\r +Foo3: foo3\r +Foo4: foo4\r +Foo5: foo5\r +Foo6: foo6\r +Foo7: foo7\r +Foo8: foo8\r +Foo9: foo9\r +Foo10: foo10\r +Foo11: foo11\r +Foo12: foo12\r +Foo13: foo13\r +Foo14: foo14\r +Foo15: foo15\r +Foo16: foo16\r +Foo17: foo17\r +Foo18: foo18\r +Foo19: foo19\r +Foo20: foo20\r +Foo21: foo21\r +Foo22: foo22\r +/ + + + +=== TEST 30: clear input header (just more than 20 headers) +--- config + location = /t { + more_clear_input_headers "R"; + proxy_pass http://127.0.0.1:$server_port/back; + proxy_set_header Host foo; + #proxy_pass http://127.0.0.1:1234/back; + } + + location = /back { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- more_headers eval +my $s = "User-Agent: curl\n"; + +for my $i ('a' .. 'r') { + $s .= uc($i) . ": " . "$i\n" +} +$s +--- response_body eval +"GET /back HTTP/1.0\r +Host: foo\r +Connection: close\r +User-Agent: curl\r +A: a\r +B: b\r +C: c\r +D: d\r +E: e\r +F: f\r +G: g\r +H: h\r +I: i\r +J: j\r +K: k\r +L: l\r +M: m\r +N: n\r +O: o\r +P: p\r +Q: q\r +\r +" + + + +=== TEST 31: clear input header (just more than 20 headers, and add more) +--- config + location = /t { + more_clear_input_headers R; + more_set_input_headers "foo-1: 1" "foo-2: 2" "foo-3: 3" "foo-4: 4" + "foo-5: 5" "foo-6: 6" "foo-7: 7" "foo-8: 8" "foo-9: 9" + "foo-10: 10" "foo-11: 11" "foo-12: 12" "foo-13: 13" + "foo-14: 14" "foo-15: 15" "foo-16: 16" "foo-17: 17" "foo-18: 18" + "foo-19: 19" "foo-20: 20" "foo-21: 21"; + + proxy_pass http://127.0.0.1:$server_port/back; + proxy_set_header Host foo; + #proxy_pass http://127.0.0.1:1234/back; + } + + location = /back { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- more_headers eval +my $s = "User-Agent: curl\n"; + +for my $i ('a' .. 'r') { + $s .= uc($i) . ": " . "$i\n" +} +$s +--- response_body eval +"GET /back HTTP/1.0\r +Host: foo\r +Connection: close\r +User-Agent: curl\r +A: a\r +B: b\r +C: c\r +D: d\r +E: e\r +F: f\r +G: g\r +H: h\r +I: i\r +J: j\r +K: k\r +L: l\r +M: m\r +N: n\r +O: o\r +P: p\r +Q: q\r +foo-1: 1\r +foo-2: 2\r +foo-3: 3\r +foo-4: 4\r +foo-5: 5\r +foo-6: 6\r +foo-7: 7\r +foo-8: 8\r +foo-9: 9\r +foo-10: 10\r +foo-11: 11\r +foo-12: 12\r +foo-13: 13\r +foo-14: 14\r +foo-15: 15\r +foo-16: 16\r +foo-17: 17\r +foo-18: 18\r +foo-19: 19\r +foo-20: 20\r +foo-21: 21\r +\r +" + + + +=== TEST 32: clear input header (just more than 21 headers) +--- config + location = /t { + more_clear_input_headers R Q; + proxy_pass http://127.0.0.1:$server_port/back; + proxy_set_header Host foo; + #proxy_pass http://127.0.0.1:1234/back; + } + + location = /back { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- more_headers eval +my $s = "User-Agent: curl\nBah: bah\n"; + +for my $i ('a' .. 'r') { + $s .= uc($i) . ": " . "$i\n" +} +$s +--- response_body eval +"GET /back HTTP/1.0\r +Host: foo\r +Connection: close\r +User-Agent: curl\r +Bah: bah\r +A: a\r +B: b\r +C: c\r +D: d\r +E: e\r +F: f\r +G: g\r +H: h\r +I: i\r +J: j\r +K: k\r +L: l\r +M: m\r +N: n\r +O: o\r +P: p\r +\r +" + + + +=== TEST 33: clear input header (just more than 21 headers) +--- config + location = /t { + more_clear_input_headers R Q; + more_set_input_headers "foo-1: 1" "foo-2: 2" "foo-3: 3" "foo-4: 4" + "foo-5: 5" "foo-6: 6" "foo-7: 7" "foo-8: 8" "foo-9: 9" + "foo-10: 10" "foo-11: 11" "foo-12: 12" "foo-13: 13" + "foo-14: 14" "foo-15: 15" "foo-16: 16" "foo-17: 17" "foo-18: 18" + "foo-19: 19" "foo-20: 20" "foo-21: 21"; + + proxy_pass http://127.0.0.1:$server_port/back; + proxy_set_header Host foo; + #proxy_pass http://127.0.0.1:1234/back; + } + + location = /back { + echo -n $echo_client_request_headers; + } +--- request +GET /t +--- more_headers eval +my $s = "User-Agent: curl\nBah: bah\n"; + +for my $i ('a' .. 'r') { + $s .= uc($i) . ": " . "$i\n" +} +$s +--- response_body eval +"GET /back HTTP/1.0\r +Host: foo\r +Connection: close\r +User-Agent: curl\r +Bah: bah\r +A: a\r +B: b\r +C: c\r +D: d\r +E: e\r +F: f\r +G: g\r +H: h\r +I: i\r +J: j\r +K: k\r +L: l\r +M: m\r +N: n\r +O: o\r +P: p\r +foo-1: 1\r +foo-2: 2\r +foo-3: 3\r +foo-4: 4\r +foo-5: 5\r +foo-6: 6\r +foo-7: 7\r +foo-8: 8\r +foo-9: 9\r +foo-10: 10\r +foo-11: 11\r +foo-12: 12\r +foo-13: 13\r +foo-14: 14\r +foo-15: 15\r +foo-16: 16\r +foo-17: 17\r +foo-18: 18\r +foo-19: 19\r +foo-20: 20\r +foo-21: 21\r +\r +" + + + +=== TEST 34: clear X-Real-IP +--- config + location /t { + more_clear_input_headers X-Real-IP; + echo "X-Real-IP: $http_x_real_ip"; + } +--- request +GET /t +--- more_headers +X-Real-IP: 8.8.8.8 + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + if (@defined($r->headers_in->x_real_ip) && $r->headers_in->x_real_ip) { + printf("rewrite: x-real-ip: %s\n", + user_string_n($r->headers_in->x_real_ip->value->data, + $r->headers_in->x_real_ip->value->len)) + } else { + println("rewrite: no x-real-ip") + } +} + +F(ngx_http_core_content_phase) { + if (@defined($r->headers_in->x_real_ip) && $r->headers_in->x_real_ip) { + printf("content: x-real-ip: %s\n", + user_string_n($r->headers_in->x_real_ip->value->data, + $r->headers_in->x_real_ip->value->len)) + } else { + println("content: no x-real-ip") + } +} + +--- stap_out +rewrite: x-real-ip: 8.8.8.8 +content: no x-real-ip + +--- response_body +X-Real-IP: + +--- no_error_log +[error] + + + +=== TEST 35: set custom X-Real-IP +--- config + location /t { + more_set_input_headers "X-Real-IP: 8.8.4.4"; + echo "X-Real-IP: $http_x_real_ip"; + } +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + if (@defined($r->headers_in->x_real_ip) && $r->headers_in->x_real_ip) { + printf("rewrite: x-real-ip: %s\n", + user_string_n($r->headers_in->x_real_ip->value->data, + $r->headers_in->x_real_ip->value->len)) + } else { + println("rewrite: no x-real-ip") + } + +} + +F(ngx_http_core_content_phase) { + if (@defined($r->headers_in->x_real_ip) && $r->headers_in->x_real_ip) { + printf("content: x-real-ip: %s\n", + user_string_n($r->headers_in->x_real_ip->value->data, + $r->headers_in->x_real_ip->value->len)) + } else { + println("content: no x-real-ip") + } +} + +--- stap_out +rewrite: no x-real-ip +content: x-real-ip: 8.8.4.4 + +--- response_body +X-Real-IP: 8.8.4.4 + +--- no_error_log +[error] + + + +=== TEST 36: clear Via +--- config + location /t { + more_clear_input_headers Via; + echo "Via: $http_via"; + } +--- request +GET /t +--- more_headers +Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1) + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + if (@defined($r->headers_in->via) && $r->headers_in->via) { + printf("rewrite: via: %s\n", + user_string_n($r->headers_in->via->value->data, + $r->headers_in->via->value->len)) + } else { + println("rewrite: no via") + } +} + +F(ngx_http_core_content_phase) { + if (@defined($r->headers_in->via) && $r->headers_in->via) { + printf("content: via: %s\n", + user_string_n($r->headers_in->via->value->data, + $r->headers_in->via->value->len)) + } else { + println("content: no via") + } +} + +--- stap_out +rewrite: via: 1.0 fred, 1.1 nowhere.com (Apache/1.1) +content: no via + +--- response_body +Via: + +--- no_error_log +[error] + + + +=== TEST 37: set custom Via +--- config + location /t { + more_set_input_headers "Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)"; + echo "Via: $http_via"; + } +--- request +GET /t + +--- stap +F(ngx_http_headers_more_exec_input_cmd) { + if (@defined($r->headers_in->via) && $r->headers_in->via) { + printf("rewrite: via: %s\n", + user_string_n($r->headers_in->via->value->data, + $r->headers_in->via->value->len)) + } else { + println("rewrite: no via") + } + +} + +F(ngx_http_core_content_phase) { + if (@defined($r->headers_in->via) && $r->headers_in->via) { + printf("content: via: %s\n", + user_string_n($r->headers_in->via->value->data, + $r->headers_in->via->value->len)) + } else { + println("content: no via") + } +} + +--- stap_out +rewrite: no via +content: via: 1.0 fred, 1.1 nowhere.com (Apache/1.1) + +--- response_body +Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1) + +--- no_error_log +[error] + + + +=== TEST 38: HTTP 0.9 (set) +--- config + location /foo { + more_set_input_headers 'X-Foo: howdy'; + echo "x-foo: $http_x_foo"; + } +--- raw_request eval +"GET /foo\r\n" +--- response_headers +! X-Foo +--- response_body +x-foo: +--- http09 + + + +=== TEST 39: HTTP 0.9 (clear) +--- config + location /foo { + more_clear_input_headers 'X-Foo'; + echo "x-foo: $http_x_foo"; + } +--- raw_request eval +"GET /foo\r\n" +--- response_headers +! X-Foo +--- response_body +x-foo: +--- http09 + + + +=== TEST 40: Host header with port and $host +--- config + location /bar { + more_set_input_headers 'Host: agentzh.org:1984'; + echo "host var: $host"; + echo "http_host var: $http_host"; + } +--- request +GET /bar +--- response_body +host var: agentzh.org +http_host var: agentzh.org:1984 + + + +=== TEST 41: Host header with upper case letters and $host +--- config + location /bar { + more_set_input_headers 'Host: agentZH.org:1984'; + echo "host var: $host"; + echo "http_host var: $http_host"; + } +--- request +GET /bar +--- response_body +host var: agentzh.org +http_host var: agentZH.org:1984 + + + +=== TEST 42: clear all and re-insert +--- config + location = /t { + more_clear_input_headers Host Connection Cache-Control Accept + User-Agent Accept-Encoding Accept-Language + Cookie; + + more_set_input_headers "Host: a" "Connection: b" "Cache-Control: c" + "Accept: d" "User-Agent: e" "Accept-Encoding: f" + "Accept-Language: g" "Cookie: h"; + + more_clear_input_headers Host Connection Cache-Control Accept + User-Agent Accept-Encoding Accept-Language + Cookie; + + more_set_input_headers "Host: a" "Connection: b" "Cache-Control: c" + "Accept: d" "User-Agent: e" "Accept-Encoding: f" + "Accept-Language: g" "Cookie: h"; + + echo ok; + } + +--- raw_request eval +"GET /t HTTP/1.1\r +Host: localhost\r +Connection: close\r +Cache-Control: max-age=0\r +Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8\r +User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36\r +Accept-Encoding: gzip,deflate,sdch\r +Accept-Language: en-US,en;q=0.8\r +Cookie: test=cookie;\r +\r +" +--- response_body +ok +--- no_error_log +[error] + + + +=== TEST 43: more_set_input_header does not override request headers with multiple values +--- config + #lua_code_cache off; + location = /t { + more_set_input_headers "AAA: 111"; + + content_by_lua ' + local headers = ngx.req.get_headers() + ngx.say(headers["AAA"]) + '; + } +--- request +GET /t +--- more_headers +AAA: 123 +AAA: 456 +AAA: 678 + +--- response_body +111 +--- no_error_log +[error] + + + +=== TEST 44: clear If-Unmodified-Since req header +--- config + location = /t { + more_clear_input_headers 'If-Unmodified-Since'; + content_by_lua ' + ngx.header["Last-Modified"] = "Tue, 30 Jun 2011 12:16:36 GMT" + ngx.say("If-Unmodified-Since: ", ngx.var.http_if_unmodified_since) + '; + } +--- request +GET /t +--- more_headers +If-Unmodified-Since: Tue, 28 Jun 2011 12:16:36 GMT +--- response_body +If-Unmodified-Since: nil +--- no_error_log +[error] + + + +=== TEST 45: clear If-Match req header +--- config + location = /t { + more_clear_input_headers 'If-Match'; + echo "If-Match: $http_if_match"; + } +--- request +GET /t +--- more_headers +If-Match: abc +--- response_body +If-Match: +--- no_error_log +[error] + + + +=== TEST 46: clear If-None-Match req header +--- config + location = /t { + more_clear_input_headers 'If-None-Match'; + echo "If-None-Match: $http_if_none_match"; + } +--- request +GET /t +--- more_headers +If-None-Match: * +--- response_body +If-None-Match: +--- no_error_log +[error] + + + +=== TEST 47: set the Destination request header for WebDav +--- config + location = /a.txt { + more_set_input_headers "Destination: /b.txt"; + dav_methods MOVE; + dav_access all:rw; + root html; + } + +--- user_files +>>> a.txt +hello, world! + +--- request +MOVE /a.txt + +--- response_body +--- no_error_log +client sent no "Destination" header +[error] +--- error_code: 204 + + + +=== TEST 48: more_set_input_headers + X-Forwarded-For +--- config + location = /t { + more_set_input_headers "X-Forwarded-For: 8.8.8.8"; + proxy_pass http://127.0.0.1:$server_port/back; + proxy_set_header Foo $proxy_add_x_forwarded_for; + } + + location = /back { + echo "Foo: $http_foo"; + } + +--- request +GET /t + +--- response_body +Foo: 8.8.8.8, 127.0.0.1 +--- no_error_log +[error] + + + +=== TEST 49: more_clear_input_headers + X-Forwarded-For +--- config + location = /t { + more_clear_input_headers "X-Forwarded-For"; + proxy_pass http://127.0.0.1:$server_port/back; + proxy_set_header Foo $proxy_add_x_forwarded_for; + } + + location = /back { + echo "Foo: $http_foo"; + } + +--- request +GET /t + +--- more_headers +X-Forwarded-For: 8.8.8.8 +--- response_body +Foo: 127.0.0.1 +--- no_error_log +[error] + + + +=== TEST 50: clear input headers with wildcard +--- config + location /hello { + more_clear_input_headers 'X-Hidden-*'; + content_by_lua ' + ngx.say("X-Hidden-One: ", ngx.var.http_x_hidden_one) + ngx.say("X-Hidden-Two: ", ngx.var.http_x_hidden_two) + '; + } +--- request + GET /hello +--- more_headers +X-Hidden-One: i am hidden +X-Hidden-Two: me 2 +--- response_body +X-Hidden-One: nil +X-Hidden-Two: nil + + + +=== TEST 51: make sure wildcard doesn't affect more_set_input_headers +--- config + location /hello { + more_set_input_headers 'X-Hidden-*: lol'; + content_by_lua ' + ngx.say("X-Hidden-One: ", ngx.var.http_x_hidden_one) + ngx.say("X-Hidden-Two: ", ngx.var.http_x_hidden_two) + '; + } +--- request + GET /hello +--- more_headers +X-Hidden-One: i am hidden +X-Hidden-Two: me 2 +--- response_body +X-Hidden-One: i am hidden +X-Hidden-Two: me 2 diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t new file mode 100644 index 0000000..11183db --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/phase.t @@ -0,0 +1,25 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +plan tests => 3; + +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: simple set (1 arg) +--- config + location /foo { + deny all; + more_set_headers 'X-Foo: Blah'; + } +--- request + GET /foo +--- response_headers +X-Foo: Blah +--- response_body_like: 403 Forbidden +--- error_code: 403 diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t new file mode 100644 index 0000000..47d65e3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/sanity.t @@ -0,0 +1,628 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * 123; + +#master_on(); +#workers(2); +log_level("warn"); +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: simple set (1 arg) +--- config + location /foo { + echo hi; + more_set_headers 'X-Foo: Blah'; + } +--- request + GET /foo +--- response_headers +X-Foo: Blah +--- response_body +hi + + + +=== TEST 2: simple set (2 args) +--- config + location /foo { + echo hi; + more_set_headers 'X-Foo: Blah' 'X-Bar: hi'; + } +--- request + GET /foo +--- response_headers +X-Foo: Blah +X-Bar: hi +--- response_body +hi + + + +=== TEST 3: two sets in a single location +--- config + location /two { + echo hi; + more_set_headers 'X-Foo: Blah' + more_set_headers 'X-Bar: hi'; + } +--- request + GET /two +--- response_headers +X-Foo: Blah +X-Bar: hi +--- response_body +hi + + + +=== TEST 4: two sets in a single location (for 404 too) +--- config + location /two { + more_set_headers 'X-Foo: Blah' + more_set_headers 'X-Bar: hi'; + return 404; + } +--- request + GET /two +--- response_headers +X-Foo: Blah +X-Bar: hi +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 5: set a header then clears it (500) +--- config + location /two { + more_set_headers 'X-Foo: Blah'; + more_set_headers 'X-Foo:'; + return 500; + } +--- request + GET /two +--- response_headers +! X-Foo +! X-Bar +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 6: set a header only when 500 (matched) +--- config + location /bad { + more_set_headers -s 500 'X-Mine: Hiya'; + more_set_headers -s 404 'X-Yours: Blah'; + return 500; + } +--- request + GET /bad +--- response_headers +X-Mine: Hiya +! X-Yours +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 7: set a header only when 500 (not matched with 200) +--- config + location /bad { + more_set_headers -s 500 'X-Mine: Hiya'; + more_set_headers -s 404 'X-Yours: Blah'; + echo hello; + } +--- request + GET /bad +--- response_headers +! X-Mine +! X-Yours +--- response_body +hello +--- error_code: 200 + + + +=== TEST 8: set a header only when 500 (not matched with 404) +--- config + location /bad { + more_set_headers -s 500 'X-Mine: Hiya'; + more_set_headers -s 404 'X-Yours: Blah'; + return 404; + } +--- request + GET /bad +--- response_headers +! X-Mine +X-Yours: Blah +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 9: more conditions +--- config + location /bad { + more_set_headers -s '503 404' 'X-Mine: Hiya'; + more_set_headers -s ' 404 413 ' 'X-Yours: Blah'; + return 503; + } +--- request + GET /bad +--- response_headers +X-Mine: Hiya +! X-Yours +--- response_body_like: 503 Service +--- error_code: 503 + + + +=== TEST 10: more conditions +--- config + location /bad { + more_set_headers -s '503 404' 'X-Mine: Hiya'; + more_set_headers -s ' 404 413 ' 'X-Yours: Blah'; + return 404; + } +--- request + GET /bad +--- response_headers +X-Mine: Hiya +X-Yours: Blah +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 11: more conditions +--- config + location /bad { + more_set_headers -s '503 404' 'X-Mine: Hiya'; + more_set_headers -s ' 404 413 ' 'X-Yours: Blah'; + return 413; + } +--- request + GET /bad +--- response_headers +! X-Mine +X-Yours: Blah +--- response_body_like: 413 Request Entity Too Large +--- error_code: 413 + + + +=== TEST 12: simple -t +--- config + location /bad { + default_type 'text/css'; + more_set_headers -t 'text/css' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-CSS: yes +--- response_body +hi + + + +=== TEST 13: simple -t (not matched) +--- config + location /bad { + default_type 'text/plain'; + more_set_headers -t 'text/css' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +! X-CSS +--- response_body +hi + + + +=== TEST 14: multiple -t (not matched) +--- config + location /bad { + default_type 'text/plain'; + more_set_headers -t 'text/javascript' -t 'text/css' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +! X-CSS +--- response_body +hi + + + +=== TEST 15: multiple -t (matched) +--- config + location /bad { + default_type 'text/plain'; + more_set_headers -t 'text/javascript' -t 'text/plain' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-CSS: yes +--- response_body +hi + + + +=== TEST 16: multiple -t (matched) +--- config + location /bad { + default_type 'text/javascript'; + more_set_headers -t 'text/javascript' -t 'text/plain' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-CSS: yes +--- response_body +hi + + + +=== TEST 17: multiple -t (matched) with extra spaces +--- config + location /bad { + default_type 'text/javascript'; + more_set_headers -t ' text/javascript ' -t 'text/plain' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-CSS: yes +--- response_body +hi + + + +=== TEST 18: multiple -t merged +--- config + location /bad { + default_type 'text/javascript'; + more_set_headers -t ' text/javascript text/plain' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-CSS: yes +--- response_body +hi + + + +=== TEST 19: multiple -t merged (2) +--- config + location /bad { + default_type 'text/plain'; + more_set_headers -t ' text/javascript text/plain' 'X-CSS: yes'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-CSS: yes +--- response_body +hi + + + +=== TEST 20: multiple -s option in a directive (not matched) +--- config + location /bad { + more_set_headers -s 404 -s 500 'X-status: howdy'; + echo hi; + } +--- request + GET /bad +--- response_headers +! X-status +--- response_body +hi + + + +=== TEST 21: multiple -s option in a directive (matched 404) +--- config + location /bad { + more_set_headers -s 404 -s 500 'X-status: howdy'; + return 404; + } +--- request + GET /bad +--- response_headers +X-status: howdy +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 22: multiple -s option in a directive (matched 500) +--- config + location /bad { + more_set_headers -s 404 -s 500 'X-status: howdy'; + return 500; + } +--- request + GET /bad +--- response_headers +X-status: howdy +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 23: -s mixed with -t +--- config + location /bad { + default_type 'text/html'; + more_set_headers -s 404 -s 200 -t 'text/html' 'X-status: howdy2'; + return 404; + } +--- request + GET /bad +--- response_headers +X-status: howdy2 +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 24: -s mixed with -t +--- config + location /bad { + default_type 'text/html'; + more_set_headers -s 404 -s 200 -t 'text/plain' 'X-status: howdy2'; + return 404; + } +--- request + GET /bad +--- response_headers +! X-status +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 25: -s mixed with -t +--- config + location /bad { + default_type 'text/html'; + more_set_headers -s 404 -s 200 -t 'text/html' 'X-status: howdy2'; + echo hi; + } +--- request + GET /bad +--- response_headers +X-status: howdy2 +--- response_body +hi +--- error_code: 200 + + + +=== TEST 26: -s mixed with -t +--- config + location /bad { + default_type 'text/html'; + more_set_headers -s 500 -s 200 -t 'text/html' 'X-status: howdy2'; + return 404; + } +--- request + GET /bad +--- response_headers +! X-status +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 27: merge from the upper level +--- config + more_set_headers -s 404 -t 'text/html' 'X-status2: howdy3'; + location /bad { + default_type 'text/html'; + more_set_headers -s 500 -s 200 -t 'text/html' 'X-status: howdy2'; + return 404; + } +--- request + GET /bad +--- response_headers +X-status2: howdy3 +! X-status +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 28: merge from the upper level +--- config + more_set_headers -s 404 -t 'text/html' 'X-status2: howdy3'; + location /bad { + default_type 'text/html'; + more_set_headers -s 500 -s 200 -t 'text/html' 'X-status: howdy2'; + echo yeah; + } +--- request + GET /bad +--- response_headers +! X-status2 +X-status: howdy2 +--- response_body +yeah +--- error_code: 200 + + + +=== TEST 29: override settings by inheritance +--- config + more_set_headers -s 404 -t 'text/html' 'X-status: yeah'; + location /bad { + default_type 'text/html'; + more_set_headers -s 404 -t 'text/html' 'X-status: nope'; + return 404; + } +--- request + GET /bad +--- response_headers +X-status: nope +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 30: append settings by inheritance +--- config + more_set_headers -s 404 -t 'text/html' 'X-status: yeah'; + location /bad { + default_type 'text/html'; + more_set_headers -s 404 -t 'text/html' 'X-status2: nope'; + return 404; + } +--- request + GET /bad +--- response_headers +X-status: yeah +X-status2: nope +--- response_body_like: 404 Not Found +--- error_code: 404 + + + +=== TEST 31: clear headers with wildcard +--- config + location = /backend { + add_header X-Hidden-One "i am hidden"; + add_header X-Hidden-Two "me 2"; + echo hi; + } + location /hello { + more_clear_headers 'X-Hidden-*'; + proxy_pass http://127.0.0.1:$server_port/backend; + } +--- request + GET /hello +--- response_headers +! X-Hidden-One +! X-Hidden-Two +--- response_body +hi + + + +=== TEST 32: clear duplicate headers +--- config + location = /backend { + add_header pragma no-cache; + add_header pragma no-cache; + echo hi; + } + location /hello { + more_clear_headers 'pragma'; + proxy_pass http://127.0.0.1:$server_port/backend; + } +--- request + GET /hello +--- response_headers +!pragma +--- response_body +hi + + + +=== TEST 33: HTTP 0.9 (set) +--- config + location /foo { + more_set_headers 'X-Foo: howdy'; + echo ok; + } +--- raw_request eval +"GET /foo\r\n" +--- response_headers +! X-Foo +--- response_body +ok +--- http09 + + + +=== TEST 34: use the -a option to append the cookie field +--- config + location /cookie { + more_set_headers -a 'Set-Cookie: name=lynch'; + echo ok; + } +--- request + GET /cookie +--- response_headers +Set-Cookie: name=lynch +--- response_body +ok + + + +=== TEST 35: the original Set-Cookie fields will not be overwritten, when using the -a option +--- config + location /cookie { + more_set_headers 'Set-Cookie: name=lynch'; + more_set_headers -a 'Set-Cookie: born=1981'; + echo ok; + } +--- request + GET /cookie +--- raw_response_headers_like eval +"Set-Cookie: name=lynch\r\nSet-Cookie: born=1981\r\n" +--- response_body +ok + + + +=== TEST 36: The behavior of builtin headers can not be changed +--- config + location /foo { + more_set_headers -a "Server: myServer"; + echo ok; + } +--- request + GET /foo +--- must_die +--- error_log chomp +can not append builtin headers +--- suppress_stderr + + + +=== TEST 37: can not use -a option with more_clear_headers +--- config + location /foo { + more_clear_headers -a 'Content-Type'; + echo ok; + } +--- request + GET /foo +--- must_die +--- error_log chomp +invalid option name: "-a" +--- suppress_stderr diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t new file mode 100644 index 0000000..9443eca --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/subrequest.t @@ -0,0 +1,68 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; # 'no_plan'; + +plan tests => blocks() * 3; + +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: vars in input header directives +--- config + location /main { + echo_location /foo; + echo "main: $http_user_agent"; + } + location /foo { + set $val 'dog'; + + more_set_input_headers 'User-Agent: $val'; + + proxy_pass http://127.0.0.1:$server_port/proxy; + } + location /proxy { + echo "sub: $http_user_agent"; + } +--- request + GET /main +--- more_headers +User-Agent: my-sock +--- response_body +sub: dog +main: dog +--- response_headers +! Host +--- skip_nginx: 3: < 0.7.46 + + + +=== TEST 2: vars in input header directives +--- config + location /main { + #more_set_input_headers 'User-Agent: cat'; + echo_location /foo; + echo "main: $http_user_agent"; + } + location /foo { + set $val 'dog'; + + more_set_input_headers 'User-Agent: $val'; + + proxy_pass http://127.0.0.1:$server_port/proxy; + #echo $http_user_agent; + } + location /proxy { + echo "sub: $http_user_agent"; + } +--- request + GET /main +--- response_body +sub: dog +main: dog +--- response_headers +! Host +--- skip_nginx: 3: < 0.7.46 diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t new file mode 100644 index 0000000..c51f91c --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/unused.t @@ -0,0 +1,174 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (blocks() * 4 + 2); + +#master_on(); +#workers(2); +log_level("warn"); +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: used output filter +--- config + location /foo { + echo hi; + more_set_headers "Foo: bar"; + } +--- request + GET /foo +--- response_headers +Foo: bar +--- response_body +hi +--- error_log +headers more header filter +--- no_error_log +[error] +--- log_level: debug + + + +=== TEST 2: unused output filter (none) +--- config + location /foo { + echo hi; + } +--- request + GET /foo +--- response_body +hi +--- no_error_log +headers more header filter +[error] +--- log_level: debug + + + +=== TEST 3: unused output filter (with more_set_input_headers only) +--- config + location /foo { + more_set_input_headers "Foo: bar"; + echo hi; + } +--- request + GET /foo +--- response_body +hi +--- no_error_log +headers more header filter +[error] +--- log_level: debug + + + +=== TEST 4: used rewrite handler +--- config + location /foo { + more_set_input_headers "Foo: bar"; + echo hi; + } +--- request + GET /foo +--- response_body +hi +--- error_log +headers more rewrite handler +--- no_error_log +[error] +--- log_level: debug + + + +=== TEST 5: unused rewrite handler (none) +--- config + location /foo { + #more_set_input_headers "Foo: bar"; + echo hi; + } +--- request + GET /foo +--- response_body +hi +--- no_error_log +headers more rewrite handler +[error] +--- log_level: debug + + + +=== TEST 6: unused rewrite handler (with output header filters) +--- config + location /foo { + #more_set_input_headers "Foo: bar"; + echo hi; + more_set_headers "Foo: bar"; + } +--- request + GET /foo +--- response_headers +Foo: bar +--- response_body +hi +--- no_error_log +headers more rewrite handler +[error] +--- log_level: debug + + + +=== TEST 7: multiple http {} blocks (filter) +This test case won't run with nginx 1.9.3+ since duplicate http {} blocks +have been prohibited since then. +--- SKIP +--- config + location /foo { + echo hi; + more_set_headers 'Foo: bar'; + } +--- post_main_config + http { + } + +--- request + GET /foo +--- response_body +hi +--- response_headers +Foo: bar +--- no_error_log +[error] +--- error_log +headers more header filter +--- log_level: debug + + + +=== TEST 8: multiple http {} blocks (handler) +This test case won't run with nginx 1.9.3+ since duplicate http {} blocks +have been prohibited since then. +--- SKIP +--- config + location /foo { + more_set_input_headers 'Foo: bar'; + echo $http_foo; + } +--- post_main_config + http { + } + +--- request + GET /foo +--- response_body +bar +--- no_error_log +headers more header handler +[error] +--- log_level: debug diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t new file mode 100644 index 0000000..04c75c3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/t/vars.t @@ -0,0 +1,58 @@ +# vi:ft= + +use lib 'lib'; +use Test::Nginx::Socket; # 'no_plan'; + +plan tests => 9; + +no_diff; + +run_tests(); + +__DATA__ + +=== TEST 1: vars +--- config + location /foo { + echo hi; + set $val 'hello, world'; + more_set_headers 'X-Foo: $val'; + } +--- request + GET /foo +--- response_headers +X-Foo: hello, world +--- response_body +hi + + + +=== TEST 2: vars in both key and val +--- config + location /foo { + echo hi; + set $val 'hello, world'; + more_set_headers '$val: $val'; + } +--- request + GET /foo +--- response_headers +$val: hello, world +--- response_body +hi + + + +=== TEST 3: vars in input header directives +--- config + location /foo { + set $val 'dog'; + more_set_input_headers 'Host: $val'; + echo $host; + } +--- request + GET /foo +--- response_body +dog +--- response_headers +Host: diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh new file mode 100755 index 0000000..00a191f --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/util/build.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# this file is mostly meant to be used by the author himself. + +root=`pwd` +version=$1 +home=~ +force=$2 +pcre2_opt="" +if [ "$WITHOUT_PCRE2" = "1" ]; then + pcre2_opt="--without-pcre2" +fi + + #--with-cc=gcc46 \ + +ngx-build $force $version \ + --with-ld-opt="-L$PCRE_LIB -Wl,-rpath,$PCRE_LIB:$LIBDRIZZLE_LIB" \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --without-http_upstream_ip_hash_module \ + --without-http_empty_gif_module \ + --without-http_memcached_module \ + --without-http_referer_module \ + --without-http_autoindex_module \ + --without-http_auth_basic_module \ + --without-http_userid_module \ + $pcre2_opt \ + --with-http_realip_module \ + --with-http_dav_module \ + --add-module=$root/../eval-nginx-module \ + --add-module=$root/../lua-nginx-module \ + --add-module=$root/../echo-nginx-module \ + --add-module=$root $opts \ + --with-debug + #--add-module=$root/../ndk-nginx-module \ + #--without-http_ssi_module # we cannot disable ssi because echo_location_async depends on it (i dunno why?!) + diff --git a/modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress new file mode 100644 index 0000000..d51de70 --- /dev/null +++ b/modules_deb/libnginx-mod-http-headers-more-filter-0.38/valgrind.suppress @@ -0,0 +1,135 @@ +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + obj:* +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_calloc + fun:ngx_event_process_init +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_event_process_init +} +{ + + Memcheck:Param + epoll_ctl(event) + fun:epoll_ctl +} +{ + + Memcheck:Cond + fun:memcpy + fun:ngx_vslprintf + fun:ngx_log_error_core + fun:ngx_http_charset_header_filter +} +{ + nginx-core-process-init + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_event_process_init +} +{ + nginx-core-crc32-init + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_crc32_table_init + fun:main +} +{ + palloc_large_for_init_request + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_palloc_large + fun:ngx_palloc + fun:ngx_pcalloc + fun:ngx_http_init_request + fun:ngx_epoll_process_events + fun:ngx_process_events_and_timers +} +{ + palloc_large_for_create_temp_buf + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_palloc_large + fun:ngx_palloc + fun:ngx_create_temp_buf + fun:ngx_http_init_request + fun:ngx_epoll_process_events + fun:ngx_process_events_and_timers +} +{ + accept_create_pool + Memcheck:Leak + fun:memalign + fun:posix_memalign + fun:ngx_memalign + fun:ngx_create_pool + fun:ngx_event_accept + fun:ngx_epoll_process_events + fun:ngx_process_events_and_timers +} +{ + create_pool_for_init_req + Memcheck:Leak + fun:memalign + fun:posix_memalign + fun:ngx_memalign + fun:ngx_create_pool + fun:ngx_http_init_request + fun:ngx_epoll_process_events + fun:ngx_process_events_and_timers +} +{ + + Memcheck:Addr8 + fun:getenv + fun:gcov_exit + fun:exit + fun:ngx_master_process_exit +} +{ + + Memcheck:Cond + fun:index + fun:expand_dynamic_string_token + fun:_dl_map_object + fun:map_doit + fun:_dl_catch_error + fun:do_preload + fun:dl_main +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_single_process_cycle +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_worker_process_init + fun:ngx_worker_process_cycle +} diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/.gitignore b/modules_deb/libnginx-mod-http-ndk-0.3.4/.gitignore new file mode 100644 index 0000000..0fd79d0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/.gitignore @@ -0,0 +1,4 @@ +tags +cscope.* +*~ +*.swp diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/LICENSE b/modules_deb/libnginx-mod-http-ndk-0.3.4/LICENSE new file mode 100644 index 0000000..e1a5221 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2010-2018, Marcus Clyne + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/README.md b/modules_deb/libnginx-mod-http-ndk-0.3.4/README.md new file mode 100644 index 0000000..d9d3972 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/README.md @@ -0,0 +1,254 @@ +Name +==== + +Nginx Development Kit (NDK) + +Table of Contents +================= + +* [Name](#name) +* [Synopsis](#synopsis) +* [Status](#status) +* [Features](#features) +* [Design](#design) + * [modular](#modular) + * [auto-generated & easily extensible](#auto-generated--easily-extensible) +* [Usage for users](#usage-for-users) + * [Building as a dynamic module](#building-as-a-dynamic-module) +* [Usage for developers](#usage-for-developers) + * [Warning: using NDK_ALL](#warning-using-ndk_all) +* [Modules using NDK](#modules-using-ndk) +* [TODO](#todo) +* [License](#license) +* [Contributing / Feedback](#contributing--feedback) +* [Authors](#authors) +* [Special Thanks](#special-thanks) + +Synopsis +======== + +The NDK is an Nginx module that is designed to extend the core functionality of the +excellent Nginx webserver in a way that can be used as a basis of other Nginx modules. + +It has functions and macros to deal with generic tasks that don't currently have +generic code as part of the core distribution. The NDK itself adds few features +that are seen from a user's point of view - it's just designed to help reduce the +code that Nginx module developers need to write. + +Nginx module developers wishing to use any of the features in the NDK should specify +that the NDK is a dependency of their module, and that users will need to compile +it as well when they compile their own modules. They will also need to declare in +their own modules which features of the NDK they wish to use (explained below). + +If you are not an Nginx module developer, then the only useful part of this project +will be the 'usage for users' section below. + +[Back to TOC](#table-of-contents) + +Status +====== + +The NDK is now considered to be stable. It is already being used in quite a few third +party modules (see list below). + +[Back to TOC](#table-of-contents) + +Features +======== + +* additional conf_set functions for regexes, complex/script values, paths... +* macros to simplify tasks like checking for NULL values when doing ngx_array_push +* patches to the main source code +* ngx_auto_lib_core generic external library handler is included (see separate readme) + +[Back to TOC](#table-of-contents) + +Design +====== + +modular +------- + +The kit itself is designed in a modular way, so that only the required code is compiled. +It's possible to add just a single NDK module, a few or all of them. + +[Back to TOC](#table-of-contents) + +auto-generated & easily extensible +---------------------------------- + +Many of the macros available in the NDK are auto-generated from simple configuration +files. This makes creating similar macros for your own code very simple - it's usually +just the case of adding an extra line to a config file and re-running the build script. + +[Back to TOC](#table-of-contents) + +Usage for users +=============== + +If another Nginx module you wish to use specifies that the NDK is a dependency, you +will need to do the following : + +1. download the source (https://github.com/simpl/ngx_devel_kit) +2. unpack the source (tar -xzf $name) +3. compile Nginx with the following extra option `--add-module=/path/to/ngx_devel_kit`. + +e.g. + +```bash +./configure --add-module=/path/to/ngx_devel_kit \ + --add-module=/path/to/another/module +``` + +[Back to TOC](#table-of-contents) + +Building as a dynamic module +---------------------------- + +Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the +`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) +directive, for example, + +```nginx +load_module /path/to/modules/ndk_http_module.so; +load_module /path/to/another/module.so; +``` + +[Back to TOC](#table-of-contents) + +Usage for developers +==================== + +To use the NDK in your own module, you need to add the following: + +1. add this line to your module + +```C +#include +``` + +Note: since the NDK includes the following lines + +```C +#include +#include +#include +``` + +you can replace these with the single include above. +2. add the following line in the config file for your module: + +```bash +have=NDK_[module_name] . auto/have +``` + +for each NDK module that you wish to use (you need to include auto/have multiple +times if you wish to use multiple NDK modules. + +Note: the old method of setting + +```config +CFLAGS="$CFLAGS -DNDK_[module_name]" +``` + +is now deprecated. It will still work, but results in unnecessary lines being +displayed when compiling Nginx. + +[Back to TOC](#table-of-contents) + +Warning: Using NDK_ALL +---------------------- + +You can also set `NDK_ALL` to include all the NDK modules. This is primarily as +a convenience in the early stages of development of another module. However, + +DO NOT LEAVE `NDK_ALL` IN YOUR CONFIG FILE WHEN PUBLISHING + +Although the NDK is fairly small now, it could in time become a large repository +of code that would, if using NDK_ALL, result in considerably more code being compiled +than is necessary. + +[Back to TOC](#table-of-contents) + +Modules using NDK +================= + +The following 3rd-party modules make use of NDK. + +* [ngx_http_lua_module](https://github.com/openresty/lua-nginx-module#readme) +* [ngx_http_set_misc_module](https://github.com/openresty/set-misc-nginx-module#readme) +* [ngx_http_encrypted_session_module](https://github.com/openresty/encrypted-session-nginx-module#readme) +* [ngx_http_form_input_module](https://github.com/calio/form-input-nginx-module#readme) +* [ngx_http_iconv_module](https://github.com/calio/iconv-nginx-module#readme) +* [ngx_http_array_var_module](https://github.com/openresty/array-var-nginx-module#readme) + +If you would like to add your module to this list, please let us know. + +[Back to TOC](#table-of-contents) + +TODO +==== + +* documentation for modules that don't already have it +* additional phase-handler functions +* generically testing for needing to add a handler +* remove dependency of set_var on OpenSSL being compiled in +* for backward compatability, add the ndk_macros + +[Back to TOC](#table-of-contents) + +License +======= + +Copyright (c) 2010-2018, Marcus Clyne + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are +permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this list of +conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, this list of +conditions and the following disclaimer in the documentation and/or other materials +provided with the distribution. +3. Neither the name of the copyright holder nor the names of its contributors may be used +to endorse or promote products derived from this software without specific prior +written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS +OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE +GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[Back to TOC](#table-of-contents) + +Contributing / Feedback +======================= + +If you are an Nginx module developer, and have developed some functions that are +generic in nature (or would be easily adapted to be so), then please send them to +me at the address below, and I'll addmclyne to the kit. + +[Back to TOC](#table-of-contents) + +Author +====== + +[Marcus Clyne](https://github.com/mclyne) + +[Back to TOC](#table-of-contents) + + +Special Thanks +============== + +A special thanks goes to [Yichun Zhang](https://github.com/agentzh) for helping to maintain +this module. + +[Back to TOC](#table-of-contents) diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md b/modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md new file mode 100644 index 0000000..f2c3371 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/README_AUTO_LIB.md @@ -0,0 +1,394 @@ +Nginx Auto Lib Core +=================== + +Nginx Auto Lib Core is a generic external library-handler that has been designed to +facilitate the inclusion of external libraries in modules for the Nginx web server. +It has been written both for the benefit of Nginx module developers and for the end +users of those Nginx modules, and can provide a consistent, intelligent, flexible +cross-platform way to include external libraries. + +Any developers of Nginx modules are encouraged to use Auto Lib Core to handle library +dependencies for their modules rather than writing their own custom handler from scratch. + +Note : The latest version can be found [here](https://github.com/simplresty/ngx_auto_lib). + + +Information for end users +========================= + +To include external libraries using Auto Lib to you may need or wish to export some +variables before you run configure. e.g. + +$ export MOZJS=/path/to/mozjs +$ export MOZJS_SHARED=NO +$ ./configure ... + +In all cases below [PFX] should be replaced with the name of the library (e.g. MOZJS). The +specific value for [PFX] should be mentioned in the README file for the module that +uses Auto Lib Core. + + +Search order for paths +---------------------- + +(1) [PFX]_INC and [PFX]_LIB +(2) [PFX] (source or install dir) +(3) any dirs under [PFX]_BASE (see below) +(4) any dirs under the parent directory of the Nginx source dir beginning with '[pfx]-' +(5) standard system paths (including /usr/local, /usr, /opt/local, /opt, /usr/pkg) + +If any of 1-3 are specified, then any set values will be searched, and the the Nginx +source's parent directory and system paths are not searched unless [PFX]_SEARCH_[PLACE] +variable is set to YES, where PLACE ::= PARENT | SYSTEM. e.g. + +$ export OPENSSL_LIB=/path/to/openssl/lib +$ export OPENSSL_INC=/path/to/openssl/inc +$ ./configure + +will search only in the lib and include paths specified, and + +$ export OPENSSL_LIB=/path/to/openssl/lib +$ export OPENSSL_INC=/path/to/openssl/inc +$ export OPENSSL_BASE=/path/to/openssl/base +$ export OPENSSL_SEARCH_PARENT=YES +$ ./configure --with-openssl=/path/to/openssl + +will search first in the lib & inc dirs specified, then in /path/to/openssl, then will +look for directories in /path/to/openssl/base and then in the Nginx source parent +directory, but will skip checking the system paths. + +Note : apart from system paths, all dirs are checked as both source and install directories, +so static versions of installed OpenSSL, PCRE, Zlib etc libraries can be used with Nginx +if desired. + + +Specifying a path to find a library +----------------------------------- + +If the version of a library you wish to include is in any of the standard paths (e.g. +/usr/local, /usr ...), you will not need to specify a path to include the library. + +If you do wish to specify a specific path, in most cases just specifying +[PFX]=/path/to/library will be sufficient. e.g. + +$ export MOZJS=/path/to/mozjs +$ ./configure ... + +The path can be either a source directory or an install directory. Auto Lib will search + + +Searching under base paths +-------------------------- + +Rather than specifying a specific path to find new libraries in non-standard locations, +you may wish to specify a base path (or just let Auto Lib search the directory that the +Nginx source is located in). This will then automatically find the most recent versions +of libraries and check them before older versions. + +e.g. + +You have installations + +/openssl/version/0.9.8m +/openssl/version/1.0.0a +... + +$ export OPENSSL_BASE=/openssl/version +$ ./configure ... + +Any directories under /openssl/version will be searched IN REVERSE ORDER, i.e. most recent +version first. Here /openssl/version/1.0.0a would be searched before /openssl/version/0.9.8m. + +If [PFX]_BASE_SEARCH_PREFIX=YES, then only directories beginning with '[pfx]-' are searched. +If [PFX]_BASE_SEARCH_PREFIX=something, then only directories beginning with 'something' are +searched. + +When searching under [PFX]_BASE no prefix is added to the search, but when searching under +the directory that the Nginx source is located in, the prefix [pfx]- is automatically added. + +Note : there is currently a minor bug (due to the implementation of the 'sort' command) +means versions that include hyphens (e.g. 1.0.0-beta5) are checked before versions like +1.0.0a. This will be fixed soon, and searching of -build folders before normal source ones +will be added too. + + + +Shared or static? +----------------- + +The default for most libraries is to look for shared libraries, though this can be overridden +by the user by setting [PFX]_SHARED=NO. + +In the near future the default action will be to look for shared libraries then to look +for static libraries in each directory searched unless one of [PFX]_SHARED and/or +[PFX]_STATIC = NO. If both are set to NO, then Auto Lib will not be used at all. + + + +Variables that users can set to help find libraries +--------------------------------------------------- + +[PFX] Location of dir where the library can be found (PATH, see below) +[PFX]_INC Include dir for library headers (PATH) +[PFX]_LIB Lib dir for library archive/shared objects (PATH) +[PFX]_BASE Base dir under which to search for other dirs (PATH) +[PFX]_SEARCH_LIB_INC Search in [PFX]_INC and [PFX]_LIB if set (YES|NO, def=YES) +[PFX]_SEARCH_DIR Search [PFX] if set (YES|NO, def=YES) +[PFX]_SEARCH_BASE Search under [PFX]_BASE if set (YES|NO, def=YES) +[PFX]_SEARCH_PARENT Search under the dir that the Nginx source is in (YES|NO, see above) +[PFX]_SEARCH_SYSTEM Search in standard system paths (YES|NO, see above) +[PFX]_SHARED Use shared library rather than static (YES|NO, def=YES) +[PFX]_SYSTEM_DIRS System dirs to search in (PATHS, space-separated, overrides the defaults) +USE_[PFX] Whether or not to install the library (YES|NO, def=YES) + + +Note : for libraries that have configure options (e.g. --with-openssl=/path), the [PFX] +variable is set automatically by configure, so will not be used if exported. + + + +Information for module developers +================================= + +How Auto Lib Core works +----------------------- + +Auto Lib Core works as an interface layer between the module and the auto/feature part of +the Nginx source. This is the file that results in the 'checking for ...' lines that you +see when you call ./configure. + +auto/feature works by using a few key variables (see below) to generate some C code, trying +to compile it to see if it works and optionally running the code. This output file is called +autotest.c (located under the objs/ directory whilst configure is running, but is deleted +after each call to auto/feature). + +Normally, whenever an external library is required, a module developer will write a number +of calls to auto/feature manually in their config files - e.g. to check under a range of +different possible locations to find a library. Apart from being tedious, this is obviously +potentially error-prone. + +Auto Lib Core will automatically generate all the calls to auto/feature for you, and will +take into account different operating systems etc in a consistent way, 'intelligent' way. + + +Including Nginx Auto Lib Core with custom modules +------------------------------------------------- + +Option 1 : + +- include ngx_auto_lib_core in the same directory that your module config file is + located +- add the following line to your config file + + . $ngx_addon_dir/ngx_auto_lib_core + +NOTE : if you want to include the file in a different directory to your config +file, you will need to change both the include line in your config file AND +the line in the ngx_auto_lib_core file that points to the file (it's the line that +has $ngx_addon_dir/ngx_auto_lib_core in it) + +Option 2 : + +- make the Nginx Development Kit (github.com/simpl-it/ngx_devel_kit) a dependency + for your module (Auto Lib Core is included automatically with it) + + +Recommended way of including Auto Lib Core +------------------------------------------ + +If the Nginx Development Kit (NDK) is already a dependency for your module, then you do +not need to do anything - just follow the 'using Auto Lib Core' instructions below. + +If the NDK is not a dependency for your module, then it is recommended to include a +copy of ngx_auto_lib_core with your module, but to recommend to users of your module +to include the NDK when compiling. If the module is not required for anything else, this +will not make any difference to the Nginx binary that they compile, but will mean they +will get the latest version of Auto Lib Core (which probably won't change much anyway, +but you never know). + +You will also probably want to include a copy of this readme file for Auto Lib Core +(at least the user section), and mention what the relevant [PFX] you use for your module +is in your module's readme file so that users will know what to write for any variables +that they might use to control the search paths for libraries (see above user section). + + +Using Auto Lib Core +------------------- + +To use Auto Lib Core, you should do the following in your config file for each +external library that you want to include : + +1 - Call ngx_auto_lib_init +2 - Define any variables used for testing +3 - Define any hooks (custom functions) +4 - Call ngx_auto_lib_run + + +Calling ngx_auto_lib_init() and ngx_auto_lib_run() +-------------------------------------------------- + +You can pass either one or two variables to ngx_auto_lib_init(). The first is the name of +the library as it will appear when running ./configure, the second is the prefix that is +used for internal variables and looking for directory prefixes. If the second is not +specified, it defaults to the first. + +The init function resets all key variables and functions, so it must be called before +setting any other variables or functions that are to be used as hooks (see the notes below). + +ngx_auto_lib_run() should be called in the config files after all the variables and hooks +have been defined. This will then run through all the tests to try to find the external +library. + + +Variables you can set in your config files +------------------------------------------ + +All the variables that you set in Auto Lib Core are similar to the ones you set for +including libraries in the normal way. + + name description +---------------------------------------------------------------------------------------- + +core variables (i.e. the ones in the core Nginx source) + +ngx_feature_inc_path CFLAGS and include path info (including -I) +ngx_feature_incs Include/define code inserted before main() in autotest.c +ngx_feature_libs External libraries to add (see below) +ngx_feature_path Space-separated include path +ngx_feature_run Whether to run the autotest binary (default = no) +ngx_feature_test C-code inserted inside main() in autotest.c + +extended variables (only work in NALC) : + +ngx_feature_add_libs Add libraries (but do not add include files) +ngx_feature_add_path Add extra directories to include path +ngx_feature_build_dirs Sub dirs that builds might be found +ngx_feature_build_inc_dirs Sub dirs that include files might be found +ngx_feature_build_lib_dirs Sub dirs that lib files might be found +ngx_feature_check_macros_defined Lib required only if one of these macros is defined +ngx_feature_check_macros_non_zero Lib required only if one of these macros is non-zero +ngx_feature_defines Define these macros if the library is found +ngx_feature_deps Deps to add (e.g. to CORE_DEPS) if the library is found +ngx_feature_exit_if_not_found Quit configure if the library is not found +ngx_feature_haves Set these macros to 1 if the library is found +ngx_feature_inc_names Names for include files (not including the .h) +ngx_feature_lib_files Add these files under the lib dir for static inclusions +ngx_feature_lib_names Names for lib files (not including -l or .a) +ngx_feature_modules Modules to add if the library is found +ngx_feature_srcs Sources to add (e.g. to ADDON_SRCS) if the lib is found +ngx_feature_shared If set to 'no', then only use static lib versions +ngx_feature_test_libs Add these libs when testing, but not to the final binary +ngx_feature_variables Set these variables if the library is found + +standard variables that are completely over-written (i.e. they won't work with NALC) : + +ngx_feature_name Message that is displayed after 'checking for' in configure + + +Using these variables +--------------------- + +You do not need to set most of these variables, since 'intelligent' guesses are made that +will work for most cases. With the exception of ngx_feature_test, you should generally use +the extended variables rather than the core ones, since sensible core variables will be +automatically generated from them, and will work for both static and shared libraries. + + +Variable defaults +----------------- + +ngx_feature_incs for i in $ngx_feature_inc_names { #include <$i.h> } +ngx_feature_libs for l in $ngx_feature_lib_names { -l$l or $LIB/lib$l.a } + + $ngx_feature_add_libs +ngx_feature_inc_names $ngx_feature_lib_names +ngx_feature_lib_names $pfx +pfx str_to_lower (if two variables are passed to ngx_auto_lib_init, then + then $2, otherwise, $1) + +The easiest way to understand how all the defaults work is probably to look at the source code +of ngx_auto_lib_test_setup() and to look at the examples in the standard Nginx Auto Lib module +which has code for OpenSSL, PCRE, Zlib, MD5 and SHA1. + + +Hooks +----- + +To facilitate using Auto Lib Core in a flexible way, a number of 'hooks' have been +placed in the testing cycle. These hooks are implemented as functions that you define +in your config file which are called if required by the core library. In the core +library they are left as empty functions that return either 0 or 1. Any functions +you write will + +Note : ngx_auto_lib_init() resets the variables and functions each time it is called, so +you must DEFINE HOOKS AFTER YOU CALL ngx_auto_lib_init. + +Note : an update on what hooks are available will be added later. To see what hooks are +available, just look in the source code of ngx_auto_lib_core for any functions that just +return 0 or 1. + +See the MD5 and SHA1 libraries of Nginx Auto Lib module for examples. + + + +Checking that a library is required +----------------------------------- + +Although in most cases Auto Lib Core will be used where external libraries are +definitely required (for a module to work), this may not always be the case. In the +standard Nginx Auto Lib module (github.com/simpl-it/ngx_auto_lib) - which is designed +to improve the inclusion of OpenSSL, PCRE and Zlib libraries and increase compilation +speed where possible - the libraries are not always required, so checks are made to +see if it is necessary. + + + +How Auto Lib Core checks if a library is required - ngx_auto_lib_check_require() +------------------------------------------------------------------------------------ + +- search for USE_[PFX]=YES (it is set to YES by default for most modules) +- search for any external libraries that have been included in the CORE_LIBS or ADDON_LIBS + variables that use the same lib name as any set in ngx_feature_lib_names +- search for any macros that have been defined either in the CFLAGS variable or using + auto/have or auto/define as set in the ngx_feature_check_macros_defined and + ngx_feature_ngx_macros_non_zero variables +- any custom checks implemented by creating an ngx_auto_lib_check hook function (which + should return 0 if the library is required and return 1 at the end if the module is + not required) + + + +Guaranteeing that the correct version of a shared library is linked at run time +------------------------------------------------------------------------------- + +Sometimes users will want to use shared libraries that are in non-standard locations +that the linker may have a problem in locating at run time - even if the correct +linker path (-L/path/to/lib) is supplied when checking. To make sure that the linker +can find the library at run time, and to make sure that the linker will use the correct +version of a library if the library is also located in a standard directory, a run path +is added to the linker flags (using -Wl,--rpath -Wl,/path/to/lib/dir). In most cases this +will guarantee that the correct library is used when linking - though care should be taken +by any users specifying specific paths for libraries that the correct version of the +library has been linked at run time (e.g. using ldd etc). + +As an additional check when running auto/feature, as well as the compilation of the +autotest.c file, a check is made by ldd to see that the path of the shared library +that the linker links to is the same as the one specified. This is done because + + +To do +----- + +- Change how library paths are searched to include both shared and static libraries +- Touch up documentation + + +License +------- + + BSD + + +Copyright +--------- + + [Marcus Clyne](https://github.com/mclyne) (c) 2010 diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/array b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/array new file mode 100644 index 0000000..04cd889 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/array @@ -0,0 +1,10 @@ + +array_create (a,pl,n,sz) a = %1%_array_create (pl,n,sz); if (a == NULL) %A% +array_init (a,pl,n,sz) if (%1%_array_init (a,pl,n,sz) == %E%) %A% +array_push (p,a) p = %1%_array_push (a); if (p == NULL) %A% +array_push_clean (p,a) p = %1%_array_push (a); if (p == NULL) %A%; %2%_zerop (p) +array_push_n (p,a,n) p = %1%_array_push_n (a,n); if (p == NULL) %A% +array_push_n_clean (p,a,n) p = %1%_array_push_n (a,n); if (p == NULL) %A%; %2%_zeropn (p,n) + + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/palloc b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/palloc new file mode 100644 index 0000000..6d430bd --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/actions/palloc @@ -0,0 +1,8 @@ + +palloc (p,pl,sz) p = %1%_palloc (pl,sz); if (p == NULL) %A% +pallocp (p,pl) %2%_pallocp (p,pl); if (p == NULL) %A% +pallocpn (p,pl,n) %2%_pallocpn (p,pl,n); if (p == NULL) %A% +pcalloc (p,pl,sz) p = %1%_pcalloc (pl,sz); if (p == NULL) %A% +pcallocp (p,pl) %2%_pcallocp (p,pl); if (p == NULL) %A% +pcallocpn (p,pl,n) %2%_pcallocpn (p,pl,n); if (p == NULL) %A% + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/build b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/build new file mode 100644 index 0000000..feb84b3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/build @@ -0,0 +1,597 @@ +#! /bin/bash + +cd `dirname $0` + +if [ $# -eq 2 ]; +then + if [ `expr $2 : /` -eq 1 ]; + then + output_dir=$2 + else + output_dir=$1/$2 + fi +else + output_dir=../objs +fi + +list_file=data/action_list +types_file=data/action_types +reps_file=data/action_replacements +prefix_file=data/prefixes +header_file=data/header_files +optional_modules_file=data/modules_optional +headers_file=data/headers +module_dependencies_file=data/module_dependencies +conf_macros_file=data/conf_macros +conf_locs_file=data/conf_locs +conf_args_file=data/conf_args + +autogen_notice=text/autogen + +actions_dir=actions +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 +conf_cmd_extra_filename=conf_cmd_extra.h + + +spacer=¬ + +sed_delete_empty_lines='t_NEL;d;:_NEL' + + +function trim_lines { + sed -e '/./,$!d' -e :a -e '/^\n*$/{$d;N;ba' -e '}' +} + + +function strtoupper { + [ $# -eq 1 ] || return 1 + local _str _cu _cl _x + _cu=(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) + _cl=(a b c d e f g h i j k l m n o p q r s t u v w x y z) + _str=$1 + for ((_x=0;_x<${#_cl[*]};_x++)); do + _str=${_str//${_cl[$_x]}/${_cu[$_x]}} + done + echo $_str +} + + +function sed_pad_right { + len=$1 + spacer=$2 + prefix=_PR$3 + + # returns a SED script that pads out (spaces) to the right to alignment $len + # this script should be used inside a call to sed + # NOTE : a spacer character $spacer should have already been written into the parsed string + + echo "t${prefix}a;:${prefix}a;s/^[^$spacer]{$len}/&/;\ +t${prefix}b;s/^[^$spacer]*/& /;t${prefix}a;:${prefix}b;s/$spacer/ /" +} + + +function sed_pad_left { + + len=$1 + spacer=$2 + prefix=_PL$3 + + # echo "t${prefix}a;:${prefix}a;s/^[^$spacer]{$len}/& /;t${prefix}a" # NOT CORRECT? +} + + +function add_notice { + + echo > $1 + cat $autogen_notice | trim_lines >> $1 + echo >> $1 + echo >> $1 +} + +function add_non_generated_content { + + file=src/$1.h + [ ! -f $file ] && return + + echo "/* Non-generated macros */" >> $2 + echo >> $2 + + cat $file | trim_lines >> $2 + + echo >> $2 + echo >> $2 +} + + +function add_action_macros { + + list_file=$actions_dir/$1 + + [ ! -f $list_file ] && return + + out=$2 + + + # alignment settings + + align1=20 + align2=35 + align3=62 + base_shrink=12 + define="#define " + + + + # base macros + + echo "/* base action macro macros */" >> $out + echo >> $out + + cat $list_file | trim_lines | sed -r \ + -e "s/^[ ]*([a-zA-Z0-9_]+)([ ]*)\(([a-zA-Z0-9_,]+)\)([ ]*)(.*)/$define%2%_\1_ac(\3,ac)\2\4 {\5;}/" \ + -e "s/[ ]{$base_shrink}\{/\{/" \ + -e 's/%A%/ac/g' \ + >> $out + + echo >> $out + echo >> $out + + + + # generated macros + + echo "/* generated action macros */" >> $out + echo >> $out + + cat -s $list_file | while read list_line; do + + [ "x`echo $list_line`" = 'x' ] && continue + + cat $types_file | while read type_line; do + + [ "x`echo $type_line`" = 'x' ] && continue + + #ext=`echo $type_line | grep -E '^[a-zA-Z0-9_]+' | cut -d " " -f1` + ext=`echo $type_line | sed -r 's/^([a-zA-Z0-9_]+).*/\1/'` + params=`echo $type_line | sed -r 's/^[a-zA-Z0-9_]+[ ]*\((.*)\).*/\1/;ta;d;:a'` + act=`echo $type_line | sed -r 's/^[a-zA-Z0-9_]+[ ]*(\(.*\))?(.*)/\2/'` + [ "x$params" != "x" ] && params=",$params" + + echo $list_line | sed -r \ + -e "s/^([a-zA-Z0-9_]+)[ ]*\(([a-zA-Z0-9_,]+)\).*/%2%_\1_$ext(\2$params)$spacer%2%_\1_ac$spacer(\2,$act)/" \ + -e 's/[ ]*,[ ]*/,/g' \ + -e "`sed_pad_right $align2 $spacer 1`" \ + -e "`sed_pad_right $align3 $spacer 2`" \ + -e "s/.*/$define&/" \ + >> $out + done + echo >> $out + done +} + + +function replace_prefixes { + + temp=.temp + + file=`cat $prefix_file` + + prefix1= + prefix2= + + for prefix in $file ; do + [ "x$prefix2" != "x" ] && echo "Too many prefixes in prefix file $prefix_file" && exit 1 + [ "x$prefix1" != "x" ] && prefix2=$prefix && continue + prefix1=$prefix + done + + sed -r "s/%1%/$prefix1/g;s/%2%/$prefix2/g" < $1 > $temp + + mv -f $temp $1 +} + + +function replace_other_strings { + + temp=.temp + + cat $reps_file | while read line; do + + rep1= + rep2= + + for rep in $line ; do + [ "x$rep2" != "x" ] && echo "Too many replacments in replacements file $reps_file" && exit 1 + [ "x$rep1" != "x" ] && rep2=$rep && continue + rep1=$rep + done + + sed -r "s/%$rep1%/$rep2/g" < $1 > $temp + mv -f $temp $1 + done +} + + +function generate_header_file { + + name=$1 + out=$output_dir/$file_prefix$name.h + + add_notice $out + add_non_generated_content $name $out + add_action_macros $name $out + replace_prefixes $out + replace_other_strings $out +} + + +function add_auto_include { + echo "#include <${file_prefix}$2>" >> $1 +} + + +function add_include { + echo "#include <${include_prefix}${file_prefix}$2>" >> $1 +} + + +function generate_non_optional_h_includes { + + # TODO : split into auto-generated and non-auto-generated ones + + echo "/* non-optional includes */" >> $1 + echo >> $1 + + for mod in `cat $headers_file | sort`; do + + add_auto_include $1 $mod.h + done + + echo >> $1 + echo >> $1 +} + + +function generate_include_all_includes { + + echo "/* include all optional modules */" >> $1 + echo >> $1 + echo "#ifdef NDK_ALL" >> $1 + echo >> $1 + + modules=`cat $optional_modules_file | sed 's/*//g' | sort` + + for mod in $modules; do + def="NDK_`strtoupper $mod`" + echo "#ifndef $def" >> $1 + echo "#define $def 1" >> $1 + echo "#endif" >> $1 + done + + echo >> $1 + echo "#endif" >> $1 + echo >> $1 + echo >> $1 +} + + +function generate_dependent_includes { + + echo "/* module dependencies */" >> $1 + echo >> $1 + + cat $module_dependencies_file | while read line; do + + first=1 + + for mod in $line; do + + def="NDK_`strtoupper $mod`" + + if [ $first = 1 ] ; then + + echo "#ifdef $def" >> $1 + first=0 + else + echo "#ifndef $def" >> $1 + echo "#define $def 1" >> $1 + echo "#endif" >> $1 + fi + done + + [ $first = 0 ] && echo "#endif" >> $1 + done + + echo >> $1 + echo >> $1 +} + + + +function generate_optional_h_includes { + + echo "/* optional includes */" >> $1 + echo >> $1 + + for mod in $modules; do + def="NDK_`strtoupper $mod`" + echo "#if ($def)" >> $1 + add_include $1 $mod.h + echo "#endif" >> $1 + done + + echo >> $1 + echo >> $1 +} + + + + + +function generate_conf_merge_macros_file { + + file=$conf_merge_filename + out_file=${file_prefix}$file + out=$output_dir/$out_file + + add_notice $out + + echo "/* conf-merge-value macros */" >> $out + echo >> $out + + cat $srcs_dir/$file | trim_lines >> $out + echo >> $out + echo >> $out + + echo "/* conf-merge-prop macros */" >> $out + echo >> $out + + echo "#define ndk_conf_merge_prop(prop,default)\\" >> $out + echo " ndk_conf_merge_value\\" >> $out + echo " (conf->prop, prev->prop, default)" >> $out + echo >> $out + + # loads macros, removes empty elements, sorts and translates to merge-prop macros + + cat $conf_macros_file | sed -r 's/^[A-Z0-9_]+[ ]*[A-Z0-9_]+[ ]*([a-z0-9_]+).*$/\1/;ta;d;:a' \ + | sort | sed -r \ + 's/(.*)/#define ndk_conf_merge_\1_prop(prop,default,...)\\\ + ndk_conf_merge_\1_value\\\ + (conf->prop, prev->prop, default,##__VA_ARGS__)\ + /' \ + >> $out + + add_auto_include $1 $file +} + + + + +function generate_conf_cmd_basic_file { + + temp=.rep + file=$conf_cmd_basic_filename + out_file=${file_prefix}$file + out=$output_dir/$out_file + + align1=35 + + # initial text + + add_notice $out + + + # add ndk bitmasks + + echo "/* conf cmd core values/bitmasks */" >> $out + echo >> $out + + + cat $conf_args_file | sort | trim_lines | sed -r \ + -e "s/^([A-Z0-9_]+)/${define}NDK_\1${spacer}NGX_\1/" \ + -e $sed_delete_empty_lines \ + -e "`sed_pad_right $align1 $spacer`" \ + >> $out + + echo >> $out + echo >> $out + + + # add additional bitmasks stored in file + + echo "/* conf cmd bitmasks */" >> $out + echo >> $out + + cat $srcs_dir/$conf_cmd_basic_filename | trim_lines >> $out + + echo >> $out + echo >> $out + + echo "/* conf cmd basic macros */" >> $out + echo >> $out + + + # build replacement string + + echo -n "s/^([A-Z0-9_]+)$/" > $temp + + cat $conf_locs_file | sed \ + -r -e 's/^([A-Z0-9_]+) *([A-Z0-9_]+).*/#define NDK_\1_CONF_\\1\(name,func,off1,off2,post)\\\\\\\ + {ngx_string (name),\\\\\\\ + NGX_CONF_\\1|NDK_\1_CONF,\\\\\\\ + func, off1, off2, post},\\\ +\\/' -e $sed_delete_empty_lines \ + >> $temp + + echo -n "/;$sed_delete_empty_lines" >> $temp + + + # apply the replacement string to the + + cat $conf_args_file | sort | trim_lines | sed -rf $temp >> $out + rm -f $temp + + add_auto_include $1 $file +} + + + +function generate_conf_cmd_extra_file { + + temp=.rep + file=$conf_cmd_extra_filename + out=$output_dir/${file_prefix}$file + + align1=35 + + # initial text + + add_notice $out + + echo "/* conf command macros */" >> $out + echo >> $out + + + # build replacement string + + echo -n 's/^([A-Z0-9_]+)[ ]*([A-Z0-9_]+)[ ]*([a-z0-9_]+).*$/' > $temp + + cat $conf_locs_file | sed \ + -r -e 's/^([A-Z0-9_]+)[ ]*([A-Z0-9_]+)[ ]*([a-zA-Z0-9_]+)/#define NDK_\1_CONF_\\1(name,p,post\)\\\\\\\ + NDK_\1_CONF_\\2\\\\\\\ + (name,\\\\\\\ + ndk_conf_set_\\3_slot,\\\\\\\ + NGX_\2_CONF_OFFSET,\\\\\\\ + offsetof (ndk_module_\3_conf_t, p),\\\\\\\ + post)\\\ +\\/' -e $sed_delete_empty_lines \ + >> $temp + + echo -n "/;$sed_delete_empty_lines" >> $temp + #echo -n ";`sed_pad_right 60 $spacer`" >> $temp + + + # apply the replacement string to the + + cat $conf_macros_file | sort | trim_lines | sed -rf $temp -e "`sed_pad_right 60 $spacer`" >> $out + rm -f $temp + + add_auto_include $1 $file +} + + + +function generate_auto_generated_h_includes { + + echo "/* auto-generated headers */" >> $1 + echo >> $1 + + for name in `cat $header_file | sort` ; do + + generate_header_file $name + add_auto_include $1 $name.h + done + + generate_conf_merge_macros_file $1 + generate_conf_cmd_basic_file $1 + generate_conf_cmd_extra_file $1 + + echo >> $1 + echo >> $1 +} + + + +function generate_optional_c_includes { + + echo "/* optional includes */" >> $1 + echo >> $1 + + modules=`cat $optional_modules_file | sed 's/*//g' | sort` + + for mod in $modules; do + def="NDK_`strtoupper "$mod"`" + echo "#if ($def)" >> $1 + add_include $1 $mod.c + echo "#endif" >> $1 + done + + echo >> $1 + echo >> $1 +} + + +function generate_commands { + + echo "/* module commands */" >> $1 + echo >> $1 + echo "static ngx_command_t ndk_http_commands[] = {" >> $1 + + cat $optional_modules_file | sort | while read line; do + + cmds=`echo "$line" | grep -E '\*'` + + [ "x$cmds" = "x" ] && continue + + mod=`echo "$line" | grep -E '^[a-zA-Z0-9_]+' | cut -d " " -f1` + up=`strtoupper $mod` + def="NDK_$up" + defcmd="NDK_${up}_CMDS" + + echo "#if ($def)" >> $1 + echo "#define $defcmd 1" >> $1 + add_include $1 $mod.h + echo "#undef $defcmd" >> $1 + echo "#endif" >> $1 + + done + + echo -e " ngx_null_command\n};" >> $1 +} + + +function generate_all_h_files { + + out=$output_dir/${file_prefix}$auto_file_name.h + + add_notice $out + + 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 +} + + +function generate_all_c_files { + + out=$output_dir/${file_prefix}$auto_file_name.c + + add_notice $out + generate_optional_c_includes $out + generate_commands $out +} + + + +function generate_all_files { + + mkdir -p $output_dir + rm -f $output_dir/* + + generate_all_h_files + generate_all_c_files +} + +generate_all_files diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_replacements b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_replacements new file mode 100644 index 0000000..f419bc3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_replacements @@ -0,0 +1,5 @@ + +OK NGX_OK +E NGX_ERROR +CE NGX_CONF_ERROR +COK NGX_CONF_OK diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_types b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_types new file mode 100644 index 0000000..284a5cb --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/action_types @@ -0,0 +1,12 @@ +r0 return 0 +r1 return 1 +r_1 return -1 +rok return %OK% +rce return %CE% +rcok return %COK% +re return %E% +rn return NULL +rse {ngx_script_error (e); return;} +sce {ngx_script_configure_error (c); return;} +g(_lb) goto _lb +ge goto error diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_args b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_args new file mode 100644 index 0000000..752b533 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_args @@ -0,0 +1,22 @@ + +TAKE1 +TAKE2 +TAKE3 +TAKE4 +TAKE5 +TAKE6 +TAKE7 +TAKE8 +TAKE12 +TAKE13 +TAKE23 +TAKE123 +TAKE1234 +1MORE +2MORE +ANY +FLAG +BLOCK +MULTI +ARGS_NUMBER + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_locs b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_locs new file mode 100644 index 0000000..f5352c3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_locs @@ -0,0 +1,25 @@ + +HTTP_MAIN HTTP_MAIN main +HTTP_SRV HTTP_SRV srv +HTTP_SIF HTTP_SRV srv +HTTP_LOC HTTP_LOC loc +HTTP_LIF HTTP_LOC loc + +HTTP_MAIN_SRV HTTP_SRV srv +HTTP_MAIN_SIF HTTP_SRV srv +HTTP_MAIN_LOC HTTP_LOC loc +HTTP_MAIN_LIF HTTP_LOC loc + +HTTP_SRV_LOC HTTP_LOC loc +HTTP_SRV_LIF HTTP_LOC loc +HTTP_SIF_LOC HTTP_LOC loc +HTTP_SIF_LIF HTTP_LOC loc + +HTTP_MAIN_SRV_LOC HTTP_LOC loc +HTTP_MAIN_SRV_LIF HTTP_LOC loc +HTTP_MAIN_SIF_LOC HTTP_LOC loc +HTTP_MAIN_SRV_SIF_LOC HTTP_LOC loc +HTTP HTTP_LOC loc +HTTP_UPS HTTP_LOC loc +HTTP_ANY HTTP_LOC loc +ANY HTTP_LOC loc diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_macros b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_macros new file mode 100644 index 0000000..f42206a --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/conf_macros @@ -0,0 +1,35 @@ + +BITMASK 1MORE bitmask +BUFS TAKE1 bufs +COMPLEX_KEYVAL TAKE2 http_complex_keyval +COMPLEX_PATH TAKE1 http_complex_path +COMPLEX_VALUE TAKE1 http_complex_value +COMPLEX_VALUE_ARRAY 1MORE http_complex_value_array +ENCODING TAKE1 encoding +ENUM TAKE1 enum +FALSE NOARGS false +FULL_PATH TAKE1 full_path +KEYVAL TAKE2 keyval +KEYVAL1 TAKE2 keyval1 +MSEC TAKE1 msec +NULL NOARGS null +NUM TAKE1 num +NUM64 TAKE1 num64 +NUM_FLAG TAKE1 num_flag +ONOFF FLAG flag +OFF TAKE1 off +PATH TAKE1 split_path +REXEX TAKE1 regex +REGEX_CL TAKE1 regex_caseless +REGEX_ARRAY 1MORE regex_array +REGEX_ARRAY_CL 1MORE regex_array_caseless +PTR NOARGS ptr +SEC TAKE1 sec +SEC_FLAG TAKE2 sec_flag +SIZE TAKE1 size +STR TAKE1 str +STR_ARRAY 1MORE str_array_multi +STR_ARRAY1 TAKE1 str_array +TRUE NOARGS true + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/contexts b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/contexts new file mode 100644 index 0000000..e7e8ff0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/contexts @@ -0,0 +1,22 @@ + +MAIN +SRV +SIF +LOC +LIF + +MAIN_SRV +MAIN_SIF +MAIN_LOC +MAIN_LIF +SRV_LOC +SRV_LIF +SIF_LOC +SIF_LIF + +MAIN_SRV_LOC +MAIN_SRV_LIF +MAIN_SIF_LOC +MAIN_SIF_LIF +ANY_MAIN + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/header_files b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/header_files new file mode 100644 index 0000000..aa0f11c --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/header_files @@ -0,0 +1,3 @@ +array +palloc + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/headers b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/headers new file mode 100644 index 0000000..7583cb9 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/headers @@ -0,0 +1,4 @@ +http_headers +log +parse +string_util diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/module_dependencies b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/module_dependencies new file mode 100644 index 0000000..a179316 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/module_dependencies @@ -0,0 +1,5 @@ +complex_path complex_value path +conf_file string +hash string +set_var rewrite +upstream_list http_create_main_conf diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/modules_optional b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/modules_optional new file mode 100644 index 0000000..bbd6ec5 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/modules_optional @@ -0,0 +1,15 @@ +buf +complex_path +complex_value +conf_file +encoding +hash +http +path +process +regex +rewrite +set_var +string +upstream_list * +uri diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/prefixes b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/prefixes new file mode 100644 index 0000000..ee53474 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/data/prefixes @@ -0,0 +1,2 @@ +ngx +ndk diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/array.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/array.h new file mode 100644 index 0000000..a583759 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/array.h @@ -0,0 +1,7 @@ + +#define %2%_array_count(a) ((a)->nelts) +#define %2%_array_get_first(a) ((a)->elts) +#define %2%_array_get_index(a,n) ((void*) ((char*) (a)->elts + (a)->size * n)) +#define %2%_array_get_last(a) ((void*) ((char*) (a)->elts + (a)->size * ((a)->nelts - 1))) +#define %2%_array_get_reverse_index(a,n) ((void*) ((char*) (a)->elts + (a)->size * ((a)->nelts - 1 - n))) +#define %2%_array_push_clean(p,a) {p = %1%_array_push (a); %2%_zerop (p);} diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_cmd_basic.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_cmd_basic.h new file mode 100644 index 0000000..38743a6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_cmd_basic.h @@ -0,0 +1,43 @@ + +/* TODO : finish this */ + +#define NDK_HTTP_MAIN_CONF NGX_HTTP_MAIN_CONF +#define NDK_HTTP_SRV_CONF NGX_HTTP_SRV_CONF +#define NDK_HTTP_SIF_CONF NGX_HTTP_SIF_CONF +#define NDK_HTTP_LOC_CONF NGX_HTTP_LOC_CONF +#define NDK_HTTP_LIF_CONF NGX_HTTP_LIF_CONF +#define NDK_HTTP_UPS_CONF NGX_HTTP_UPS_CONF +#define NDK_MAIN_CONF NGX_MAIN_CONF +#define NDK_ANY_CONF NGX_ANY_CONF + + +/* compound locations */ + +#define NDK_HTTP_MAIN_SRV_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_CONF +#define NDK_HTTP_MAIN_SIF_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_SIF_CONF +#define NDK_HTTP_MAIN_LOC_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_LOC_CONF +#define NDK_HTTP_MAIN_LIF_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_LOC_LIF_CONF + +#define NDK_HTTP_SRV_SIF_CONF NDK_HTTP_SRV_CONF|NDK_HTTP_SIF_CONF +#define NDK_HTTP_SRV_LOC_CONF NDK_HTTP_SRV_CONF|NDK_HTTP_LOC_CONF +#define NDK_HTTP_SRV_LOC_LIF_CONF NDK_HTTP_SRV_CONF|NDK_HTTP_LOC_LIF_CONF +#define NDK_HTTP_SRV_SIF_LOC_CONF NDK_HTTP_SRV_SIF_CONF|NDK_HTTP_LOC_CONF +#define NDK_HTTP_SRV_SIF_LOC_LIF_CONF NDK_HTTP_SRV_SIF_CONF|NDK_HTTP_LOC_LIF_CONF + +#define NDK_HTTP_LOC_LIF_CONF NDK_HTTP_LOC_CONF|NDK_HTTP_LIF_CONF + +#define NDK_HTTP_MAIN_SRV_LOC_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_LOC_CONF +#define NDK_HTTP_MAIN_SRV_LIF_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_LIF_CONF +#define NDK_HTTP_MAIN_SIF_LOC_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SIF_LOC_CONF +#define NDK_HTTP_MAIN_SRV_SIF_LOC_LIF_CONF NDK_HTTP_SRV_SIF_LOC_LIF_CONF|NDK_MAIN_CONF +#define NDK_HTTP_CONF NDK_HTTP_MAIN_SRV_SIF_LOC_LIF_CONF +#define NDK_HTTP_ANY_CONF NDK_HTTP_CONF|NDK_HTTP_UPS_CONF + + +/* property offsets NOTE : ngx_module_main_conf_t etc should be defined in the module's .c file before the commands */ + +#define NDK_HTTP_MAIN_CONF_PROP(p) NGX_HTTP_MAIN_CONF_OFFSET, offsetof (ndk_module_main_conf_t, p) +#define NDK_HTTP_SRV_CONF_PROP(p) NGX_HTTP_SRV_CONF_OFFSET, offsetof (ndk_module_srv_conf_t, p) +#define NDK_HTTP_LOC_CONF_PROP(p) NGX_HTTP_LOC_CONF_OFFSET, offsetof (ndk_module_loc_conf_t, p) + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_merge.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_merge.h new file mode 100644 index 0000000..1e3ba70 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/conf_merge.h @@ -0,0 +1,78 @@ + +/* TODO : check that all the main types have a corresponding merge function */ + +#define ndk_conf_merge_value ngx_conf_merge_value +#define ndk_conf_merge_off_value ngx_conf_merge_off_value +#define ndk_conf_merge_ptr_value ngx_conf_merge_ptr_value +#define ndk_conf_merge_str_value ngx_conf_merge_str_value +#define ndk_conf_merge_size_value ngx_conf_merge_size_value + + +#define ndk_conf_merge_keyval_value(conf,prev,default) \ + \ + conf = prev ? prev : default; + +#define ndk_conf_merge_str_array_value(conf,prev,val1,...) \ + \ + if (conf == NGX_CONF_UNSET_PTR) { \ + if (prev == NGX_CONF_UNSET_PTR) { \ + if (val1 == NULL) { \ + conf = NULL; \ + } else { \ + char * elts[] = {val1,##__VA_ARGS__}; \ + int n = sizeof(elts)/sizeof(char*); \ + \ + conf = ndk_str_array_create (cf->pool, elts, n); \ + \ + if (conf == NULL) \ + return NGX_CONF_ERROR; \ + } \ + } else { \ + conf = prev; \ + } \ + } + +#define ndk_conf_merge_http_complex_value_value(conf,prev,default) \ + \ + if (!conf.str.len) { \ + if (prev.str.len) { \ + conf = prev; \ + } else { \ + conf.str.data = (u_char *) default; \ + conf.str.len = sizeof (default) - 1; \ + \ + if (ndk_http_complex_value_compile (cf, &conf)) \ + return NGX_CONF_ERROR; \ + } \ + } + +#define ndk_conf_merge_http_complex_value_array_value(conf,prev,val1,...) \ + \ + if (conf == NGX_CONF_UNSET_PTR) { \ + if (prev == NGX_CONF_UNSET_PTR) { \ + if (val1 == NULL) \ + conf = NULL; \ + else { \ + char * elts[] = {val1,##__VA_ARGS__}; \ + int n = sizeof(elts)/sizeof(char*); \ + \ + conf = ndk_http_complex_value_array_create (cf, elts, n); \ + \ + if (conf == NULL) \ + return NGX_CONF_ERROR; \ + } \ + } else { \ + conf = prev; \ + } \ + } + +#define ndk_conf_merge_http_complex_path_value(conf,prev,...) \ + ndk_conf_merge_http_complex_value_array_value (conf.a, prev.a, __VA_ARGS__) + +#define ndk_conf_merge_split_path_value(conf,prev,path) \ + \ + if (conf == NGX_CONF_UNSET_PTR) { \ + conf = (prev == NGX_CONF_UNSET_PTR ? \ + ndk_split_path_create_raw (cf, path) : prev); \ + } + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/palloc.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/palloc.h new file mode 100644 index 0000000..798e360 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/src/palloc.h @@ -0,0 +1,6 @@ + +#define %2%_pallocp(p,pl) p = %1%_palloc (pl,sizeof(*p)) +#define %2%_pallocpn(p,pl,n) p = %1%_palloc (pl,sizeof(*p)*(n)) + +#define %2%_pcallocp(p,pl) p = %1%_pcalloc (pl,sizeof(*p)) +#define %2%_pcallocpn(p,pl,n) p = %1%_pcalloc (pl,sizeof(*p)*(n)) diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/text/autogen b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/text/autogen new file mode 100644 index 0000000..6a244c2 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/auto/text/autogen @@ -0,0 +1,12 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/config b/modules_deb/libnginx-mod-http-ndk-0.3.4/config new file mode 100644 index 0000000..8cb7ad0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/config @@ -0,0 +1,65 @@ + +############### +## FUNCTIONS ## +############### + +# TODO : provide information about checking versions of sed etc +# TODO : an optional patch function + +ndk_generate_files() { + echo "building Nginx Development Kit utility functions and macros ..." + + autobuild="$ngx_addon_dir/auto/build" + chmod +x $autobuild + $autobuild `pwd` $NGX_OBJS/addon/ndk || exit 1 +} + +ndk_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/' +} + +##################### +## CONFIG SETTINGS ## +##################### + +ngx_addon_name=ngx_devel_kit +ngx_objs_dirs="$ngx_addon_dir/objs $NGX_OBJS/addon/ndk" + +NDK_SRCS="$ngx_addon_dir/src/ndk.c" +NDK_DEPS="$ngx_addon_dir/src/ndk.h" +NDK_INCS="$ngx_addon_dir/src $ngx_objs_dirs" + +CORE_INCS="$CORE_INCS $ngx_objs_dirs" +HTTP_INCS="$HTTP_INCS $ngx_addon_dir/src $ngx_objs_dir" + +if test -n "$ngx_module_link"; then + ngx_module_type=HTTP + ngx_module_name="ndk_http_module" + ngx_module_srcs="$NDK_SRCS" + ngx_module_deps="$NDK_DEPS" + ngx_module_incs="$NDK_INCS" + + . auto/module +else + HTTP_MODULES="$HTTP_MODULES ndk_http_module" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $NDK_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_SRCS $NDK_DEPS" +fi + +have=NDK . auto/have + +############## +## INCLUDES ## +############## + +. $ngx_addon_dir/ngx_auto_lib_core diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/changelog b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/changelog new file mode 100644 index 0000000..93ab9b1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/changelog @@ -0,0 +1,58 @@ +libnginx-mod-http-ndk (1:0.3.4-2) unstable; urgency=medium + + * d/control: bump Standards-Version: 4.7.2, no changes + + -- Jan Mojžíš Fri, 11 Apr 2025 14:27:01 +0200 + +libnginx-mod-http-ndk (1:0.3.4-1) unstable; urgency=medium + + * New upstream version 0.3.4 + * d/{control,copyright}: update my email to "janmojzis@debian.org" + * d/copyright: bump debian/* copyright year + * d/watch: use more generic template + * d/control: bump Standards-Version: 4.7.0, no changes + * d/gbp.conf: add [pull] track-missing = True + + -- Jan Mojžíš Fri, 21 Mar 2025 08:50:27 +0100 + +libnginx-mod-http-ndk (1:0.3.3-1) unstable; urgency=medium + + * New upstream version 0.3.3 + + -- Jan Mojžíš Mon, 18 Dec 2023 16:23:15 +0100 + +libnginx-mod-http-ndk (1:0.3.2-5) unstable; urgency=medium + + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + + -- Jan Mojžíš Sat, 07 Oct 2023 15:31:27 +0200 + +libnginx-mod-http-ndk (1:0.3.2-4) unstable; urgency=medium + + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Tue, 27 Jun 2023 23:16:39 +0200 + +libnginx-mod-http-ndk (1:0.3.2-3) unstable; urgency=medium + + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/gbb.conf: switched to debian branch main (debian-branch = main) + * d/copyright: bump my copyright year + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 12:56:32 +0100 + +libnginx-mod-http-ndk (1:0.3.2-2) unstable; urgency=medium + + * d/rules: enabled NDK upstream list module NDK_UPSTREAM_LIST + * d/control: added Multi-Arch: foreign + + -- Jan Mojžíš Tue, 06 Dec 2022 17:28:22 +0100 + +libnginx-mod-http-ndk (1:0.3.2-1) experimental; urgency=medium + + * Initial release. (Closes: 1024150) + + -- Jan Mojžíš Wed, 30 Nov 2022 14:46:55 +0100 diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/control b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/control new file mode 100644 index 0000000..b5eec8e --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/control @@ -0,0 +1,47 @@ +Source: libnginx-mod-http-ndk +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jan Mojžíš , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, +Standards-Version: 4.7.2 +Homepage: https://github.com/simpl/ngx_devel_kit +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-ndk.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-ndk +Rules-Requires-Root: no + +Package: libnginx-mod-http-ndk +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: Nginx Development Kit module + The NDK is an Nginx module that is designed to extend the core functionality of + the excellent Nginx webserver in a way that can be used as a basis of other + Nginx modules. + . + It has functions and macros to deal with generic tasks that don't currently + have generic code as part of the core distribution. The NDK itself adds few + features that are seen from a user's point of view - it's just designed to help + reduce the code that Nginx module developers need to write. + +Package: libnginx-mod-http-ndk-dev +Architecture: all +Multi-Arch: foreign +Depends: libnginx-mod-http-ndk (<< ${source:Version}.1~), + libnginx-mod-http-ndk (>= ${source:Version}), + ${misc:Depends}, + ${shlibs:Depends}, +Description: Nginx Development Kit module - development files + The NDK is an Nginx module that is designed to extend the core functionality of + the excellent Nginx webserver in a way that can be used as a basis of other + Nginx modules. + . + This package provides development headers and necessary config scripts + for the Nginx development kit module, useful to develop and link third party + additions to the Debian nginx web/proxy server packages using Nginx + development kit module. + . + Development files. diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright new file mode 100644 index 0000000..50da8f9 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright @@ -0,0 +1,155 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ngx_devel_kit +Upstream-Contact: Marcus Clyne +Source: https://github.com/simpl/ngx_devel_kit + +Files: * +Copyright: 2010-2018, Marcus Clyne +License: BSD-3-clause + +Files: auto/text/* +Copyright: Marcus Clyne +License: BSD-3-clause + +Files: debian/* +Copyright: 2022, Miao Wang + 2022 - 2025, Jan Mojzis +License: BSD-3-clause + +Files: docs/patches/* +Copyright: Brian Moran - bmoran@onehub.com +License: BSD-3-clause + +Files: examples/* +Copyright: Marcus Clyne +License: BSD-3-clause + +Files: examples/http/* +Copyright: 2010-2018, Marcus Clyne +License: BSD-3-clause + +Files: examples/http/set_var/ngx_http_set_var_examples_module.c +Copyright: Marcus Clyne +License: BSD-3-clause + +Files: notes/* +Copyright: 2010, Marcus Clyne, Simpl (simpl.it) +License: BSD-3-clause + +Files: notes/CHANGES +Copyright: 2010-2018, Marcus Clyne +License: BSD-3-clause + +Files: objs/* +Copyright: Marcus Clyne +License: BSD-3-clause + +Files: objs/ndk_includes.h +Copyright: 2010-2018, Marcus Clyne +License: BSD-3-clause + +Files: patches/expose_rewrite_functions +Copyright: Marcus Clyne +License: BSD-3-clause + +Files: src/hash/* +Copyright: 1995-1998, Eric Young (eay@cryptsoft.com) +License: SSLeay + +Files: src/hash/murmurhash2.c +Copyright: Austin Appleby +License: BSD-3-clause + +Files: src/ndk.c + src/ndk.h + src/ndk_set_var.h +Copyright: Marcus Clyne +License: BSD-3-clause + +License: BSD-3-clause + All rights reserved. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the University nor the names of its contributors + may be used to endorse or promote products derived from this + software without specific prior written permission. + . + THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS + BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF + ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +License: SSLeay + This software is Copyright (c) 2022 by X. Ample. + . + This is free software, licensed under: + . + Original SSLeay License + . + Copyright (c) 1995-1998 Eric Young (eay@cryptsoft.com) All rights reserved. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + This library is free for commercial and non-commercial use as long as + the following conditions are aheared to. The following conditions + apply to all code found in this distribution, be it the RC4, RSA, + lhash, DES, etc., code; not just the SSL code. The SSL documentation + included with this distribution is covered by the same copyright terms + except that the holder is Tim Hudson (tjh@cryptsoft.com). + . + Copyright remains Eric Young’s, and as such any Copyright notices in the code + are not to be removed. If this package is used in a product, Eric Young + should be given attribution as the author of the parts of the library used. + This can be in the form of a textual message at program startup or in + documentation (online or textual) provided with the package. + . + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + . + 1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + “This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)” + The word ‘cryptographic’ can be left out if the rouines from the library + being used are not cryptographic related :-). + 4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an + acknowledgement: “This product includes software written by Tim Hudson + (tjh@cryptsoft.com)” + . + THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ‘‘AS IS’’ AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + SUCH DAMAGE. + . + The licence and distribution terms for any publically available version or + derivative of this code cannot be changed. i.e. this code cannot simply be + copied and put under another distribution licence + [including the GNU Public Licence.] diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright-scan-patterns.yml b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright-scan-patterns.yml new file mode 100644 index 0000000..044c11d --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/copyright-scan-patterns.yml @@ -0,0 +1,4 @@ +--- +ignore: + pattern: + - README_AUTO_LIB\.md diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/fix.scanned.copyright b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/fix.scanned.copyright new file mode 100644 index 0000000..b5e57b8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/fix.scanned.copyright @@ -0,0 +1 @@ +! copyright Files:"docs/patches/*" Copyright=~s/\s\(.*// diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/gbp.conf b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/gbp.conf new file mode 100644 index 0000000..97cd209 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/gbp.conf @@ -0,0 +1,12 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = True +sign-tags = True + +[import-orig] +merge-mode = replace + +[pull] +track-missing = True diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk-dev.install b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk-dev.install new file mode 100644 index 0000000..d9988f1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk-dev.install @@ -0,0 +1,5 @@ +debian/build-src/auto usr/share/nginx-ndk/src/ +debian/build-src/config usr/share/nginx-ndk/src/ +debian/build-src/ngx_auto_lib_core usr/share/nginx-ndk/src/ +debian/build-src/objs usr/share/nginx-ndk/src/ +debian/build-src/src usr/share/nginx-ndk/src/ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.install b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.install new file mode 100644 index 0000000..c7a20b4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.install @@ -0,0 +1 @@ +/usr/lib/nginx/modules/ndk_http_module.so diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.nginx b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.nginx new file mode 100644 index 0000000..ec2f484 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/libnginx-mod-http-ndk.nginx @@ -0,0 +1 @@ +mod debian/mod-http-ndk.conf 10 diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/mod-http-ndk.conf b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/mod-http-ndk.conf new file mode 100644 index 0000000..3908af6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/mod-http-ndk.conf @@ -0,0 +1 @@ +load_module modules/ndk_http_module.so; diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/rules b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/rules new file mode 100755 index 0000000..42e9c85 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/rules @@ -0,0 +1,35 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +BUILDDIR_SRC = $(CURDIR)/debian/build-src +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +objdir = $(CURDIR)/obj-$(DEB_BUILD_GNU_TYPE) + +%: + dh $@ + +override_dh_auto_configure: + dh_auto_configure --buildsystem=nginx_mod + for have in NDK_SET_VAR NDK_UPSTREAM_LIST; do \ + ( \ + echo "#ifndef $$have"; \ + echo "#define $$have 1"; \ + echo "#endif"; \ + echo; \ + ) >> $(objdir)/ngx_auto_config.h; \ + done + +override_dh_auto_build: build.src + dh_auto_build --buildsystem=nginx_mod + +build.src: + mkdir -p $(BUILDDIR_SRC) + cp -Pa $(CURDIR)/auto config ngx_auto_lib_core $(BUILDDIR_SRC)/ + for i in src objs; do \ + find $(CURDIR)/$$i -type f -name '*.h' -printf "$$i/%P\0" | tar -C $(CURDIR) --null --files-from - -c | tar -C $(BUILDDIR_SRC)/ -x; \ + done + +override_dh_clean: + rm -rf $(BUILDDIR_SRC) + dh_clean diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/source/format b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/control b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/control new file mode 100644 index 0000000..ca20b9f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/control @@ -0,0 +1,6 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/generic b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/upstream/metadata b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/upstream/metadata new file mode 100644 index 0000000..51ef420 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/simpl/ngx_devel_kit/issues +Bug-Submit: https://github.com/simpl/ngx_devel_kit/issues/new +Repository-Browse: https://github.com/simpl/ngx_devel_kit \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/watch b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/watch new file mode 100644 index 0000000..e0b5b75 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/simpl/ngx_devel_kit/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/action_macros b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/action_macros new file mode 100644 index 0000000..802eb1f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/action_macros @@ -0,0 +1,63 @@ + + GENERAL NOTES + ------------- + + These functions and macros have been provided as a tool for Nginx module developers. They have + been created with four main purposes: + + - to speed up code-writing + - to reduce the code you have to read on file + - to add additional generic functionality similar to exising Nginx functions + - to reduce code errors + + Most of the utility macros are just wrappers around commonly used code, especially checking for + NULL and returning a value, zeroing data etc. The functions add things like extra conf_set_X_slot + functions that don't exist in the standard Nginx distribution, but which might be useful in more + than one module. + + A consistent approach has been taken to creating the macros, so that in theory you should be able + to 'know' the macro name from using the few rules below and your knowledge of the existing Nginx + functions. As much as possible, the ordering of variables used within the underlying functions + remain the same, to reduce the learning time. Also, a constent naming pattern has been used to + make it easier to read the macros above. + + Obviously not all programmers will want to use all or any of these macros, but they are provided + as a tool for those who wish to use them. + + If you have any comments about them, including any additions or errors please let me know at + 'eugaia at gmail dot com'. I don't promise to include all additions people send, but if they seem + like they could be of use to multiple developers, I will. + + + UTILITY MACRO PARAMS + -------------------- + p pointer - used to set the result of a function to a pointer + a array + pl pool + n multiplication factor - for allocating multiple pointers & pushing 'n' elts in arrays etc + sz size + l log + rv return value + + + + UTILITY MACRO FUNCTION SUFFIXES + ------------------------------- + + - general + + p p = [FUNCTION] () + _r [ if result of function is NULL | NGX_ERROR (as appropriate) ] return rv + _rce rv = NGX_CONF_ERROR + _re rv = NGX_ERROR + _rn rv = NULL + + - (p)(c)alloc functions + + p p = [function] (pool, sizeof (*p)) + pn p = [function] (pool, sizeof (*p) * n) + + + UTILITY MACRO PARAMS ORDER + -------------------------- + p, pl|a, sz|n, l, rv diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/conf_cmds b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/conf_cmds new file mode 100644 index 0000000..70978b1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/core/conf_cmds @@ -0,0 +1,62 @@ + +Conf command macros +------------------- + +The build script generates a large number of macros for reducing the code required for command +definitions. + +There are basically three types of macros : + +- combination bitmasks + + e.g. NDK_HTTP_MAIN_SRV_CONF = (NGX_HTTP_MAIN_CONF | NGX_HTTP_SRV_CONF) + +- base command structures + + e.g. NDK_HTTP_MAIN_CONF_TAKE1 + +- conf-set command structures + + e.g. NDK_HTTP_CONF_STR + + +Combination bitmasks +-------------------- + +Basically combinations of existing bitmasks for locations, with general > specific order + +NDK_HTTP_CONF = (NGX_HTTP_MAIN_CONF | NGX_HTTP_SVR_CONF | NGX_HTTP_SIF_CONF | NGX_HTTP_LOC_CONF | NGX_HTTP_LIF_CONF) + + +Base command structures +----------------------- + +These macros are basically there as wrappers for the conf-set command structures, and but incorporate +the bitmask element into the name of the macro. + + +Conf-set command structures +--------------------------- + +These macros simplify creating commands that use any of the build-in conf-set functions or any of those +added by the NDK. + +e.g. NGX_HTTP_MAIN_SRV_STR ("name", prop, NULL) + +where prop is the name of the property that is a ngx_str_t. Whether this is in the loc conf, main conf +or svr conf is generated automatically in by the macro. + +NOTE : you need to set the following if they will be used (using macro definitions) : + +ndk_module_main_conf_t +ndk_module_srv_conf_t +ndk_module_loc_conf_t + +e.g + +#define ndk_module_loc_conf_t ngx_http_my_module_loc_conf_t + + +TODO +---- +Much better documentation for this diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/modules/set_var b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/modules/set_var new file mode 100644 index 0000000..6be5c0f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/modules/set_var @@ -0,0 +1,124 @@ + +set var tools +============= + +OVERVIEW +-------- +This collection of tools is designed to make it easier to set Nginx variables +using a common interface. It works by plugging into and extending the features +of the internal rewrite module, and operations performed by this module are +therefore done at the rewrite phase of handling. + + +ADVANTAGES OF USING THIS MODULE +------------------------------- + +- simple interface - you don't have to worry about lots of http script compiling +- it plugs into the rewrite module, so setting (and getting) vars will happen + in the order you expect based on how they appear in the configuration file +- you do not have to worry about overriding the v->get_handler (useful if + a variable of a specific name could be set in multiple different ways) + + +WHEN TO USE THIS AND WHEN TO USE v->get_handler = my_func +--------------------------------------------------------- + +- if you want a variable to always be generated using a specific function, + and should not be over-ridden by 'set' functions (e.g. $request_uri, + $document_root), then you should use v->get_handler + +- if you want to allow a variable to be set using many possible methods, + including using the 'set' directive, then this module provides an easy way + for you to do so (if you use the v->get_handler method in this case, you may + run into problems because the get_handler may over-ride previous uses of the + set directive) + + +USAGE +----- + +- decide on the type of function you'll need to write + + type use when there are these requirements + ---- ------------------------------------- + NDK_SET_VAR_BASIC 0 variable values, no extra data + NDK_SET_VAR_DATA 0 variable values, extra data + NDK_SET_VAR_VALUE 1 variable value, no extra data + NDK_SET_VAR_VALUE_DATA 1 variable value, extra data + NDK_SET_VAR_MULTI_VALUE 2+ variable values, no extra data + NDK_SET_VAR_MULTI_VALUE_DATA 2+ variable values, extra data + NDK_SET_VAR_HASH the space needed for the result string + value is known in advance (usually + used in a hash function) + + NOTE : if none of these generic calling types suit your needs, it is + easy to extend the list of types in the .c file (and you if you let me know + I'll add them to the list + + +- define the filter function with the respective prototype + + type prototype + ---- --------- + NDK_SET_VAR_BASIC ndk_set_var_pt + NDK_SET_VAR_DATA ndk_set_var_data_pt + NDK_SET_VAR_VALUE ndk_set_var_value_pt + NDK_SET_VAR_DATA_VALUE ndk_set_var_value_data_pt + NDK_SET_VAR_MULTI_VALUE ndk_set_var_value_pt + NDK_SET_VAR_MULTI_VALUE_DATA ndk_set_var_value_data_pt + NDK_SET_VAR_HASH ndk_set_var_hash_pt + + (See ngx_tools_module.h for the prototype definitions.) + + Note : For the multi_value functions, the variable value pointer is to the + first value (with the others being in an array following it) + + +to use one of the default setup functions +----------------------------------------- + +- define one or multiple ngx_http_var_filter_t's at the global scope, setting : + + type = (one of types above) + func = function to call + size = (for multi value) the number of variable values + (for hash) length of buffer to allocate + data = (for data functions) additional data (see note below) + +- define a configuration directive (see in the .c file for examples), where the + function is 'ngx_http_set_var' and the 'post' is a pointer your filter definition + + +to setup in a customized way +---------------------------- + +- define a configuration directive which has your own specific configuration function + +- inside your config function, define one or several ngx_http_var_filter_t's like + above, and call one of the ngx_http_set_var_..._core functions, passing the + variable name and value pointers as appropriate - see examples section + +Note : if you're passing extra data to the function, then you will probably want +to use this second method and store the data either in the loc conf, or just +allocate the space for it using one of the ngx_palloc functions. + +If the values that will be used for processing are in the same order as in the +config file and there aren't any additional values that are input, then you can +just use the (ngx_str_t *) (cf->args->elts) + 1 as your base for the values or +possibly not use the _core versions of the functions. + + +That's it! + + +FEEDBACK +-------- + +If you have any comments (good/bad), or have found any bugs, please let me know at: +ngx.eugaia AT gmail DOT com + + +TODO +---- +- add more documentation/examples + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/patches/more_logging_info b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/patches/more_logging_info new file mode 100644 index 0000000..3685916 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/patches/more_logging_info @@ -0,0 +1,48 @@ +When tracking down some potential issues in the nginx constellation, +we've found it useful to understand where particular error messages +are coming from, since many of the same messages are repeated in +various places. This patch will write the source file from which the +message originated, the function name, and the line number if you're +using GCC to compile nginx. Here's an example: + +Old Output: +2010/01/12 14:43:10 [notice] 67772#0: nginx/0.7.64 +2010/01/12 14:43:10 [notice] 67772#0: built by gcc 4.0.1 (Apple Inc. build 5490) +2010/01/12 14:43:10 [notice] 67772#0: OS: Darwin 9.8.0 +2010/01/12 14:43:10 [notice] 67772#0: hw.ncpu: 2 +2010/01/12 14:43:10 [notice] 67772#0: net.inet.tcp.sendspace: 65536 +2010/01/12 14:43:10 [notice] 67772#0: kern.ipc.somaxconn: 128 +2010/01/12 14:43:10 [notice] 67772#0: getrlimit(RLIMIT_NOFILE): +256:9223372036854775807 +2010/01/12 14:43:10 [notice] 67772#0: start worker processes +2010/01/12 14:43:10 [notice] 67772#0: start worker process 67785 +2010/01/12 14:43:16 [notice] 67772#0: signal 20 (SIGCHLD) received + +New Output: +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_posix_init.c +ngx_os_status( 80) nginx/0.7.64 +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_posix_init.c +ngx_os_status( 83) built by gcc 4.0.1 (Apple Inc. build 5490) +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_darwin_init.c +ngx_os_specific_status( 153) OS: Darwin 9.8.0 +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_darwin_init.c +ngx_os_specific_status( 166) hw.ncpu: 2 +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_darwin_init.c +ngx_os_specific_status( 166) net.inet.tcp.sendspace: 65536 +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_darwin_init.c +ngx_os_specific_status( 166) kern.ipc.somaxconn: 128 +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_posix_init.c +ngx_os_status( 92) getrlimit(RLIMIT_NOFILE): +2560:9223372036854775807 +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_process_cycle.c +ngx_start_worker_processes( 337) start worker processes +2010/01/14 16:35:09 [notice] 27241#0: src/os/unix/ngx_process.c +ngx_spawn_process( 201) start worker process 27254 +2010/01/14 16:35:14 [notice] 27241#0: src/os/unix/ngx_process.c +ngx_signal_handler( 420) signal 20 (SIGCHLD) received + +Formatting the filename and function name fields into fixed-width +fields would be nicer, however that would require further changes in +src/core/ngx_string.c + +(C) Brian Moran - bmoran@onehub.com (posted to nginx-devel mailing list on 15/01/10) diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/upstream/list b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/upstream/list new file mode 100644 index 0000000..3ad485d --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/docs/upstream/list @@ -0,0 +1,45 @@ + +NDK_UPSTREAM_LIST +----------------- + +This submodule provides a directive that creates a list of upstreams, with +optional weighting. This list can then be used by other modules to hash over +the upstreams however they choose. + + +USAGE IN CONF FILE +------------------ + +e.g. upstream_list name backend1 4:backend2 3:backend3; + + + +USAGE WITH OTHER MODULES +------------------------ + +Add a line like + +CFLAGS="$CFLAGS -DNDK_UPSTREAM_LIST" + +to the config file of your module. + + + +INTEGRATING WITH YOUR MODULE +---------------------------- + +The upstream lists are stored in the array given in the lists.h file, which is +an array of ndk_upstream_list_t elts. The elts are currently all pointers to +strings which have been distributed according to the weight - so if there are +two backends, with weight 3 and 4 respectively, there will be 7 pointers in +total with the first 3 pointing to the first backend and the last 4 to the +second. + + + +TODO +---- +- replace strings with pointers to upstreams if they are available (and if + this is possible) +- add additional 'http://' to strings if necessary +- improve this documentation diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/README b/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/README new file mode 100644 index 0000000..22e2417 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/README @@ -0,0 +1,12 @@ + +2010 (C) Marcus Clyne + + +Examples +-------- + +In this section there are a number of examples of the various features of the tools +module. These have been given in the form of dummy modules, to make it easier to +use as templates for your own module should you choose to do so. + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/config b/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/config new file mode 100644 index 0000000..aa58f77 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/config @@ -0,0 +1,4 @@ +ngx_addon_name=ngx_http_set_var_examples_module +HTTP_MODULES="$HTTP_MODULES ngx_http_set_var_examples_module" +NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_addon_dir/ngx_http_set_var_examples_module.c" +have=NDK_SET_VAR . auto/have \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/ngx_http_set_var_examples_module.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/ngx_http_set_var_examples_module.c new file mode 100644 index 0000000..7a4daae --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/examples/http/set_var/ngx_http_set_var_examples_module.c @@ -0,0 +1,136 @@ + +/* + * 2010 (C) Marcus Clyne + */ + + +#include + + +static ngx_int_t ngx_http_set_var_concat2 (ngx_http_request_t *r, ngx_str_t *val, ngx_http_variable_value_t *v); +static char * ngx_http_set_prepend_hello (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + + +static ndk_set_var_t ngx_http_var_set_concat2 = { + NDK_SET_VAR_MULTI_VALUE, + ngx_http_set_var_concat2, + 2, + NULL +}; + + +static ngx_command_t ngx_http_set_var_examples_commands[] = { + { + ngx_string ("set_concat2"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3, + ndk_set_var_multi_value, + 0, + 0, + &ngx_http_var_set_concat2 + }, + { + ngx_string ("set_prepend_hello"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, + ngx_http_set_prepend_hello, + 0, + 0, + NULL + }, + ngx_null_command +}; + + +ngx_http_module_t ngx_http_set_var_examples_module_ctx = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +ngx_module_t ngx_http_set_var_examples_module = { + + NGX_MODULE_V1, + &ngx_http_set_var_examples_module_ctx, // module context + ngx_http_set_var_examples_commands, // module directives + NGX_HTTP_MODULE, // module type + NULL, // init master + NULL, // init module + NULL, // init process + NULL, // init thread + NULL, // exit thread + NULL, // exit process + NULL, // exit master + NGX_MODULE_V1_PADDING +}; + + +/* + This function is called by both examples, takes two variable values and concatenates them + to give a third string. +*/ + +static ngx_int_t +ngx_http_set_var_concat2 (ngx_http_request_t *r, ngx_str_t *val, ngx_http_variable_value_t *v) +{ + size_t len; + ngx_http_variable_value_t *v2; + u_char *p; + + v2 = v + 1; + + len = v->len + v2->len; + + /* + * NDK provided abbreviation for the following code: + * + * p = ngx_palloc (r->pool, len); + * if (p == NULL) + * return NGX_ERROR; + * + * */ + ndk_palloc_re(p, r->pool, len); + + val->data = p; + val->len = len; + + ngx_memzero (p, len); + + p = ngx_cpymem (p, v->data, v->len); + ngx_memcpy (p, v2->data, v2->len); + + return NGX_OK; +} + + + +/* + This function demonstrates using the 'core' function in a function that appends the word + 'hello_' to the beginning of a variable. + + set $var world; + set_prepend_hello $var $var; + + If the arguments used in the variable value filter do not all come directly from the conf + file, or are not given in the order + + direcive $var_name val1 "val2 string $var" ... + + then the _core functions should be used inside the function that is called when the directive + is read. +*/ + +static char * +ngx_http_set_prepend_hello (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t s[2], *var_name; + ndk_set_var_t filter; + + var_name = cf->args->elts; + var_name++; + + s[0].data = (u_char*) "hello_"; + s[0].len = 6; + + s[1] = *(var_name + 1); + + filter.type = NDK_SET_VAR_MULTI_VALUE; + filter.func = ngx_http_set_var_concat2; + filter.size = 2; + + return ndk_set_var_multi_value_core (cf, var_name, (ngx_str_t *) s, &filter); +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/ngx_auto_lib_core b/modules_deb/libnginx-mod-http-ndk-0.3.4/ngx_auto_lib_core new file mode 100644 index 0000000..d5441fb --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/ngx_auto_lib_core @@ -0,0 +1,797 @@ + +## Directories to search for usable builds: +## +## - [$PFX]_INC and [$PFX]_LIB +## - the dir specified by --with-[$pfx]=* +## - each dir named [$pfx]-* under [$PFX]_BASE (descending order) +## - each dir named [$pfx]-* under $ngx_src_dir/.. (descending order) +## - system_paths (see below) +## +## Note : specifying [$PFX]_INC or [$PFX]_LIB prevents other dirs being tried +## specifying --with-[$pfx]= prevents autodiscovery of dirs +## +## Note : if this file is not in the same directory as the config file, the value +## for ngx_auto_lib_file should be changed to a relative path from that file +## e.g. : $ngx_addon_dir/libs/ngx_auto_lib +## +## TODO : explain hooks + +############# +## VERSION ## +############# + +ngx_auto_lib_version=1001 + +if [ ! $ngx_auto_lib_file_version ] || [ $ngx_auto_lib_file_version -lt $ngx_auto_lib_version ]; 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" +fi + +############### +## VARIABLES ## +############### + +v= +v="$v inc_path" +v="$v incs" +v="$v libs" +v="$v name" +v="$v path" +v="$v run" +v="$v test" +ev= +ev="$ev add_libs" +ev="$ev add_path" +ev="$ev build_dirs" +ev="$ev build_inc_dirs" +ev="$ev build_lib_dirs" +ev="$ev check_macros_defined" +ev="$ev check_macros_non_zero" +ev="$ev defines" +ev="$ev deps" +ev="$ev exit_if_not_found" +ev="$ev haves" +ev="$ev inc_names" +ev="$ev lib_files" +ev="$ev lib_names" +ev="$ev libs_to_add" +ev="$ev modules" +ev="$ev srcs" +ev="$ev shared" +ev="$ev test_libs" +ev="$ev variables" + +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' + +#################### +## UTIL FUNCTIONS ## +#################### + +to_upper() { + echo "$@" | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' +} + +to_lower() { + echo "$@" | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' +} + +#################### +## INIT FUNCTIONS ## +#################### + +ngx_auto_lib_init() { + + . $ngx_auto_lib_file + + ngx_auto_lib_init_latest $@ +} + +ngx_auto_lib_init_latest() { + + # set name and prefixes + + if [ ! $1 ]; then + echo "ngx_auto_lib_init() requires that a name be passed" + exit 1 + fi + + ngx_auto_lib_name=$1 + ngx_auto_lib_module_name=$2 + + if [ $2 ]; then + NGX_AUTO_LIB_PFX=`to_upper $2` + else + NGX_AUTO_LIB_PFX=`to_upper $1` + fi + + ngx_auto_lib_pfx=`to_lower $NGX_AUTO_LIB_PFX` + + ngx_auto_lib_clean_feature_vars +} + +ngx_auto_lib_clean_feature_vars() { + for var in $ngx_feature_all_vars; do + eval ngx_feature_$var= + done +} + +ngx_auto_lib_get_variables() { + + local pfx=$ngx_auto_lib_pfx + local PFX=$NGX_AUTO_LIB_PFX + + eval NGX_AUTO_LIB_INC=\"\$${PFX}_INC\" + eval NGX_AUTO_LIB_LIB=\"\$${PFX}_LIB\" + eval NGX_AUTO_LIB_DIR=\"\$${PFX}\" + eval NGX_AUTO_LIB_BASE=\"\$${PFX}_BASE\" + eval NGX_AUTO_LIB_SEARCH_LIB_INC=\"\$${PFX}_SEARCH_LIB_INC\" + eval NGX_AUTO_LIB_SEARCH_DIR=\"\$${PFX}_SEARCH_DIR\" + eval NGX_AUTO_LIB_SEARCH_BASE=\"\$${PFX}_SEARCH_BASE\" + eval NGX_AUTO_LIB_SEARCH_BASE_PREFIX=\"\$${PFX}_SEARCH_BASE_PREFIX\" + eval NGX_AUTO_LIB_SEARCH_PARENT=\"\$${PFX}_SEARCH_PARENT\" + eval NGX_AUTO_LIB_SEARCH_SYSTEM=\"\$${PFX}_SEARCH_SYSTEM\" + eval NGX_AUTO_LIB_SHARED=\"\$${PFX}_SHARED\" + eval NGX_AUTO_LIB_SYSTEM_DIRS=\"\$${PFX}_SYSTEM_DIR\" + eval USE_NGX_AUTO_LIB=\"\$USE_${LIB}\" + + if [ ! "$NGX_AUTO_LIB_DIR" ]; then + NGX_AUTO_LIB_DIR=NONE + fi + + 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 + else + USE_NGX_AUTO_LIB=YES + fi + fi + + 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 [ ! "$NGX_AUTO_LIB_SHARED" ]; then + if [ "$ngx_feature_shared" = no ]; then + NGX_AUTO_LIB_SHARED=NO + else + NGX_AUTO_LIB_SHARED=YES + fi + fi + + NGX_AUTO_LIB_SEARCH_DEP=NO + + # set default search methods + # Note : these can be over-ridden by setting NGX_AUTO_LIB_SEARCH_[type]=YES|NO + + local auto=y + + 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 + ngx_auto_lib_search DIR YES + auto=n + fi + + if [ "$NGX_AUTO_LIB_BASE" ]; then + ngx_auto_lib_search BASE YES + auto=n + fi + + if [ $auto = y ]; then + ngx_auto_lib_search PARENT YES + ngx_auto_lib_search SYSTEM YES + fi + + ngx_auto_lib_search LIB_INC NO + ngx_auto_lib_search DIR NO + ngx_auto_lib_search BASE NO + ngx_auto_lib_search PARENT NO + ngx_auto_lib_search SYSTEM NO + + if [ ! "$ngx_feature_lib_names" ]; then + ngx_feature_lib_names=$pfx + fi + + if [ ! "$ngx_feature_inc_names" ]; then + ngx_feature_inc_names=$ngx_feature_lib_names + fi + + if [ ! "$ngx_feature_exit_if_not_found" ]; then + ngx_feature_exit_if_not_found=yes + fi +} + +####################### +## DEFAULT FUNCTIONS ## +####################### + +ngx_auto_lib_set_default() { + + local suffix= + if [ $1 ]; then + suffix="_$1" + fi + + local def=$2 + local var="NGX_AUTO_LIB$suffix" + + val= + if [ ! `eval echo '$'$var` ]; then + eval $var=\"$def\" + fi + + #eval echo "$var = \$$var" +} + +ngx_auto_lib_search() { + ngx_auto_lib_set_default "SEARCH_$1" $2 +} + +#################### +## SAVE FUNCTIONS ## +#################### + +ngx_auto_lib_save_vars() { + OLD_CORE_DEPS=$CORE_DEPS + OLD_CORE_INCS=$CORE_INCS + OLD_CORE_LIBS=$CORE_LIBS + OLD_CORE_SRCS=$CORE_SRCS + OLD_LINK_DEPS=$LINK_DEPS + + CORE_DEPS= + CORE_INCS= + CORE_LIBS= + CORE_SRCS= + LINK_DEPS= +} + +ngx_auto_lib_reset_vars() { + CORE_DEPS=$OLD_CORE_DEPS + CORE_INCS=$OLD_CORE_INCS + CORE_LIBS=$OLD_CORE_LIBS + CORE_SRCS=$OLD_CORE_SRCS + LINK_DEPS=$OLD_LINK_DEPS +} + +ngx_auto_lib_save_feature_vars() { + for var in $ngx_feature_all_vars; do + eval main_ngx_feature_$var=\"\$ngx_feature_$var\" + done +} + +ngx_auto_lib_reset_feature_vars() { + for var in $ngx_feature_all_vars; do + eval ngx_feature_$var=\"\$main_ngx_feature_$var\" + done +} + +######################## +## CHECKING FUNCTIONS ## +######################## + +ngx_auto_lib_check_auto_config() { + + ngx_auto_lib_save_feature_vars + ngx_auto_lib_clean_feature_vars + + ngx_feature=$1 + ngx_feature_inc_path="`echo $CFLAGS | tr ' ' '\n' | grep -- -D | tr '\n' ' '`" + ngx_feature_incs="#include <$NGX_AUTO_CONFIG_H>" + ngx_feature_libs= + ngx_feature_path=`pwd` + ngx_feature_run=no + ngx_feature_test=$2 + + #ngx_auto_lib_print_feature_vars + + . auto/feature + + if [ $ngx_found = yes ]; then + rv=0 + else + rv=1 + fi + + ngx_auto_lib_reset_feature_vars + + return $rv +} + +ngx_auto_lib_check_macro_defined() { + + for m in $@; do + ngx_auto_lib_check_auto_config "$m" " + #ifndef $m + rubbish + #endif" && return 0 + done + + return 1 +} + +ngx_auto_lib_check_macro_non_zero() { + + for m in $@; do + ngx_auto_lib_check_auto_config "$m" " + #if !($m) + rubbish + #endif" && return 0 + done + + return 1 +} + +ngx_auto_lib_check_require() { + + if [ $USE_NGX_AUTO_LIB = YES ]; then + return 0 + elif [ $USE_NGX_AUTO_LIB = NO ]; then + return 1 + fi + + + # check if the libraries are required elsewhere + + for l in $ngx_feature_lib_names; do + [ ! "`echo $CORE_LIBS $ADDON_LIBS | grep -w -- -l$l`" ] && return 0 + done + + + + # check that any required macros are set + + local d=$ngx_feature_check_macros_defined + local nz=$ngx_feature_check_macros_non_zero + + if [ "$d" ] || [ "$nz" ]; then + + ngx_auto_lib_check_macro_defined $d && return 0 + ngx_auto_lib_check_macro_non_zero $nz && return 0 + fi + + + ngx_auto_lib_check +} + +ngx_auto_lib_check() { + return 1 +} + +################################## +## TEST PHASE HANDLER FUNCTIONS ## +################################## + +ngx_auto_lib_test() { + ngx_auto_lib_test_pre_setup "$@" + ngx_auto_lib_test_setup "$@" + ngx_auto_lib_test_post_setup "$@" + ngx_auto_lib_test_feature +} + +ngx_auto_lib_test_pre_setup() { + return 0 +} + +ngx_auto_lib_test_setup() { + + local INC=$1 + local LIB=$2 + + ngx_auto_lib_inc_dir=$INC + ngx_auto_lib_lib_dir=$LIB + + ngx_auto_lib_reset_feature_vars + + if [ ! "$ngx_feature_path" ]; then + ngx_feature_path="$INC" + fi + + ngx_feature_path="$ngx_feature_path $ngx_feature_add_path" + + for sfx in $ngx_feature_path_suffixes; do + ngx_feature_path="$ngx_feature_path $INC/$sfx" + done + + + local inc= + local lib= + 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>" + done + + + if [ ! "$ngx_feature_libs" ]; then + + if [ $NGX_AUTO_LIB_SHARED = YES ]; then + if [ $NGX_RPATH = YES ]; then + ngx_feature_libs="-R$LIB" + fi + ngx_feature_libs="$ngx_feature_libs -L$LIB" + + for lib in $libs; do + ngx_feature_libs="$ngx_feature_libs -l$lib" + done + + # TODO : only add --rpath when the path is not a standard system path - warn if /usr + + ngx_feature_libs="$ngx_feature_libs -Wl,--rpath -Wl,$LIB" + + else + + for lib in $lib_files; do + ngx_feature_libs="$ngx_feature_libs $LIB/$lib" + done + + for lib in $libs; do + ngx_feature_libs="$ngx_feature_libs $LIB/lib$lib.a" + done + fi + fi + + if [ ! $ngx_feature_run ]; then + ngx_feature_run=no + fi + + if [ $NGX_AUTO_LIB_SHARED = YES ]; then + + # Add a test to be called in auto/feature after compilation that will check + # whether any libraries that are linked are in fact using the path provided to + # link libraries rather than a standard path. Note : this test will work on + # all linked shared objects, even if supplied directly by setting + # $ngx_feature_libs instead of usign $ngx_feature_lib_names + + # TODO : allow for some libraries to not be checked here if desired - if part of system paths + + libs="`echo $ngx_feature_libs | tr ' ' '\n' | grep -- -l | sed 's|-l||g'`" + + local test=" + for l in $libs; do + o="'\`ldd '$NGX_AUTOTEST' | grep '$LIB'/lib\$l\\.so\`; + if [ ! \"\$o\" ]; then + chmod -x $NGX_AUTOTEST; + echo Linker does not link to correct version + else + chmod +x $NGX_AUTOTEST; + fi + done' + test="`echo "$test" | tr '\n' ' '`" + + ngx_feature_test_libs="$ngx_feature_test_libs; $test" + fi + + ngx_feature_libs="$ngx_feature_libs $ngx_feature_add_libs" + ngx_feature_libs_to_add="$ngx_feature_libs" + ngx_feature_libs="$ngx_feature_libs $ngx_feature_test_libs" + ngx_feature="$ngx_auto_lib_name library $ngx_feature" +} + +ngx_auto_lib_test_post_setup() { + return 0 +} + +ngx_auto_lib_test_feature() { + #ngx_auto_lib_print_feature_vars + . auto/feature + [ $ngx_found = yes ] && return 0 + return 1 +} + +######################## +## TEST DIR FUNCTIONS ## +######################## + +ngx_auto_lib_test_dir_pair() { + ngx_auto_lib_test_inc_dir=$1 + ngx_auto_lib_test_lib_dir=$2 + + if [ $1 = $2 ]; then + ngx_feature="in $1$3" + else + ngx_feature="in $1 and $2$3" + fi + ngx_auto_lib_test "$1" "$2" "$3" +} + +ngx_auto_lib_test_dir_pairs() { + ngx_auto_lib_test_dir_pair "$1/include" "$2/lib" "$3" && return 0 + ngx_auto_lib_test_dir_pair "$1" "$2" "$3" && return 0 + return 1 +} + +ngx_auto_lib_test_dirs() { + + local msg="$1" + local bdir idir ldir + + local bdirs=$ngx_feature_build_dirs + local idirs=$ngx_feature_build_inc_dirs + local ldirs=$ngx_feature_build_lib_dirs + + shift + + for dir in "$@"; do + ngx_auto_lib_test_dir=$dir + + for ldir in $ldirs; do + for idir in $idirs; do + ngx_auto_lib_test_dir_pair "$dir/$idir" "$dir/$ldir" "$msg" && return 0 + done + done + + for ldir in $ldirs; do + ngx_auto_lib_test_dir_pair "$dir" "$dir/$ldir" "$msg" && return 0 + done + + for idir in $idirs; do + ngx_auto_lib_test_dir_pair "$dir/$idir" "$dir" "$msg" && return 0 + done + + for bdir in $bdirs; do + ngx_auto_lib_test_dir_pairs "$dir/$bdir" "$dir/$bdir" "$msg" && return 0 + done + + ngx_auto_lib_test_dir_pairs "$dir" "$dir" "$msg" && return 0 + ngx_auto_lib_test_dir= + done + + return 1 +} + +ngx_auto_lib_test_install_dirs() { + + local msg="$1" + local dir= + + shift + + for dir in "$@"; do + ngx_auto_lib_test_dir=$dir + ngx_auto_lib_test_dir_pair "$dir/include" "$dir/lib" "$msg" && return 0 + ngx_auto_lib_test_dir= + done + + return 1 +} + +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" + + + ngx_found=no + + + # dependency + + if [ $NGX_AUTO_LIB_SEARCH_DEP = YES ]; then + ngx_auto_lib_test_dir_pair "$INC" "$LIB" "$MSG" + return $? + fi + + + # lib and include dirs set explicitly (e.g. $OPENSSL_INC, $OPENSSL_LIB) + + if [ $NGX_AUTO_LIB_SEARCH_LIB_INC = YES ]; then + ngx_auto_lib_test_dir_pair "$INC" "$LIB" " (specified by \$${PFX}_INC and \$${PFX}_LIB)" && return 0 + fi + + + # 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 + + if [ $NGX_AUTO_LIB_SEARCH_DIR = YES ] && [ $DIR != NONE ]; then + ngx_auto_lib_test_dirs " (specified by \$${PFX})" $DIR && return 0 + fi + + + # directories beginning with '$pfx-' that are in $NGX_AUTO_LIB_BASE (e.g. $OPENSSL_BASE) + + if [ $NGX_AUTO_LIB_SEARCH_BASE = YES ] && [ $BASE ]; then + + p=$NGX_AUTO_LIB_SEARCH_BASE_PREFIX + + if [ "$p" = YES ]; then + p="!ame $pfx-*" + elif [ "$p" ]; then + p="!ame $p*" + fi + + ngx_auto_lib_test_dirs " (found under \$${PFX}_BASE)" \ + `find $BASE/* -maxdepth 0 -type d $p 2> /dev/null | sort -r` && return 0 + fi + + + # directories beginning with '$pfx-' that are in the same directory as the Nginx source + + 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 !ame $pfx-* 2> /dev/null | sort -r` && return 0 + fi + + + # system folders + + if [ $NGX_AUTO_LIB_SEARCH_SYSTEM = YES ]; then + ngx_auto_lib_test_install_dirs "" $NGX_AUTO_LIB_SYSTEM_DIRS && return 0 + fi + + return 1 +} + +####################### +## HANDLER FUNCTIONS ## +####################### + +ngx_auto_lib_run() { + ngx_auto_lib_get_variables + eval AUTO_$NGX_AUTO_LIB_PFX=NO + + ngx_auto_lib_check_require || return + ngx_auto_lib_setup || return + ngx_auto_lib_save_feature_vars + ngx_auto_lib_run_tests + ngx_auto_lib_post_tests || return + ngx_auto_lib_finalize +} + +ngx_auto_lib_print_feature_vars() { + echo ---------------------------- + for var in $ngx_feature_vars; do + eval "echo ngx_feature_$var = \$ngx_feature_$var" + done + echo ---------------------------- +} + +ngx_auto_lib_setup() { + return 0 +} + +ngx_auto_lib_post_tests() { + return 0 +} + +############################# +## SET VARIABLES FUNCTIONS ## +############################# + +# TODO : add HTTP/ADDON settings too + +ngx_auto_lib_set_core_variables() { + # TODO : don't add includes / libs more than once + + eval CORE_DEPS=\"$CORE_DEPS $ngx_feature_deps\" + eval CORE_INCS=\"$CORE_INCS $ngx_feature_path\" + eval CORE_LIBS=\"$CORE_LIBS $ngx_feature_libs_to_add\" + eval CORE_SRCS=\"$CORE_SRCS $ngx_feature_srcs\" +} + +ngx_auto_lib_set_generic_variables() { + local INC=$ngx_auto_lib_test_inc_dir + local LIB=$ngx_auto_lib_test_lib_dir + + modules="$modules $ngx_feature_modules" + + for have in $ngx_feature_haves; do + . auto/have + done + + set - $ngx_feature_defines + + while [ $1 ]; do + have=$1 + value=$2 + . auto/define + done + + local PFX=$NGX_AUTO_LIB_PFX + + eval USE_$PFX=NO + + if [ $ngx_auto_lib_test_dir ]; then + eval $PFX=$ngx_auto_lib_test_dir + else + eval $PFX=$ngx_auto_lib_lib_dir + fi + + if [ $NGX_AUTO_LIB_SHARED != YES ]; then + for l in $ngx_feature_lib_names; do + CORE_LIBS=`echo $CORE_LIBS | sed 's|-\||g'` + ADDON_LIBS=`echo $ADDON_LIBS | sed 's|-\||g'` + done + fi + + eval ${PFX}_INC=$INC + eval ${PFX}_LIB=$LIB + eval ${PFX}_SHARED=$NGX_AUTO_LIB_SHARED + eval AUTO_$PFX=YES +} + +ngx_auto_lib_set_custom_variables() { + return 0 +} + +######################## +## FINALIZE FUNCTIONS ## +######################## + +ngx_auto_lib_finalize() { + ngx_auto_lib_finalize_core +} + +ngx_auto_lib_finalize_core() { + + if [ $ngx_found = yes ]; then + + ngx_auto_lib_set_core_variables + ngx_auto_lib_set_generic_variables + + if [ "$ngx_feature_variables" ]; then + eval $ngx_feature_variables + fi + + ngx_auto_lib_set_custom_variables + + elif [ $ngx_feature_exit_if_not_found = yes ]; then + + if [ $ngx_auto_lib_module_name ]; then + module_txt=" by the $ngx_auto_lib_module_name module" + else + module_text= + fi + + lib=$ngx_auto_lib_name + pfx=$ngx_auto_lib_pfx + PFX=$NGX_AUTO_LIB_PFX + +cat << END + +$0: error: the $lib library is required$module_txt, but cannot +be found using the current configuration. In order for the compilation to succeed, +you will need to install the library using your system's package installer or point +the configure script to the library using one of the following variables : + +to define a dir to find $pfx library (source or install dir) $PFX +to define $pfx lib and include dirs separately ${PFX}_LIB & ${PFX}_INC +to define a base dir to search for dirs beginning with $pfx- ${PFX}_BASE + +e.g. + +$ export ${PFX}_LIB=/path/to/library/lib +$ export ${PFX}_LIB=/path/to/library/include +$ $0 ... + +END + exit 1 + fi +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/CHANGES b/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/CHANGES new file mode 100644 index 0000000..eaaef0b --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/CHANGES @@ -0,0 +1,17 @@ +Changelog +--------- + +0.1 feature : set_var functions +0.1.1 feature : upstream_list directive and functions +0.2 feature : conf merge functions + feature : conf command macros + feature : 'action' macros +0.2.1 bugfix : ndk_map_uri_to_path_add_suffix +0.2.2 feature : regex conf functions +0.2.3 feature : version number +0.2.4 change : the auto/build script is now executed automatically on compilation +0.2.9 feature : ngx_auto_lib included with source +0.2.11 bugfix : hash functions did not display properly +0.2.12 feature : patches for rewrite functions and rewrite phase handler +0.2.13 change : revert to old behaviour rewrite functions + change : pre-generated config and macro files now provided \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/LICENSE b/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/LICENSE new file mode 100644 index 0000000..7074f57 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/notes/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2010, Marcus Clyne, Simpl (simpl.it) +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organization (Simpl) nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL MARCUS CLYNE OR SIMPL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_array.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_array.h new file mode 100644 index 0000000..4e0d518 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_array.h @@ -0,0 +1,113 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* Non-generated macros */ + +#define ndk_array_count(a) ((a)->nelts) +#define ndk_array_get_first(a) ((a)->elts) +#define ndk_array_get_index(a,n) ((void*) ((char*) (a)->elts + (a)->size * n)) +#define ndk_array_get_last(a) ((void*) ((char*) (a)->elts + (a)->size * ((a)->nelts - 1))) +#define ndk_array_get_reverse_index(a,n) ((void*) ((char*) (a)->elts + (a)->size * ((a)->nelts - 1 - n))) +#define ndk_array_push_clean(p,a) {p = ngx_array_push (a); ndk_zerop (p);} + + +/* base action macro macros */ + +#define ndk_array_create_ac(a,pl,n,sz,ac) {a = ngx_array_create (pl,n,sz); if (a == NULL) ac;} +#define ndk_array_init_ac(a,pl,n,sz,ac) {if (ngx_array_init (a,pl,n,sz) == NGX_ERROR) ac;} +#define ndk_array_push_ac(p,a,ac) {p = ngx_array_push (a); if (p == NULL) ac;} +#define ndk_array_push_clean_ac(p,a,ac) {p = ngx_array_push (a); if (p == NULL) ac; ndk_zerop (p);} +#define ndk_array_push_n_ac(p,a,n,ac) {p = ngx_array_push_n (a,n); if (p == NULL) ac;} +#define ndk_array_push_n_clean_ac(p,a,n,ac) {p = ngx_array_push_n (a,n); if (p == NULL) ac; ndk_zeropn (p,n);} + + +/* generated action macros */ + +#define ndk_array_create_r0(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return 0) +#define ndk_array_create_r1(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return 1) +#define ndk_array_create_r_1(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return -1) +#define ndk_array_create_rok(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return NGX_OK) +#define ndk_array_create_rce(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return NGX_CONF_ERROR) +#define ndk_array_create_rcok(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return NGX_CONF_OK) +#define ndk_array_create_re(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return NGX_ERROR) +#define ndk_array_create_rn(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,return NULL) +#define ndk_array_create_rse(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,{ngx_script_error (e); return;}) +#define ndk_array_create_sce(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,{ngx_script_configure_error (c); return;}) +#define ndk_array_create_g(a,pl,n,sz,_lb) ndk_array_create_ac (a,pl,n,sz,goto _lb) +#define ndk_array_create_ge(a,pl,n,sz) ndk_array_create_ac (a,pl,n,sz,goto error) + +#define ndk_array_init_r0(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return 0) +#define ndk_array_init_r1(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return 1) +#define ndk_array_init_r_1(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return -1) +#define ndk_array_init_rok(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return NGX_OK) +#define ndk_array_init_rce(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return NGX_CONF_ERROR) +#define ndk_array_init_rcok(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return NGX_CONF_OK) +#define ndk_array_init_re(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return NGX_ERROR) +#define ndk_array_init_rn(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,return NULL) +#define ndk_array_init_rse(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,{ngx_script_error (e); return;}) +#define ndk_array_init_sce(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,{ngx_script_configure_error (c); return;}) +#define ndk_array_init_g(a,pl,n,sz,_lb) ndk_array_init_ac (a,pl,n,sz,goto _lb) +#define ndk_array_init_ge(a,pl,n,sz) ndk_array_init_ac (a,pl,n,sz,goto error) + +#define ndk_array_push_r0(p,a) ndk_array_push_ac (p,a,return 0) +#define ndk_array_push_r1(p,a) ndk_array_push_ac (p,a,return 1) +#define ndk_array_push_r_1(p,a) ndk_array_push_ac (p,a,return -1) +#define ndk_array_push_rok(p,a) ndk_array_push_ac (p,a,return NGX_OK) +#define ndk_array_push_rce(p,a) ndk_array_push_ac (p,a,return NGX_CONF_ERROR) +#define ndk_array_push_rcok(p,a) ndk_array_push_ac (p,a,return NGX_CONF_OK) +#define ndk_array_push_re(p,a) ndk_array_push_ac (p,a,return NGX_ERROR) +#define ndk_array_push_rn(p,a) ndk_array_push_ac (p,a,return NULL) +#define ndk_array_push_rse(p,a) ndk_array_push_ac (p,a,{ngx_script_error (e); return;}) +#define ndk_array_push_sce(p,a) ndk_array_push_ac (p,a,{ngx_script_configure_error (c); return;}) +#define ndk_array_push_g(p,a,_lb) ndk_array_push_ac (p,a,goto _lb) +#define ndk_array_push_ge(p,a) ndk_array_push_ac (p,a,goto error) + +#define ndk_array_push_clean_r0(p,a) ndk_array_push_clean_ac (p,a,return 0) +#define ndk_array_push_clean_r1(p,a) ndk_array_push_clean_ac (p,a,return 1) +#define ndk_array_push_clean_r_1(p,a) ndk_array_push_clean_ac (p,a,return -1) +#define ndk_array_push_clean_rok(p,a) ndk_array_push_clean_ac (p,a,return NGX_OK) +#define ndk_array_push_clean_rce(p,a) ndk_array_push_clean_ac (p,a,return NGX_CONF_ERROR) +#define ndk_array_push_clean_rcok(p,a) ndk_array_push_clean_ac (p,a,return NGX_CONF_OK) +#define ndk_array_push_clean_re(p,a) ndk_array_push_clean_ac (p,a,return NGX_ERROR) +#define ndk_array_push_clean_rn(p,a) ndk_array_push_clean_ac (p,a,return NULL) +#define ndk_array_push_clean_rse(p,a) ndk_array_push_clean_ac (p,a,{ngx_script_error (e); return;}) +#define ndk_array_push_clean_sce(p,a) ndk_array_push_clean_ac (p,a,{ngx_script_configure_error (c); return;}) +#define ndk_array_push_clean_g(p,a,_lb) ndk_array_push_clean_ac (p,a,goto _lb) +#define ndk_array_push_clean_ge(p,a) ndk_array_push_clean_ac (p,a,goto error) + +#define ndk_array_push_n_r0(p,a,n) ndk_array_push_n_ac (p,a,n,return 0) +#define ndk_array_push_n_r1(p,a,n) ndk_array_push_n_ac (p,a,n,return 1) +#define ndk_array_push_n_r_1(p,a,n) ndk_array_push_n_ac (p,a,n,return -1) +#define ndk_array_push_n_rok(p,a,n) ndk_array_push_n_ac (p,a,n,return NGX_OK) +#define ndk_array_push_n_rce(p,a,n) ndk_array_push_n_ac (p,a,n,return NGX_CONF_ERROR) +#define ndk_array_push_n_rcok(p,a,n) ndk_array_push_n_ac (p,a,n,return NGX_CONF_OK) +#define ndk_array_push_n_re(p,a,n) ndk_array_push_n_ac (p,a,n,return NGX_ERROR) +#define ndk_array_push_n_rn(p,a,n) ndk_array_push_n_ac (p,a,n,return NULL) +#define ndk_array_push_n_rse(p,a,n) ndk_array_push_n_ac (p,a,n,{ngx_script_error (e); return;}) +#define ndk_array_push_n_sce(p,a,n) ndk_array_push_n_ac (p,a,n,{ngx_script_configure_error (c); return;}) +#define ndk_array_push_n_g(p,a,n,_lb) ndk_array_push_n_ac (p,a,n,goto _lb) +#define ndk_array_push_n_ge(p,a,n) ndk_array_push_n_ac (p,a,n,goto error) + +#define ndk_array_push_n_clean_r0(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return 0) +#define ndk_array_push_n_clean_r1(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return 1) +#define ndk_array_push_n_clean_r_1(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return -1) +#define ndk_array_push_n_clean_rok(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return NGX_OK) +#define ndk_array_push_n_clean_rce(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return NGX_CONF_ERROR) +#define ndk_array_push_n_clean_rcok(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return NGX_CONF_OK) +#define ndk_array_push_n_clean_re(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return NGX_ERROR) +#define ndk_array_push_n_clean_rn(p,a,n) ndk_array_push_n_clean_ac (p,a,n,return NULL) +#define ndk_array_push_n_clean_rse(p,a,n) ndk_array_push_n_clean_ac (p,a,n,{ngx_script_error (e); return;}) +#define ndk_array_push_n_clean_sce(p,a,n) ndk_array_push_n_clean_ac (p,a,n,{ngx_script_configure_error (c); return;}) +#define ndk_array_push_n_clean_g(p,a,n,_lb) ndk_array_push_n_clean_ac (p,a,n,goto _lb) +#define ndk_array_push_n_clean_ge(p,a,n) ndk_array_push_n_clean_ac (p,a,n,goto error) + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_basic.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_basic.h new file mode 100644 index 0000000..c2db894 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_basic.h @@ -0,0 +1,2203 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* conf cmd core values/bitmasks */ + +#define NDK_1MORE NGX_1MORE +#define NDK_2MORE NGX_2MORE +#define NDK_ANY NGX_ANY +#define NDK_ARGS_NUMBER NGX_ARGS_NUMBER +#define NDK_BLOCK NGX_BLOCK +#define NDK_FLAG NGX_FLAG +#define NDK_MULTI NGX_MULTI +#define NDK_TAKE1 NGX_TAKE1 +#define NDK_TAKE12 NGX_TAKE12 +#define NDK_TAKE123 NGX_TAKE123 +#define NDK_TAKE1234 NGX_TAKE1234 +#define NDK_TAKE13 NGX_TAKE13 +#define NDK_TAKE2 NGX_TAKE2 +#define NDK_TAKE23 NGX_TAKE23 +#define NDK_TAKE3 NGX_TAKE3 +#define NDK_TAKE4 NGX_TAKE4 +#define NDK_TAKE5 NGX_TAKE5 +#define NDK_TAKE6 NGX_TAKE6 +#define NDK_TAKE7 NGX_TAKE7 +#define NDK_TAKE8 NGX_TAKE8 + + +/* conf cmd bitmasks */ + +/* TODO : finish this */ + +#define NDK_HTTP_MAIN_CONF NGX_HTTP_MAIN_CONF +#define NDK_HTTP_SRV_CONF NGX_HTTP_SRV_CONF +#define NDK_HTTP_SIF_CONF NGX_HTTP_SIF_CONF +#define NDK_HTTP_LOC_CONF NGX_HTTP_LOC_CONF +#define NDK_HTTP_LIF_CONF NGX_HTTP_LIF_CONF +#define NDK_HTTP_UPS_CONF NGX_HTTP_UPS_CONF +#define NDK_MAIN_CONF NGX_MAIN_CONF +#define NDK_ANY_CONF NGX_ANY_CONF + + +/* compound locations */ + +#define NDK_HTTP_MAIN_SRV_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_CONF +#define NDK_HTTP_MAIN_SIF_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_SIF_CONF +#define NDK_HTTP_MAIN_LOC_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_LOC_CONF +#define NDK_HTTP_MAIN_LIF_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_LOC_LIF_CONF + +#define NDK_HTTP_SRV_SIF_CONF NDK_HTTP_SRV_CONF|NDK_HTTP_SIF_CONF +#define NDK_HTTP_SRV_LOC_CONF NDK_HTTP_SRV_CONF|NDK_HTTP_LOC_CONF +#define NDK_HTTP_SRV_LOC_LIF_CONF NDK_HTTP_SRV_CONF|NDK_HTTP_LOC_LIF_CONF +#define NDK_HTTP_SRV_SIF_LOC_CONF NDK_HTTP_SRV_SIF_CONF|NDK_HTTP_LOC_CONF +#define NDK_HTTP_SRV_SIF_LOC_LIF_CONF NDK_HTTP_SRV_SIF_CONF|NDK_HTTP_LOC_LIF_CONF + +#define NDK_HTTP_LOC_LIF_CONF NDK_HTTP_LOC_CONF|NDK_HTTP_LIF_CONF + +#define NDK_HTTP_MAIN_SRV_LOC_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_LOC_CONF +#define NDK_HTTP_MAIN_SRV_LIF_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SRV_LIF_CONF +#define NDK_HTTP_MAIN_SIF_LOC_CONF NDK_HTTP_MAIN_CONF|NDK_HTTP_SIF_LOC_CONF +#define NDK_HTTP_MAIN_SRV_SIF_LOC_LIF_CONF NDK_HTTP_SRV_SIF_LOC_LIF_CONF|NDK_MAIN_CONF +#define NDK_HTTP_CONF NDK_HTTP_MAIN_SRV_SIF_LOC_LIF_CONF +#define NDK_HTTP_ANY_CONF NDK_HTTP_CONF|NDK_HTTP_UPS_CONF + + +/* property offsets NOTE : ngx_module_main_conf_t etc should be defined in the module's .c file before the commands */ + +#define NDK_HTTP_MAIN_CONF_PROP(p) NGX_HTTP_MAIN_CONF_OFFSET, offsetof (ndk_module_main_conf_t, p) +#define NDK_HTTP_SRV_CONF_PROP(p) NGX_HTTP_SRV_CONF_OFFSET, offsetof (ndk_module_srv_conf_t, p) +#define NDK_HTTP_LOC_CONF_PROP(p) NGX_HTTP_LOC_CONF_OFFSET, offsetof (ndk_module_loc_conf_t, p) + + +/* conf cmd basic macros */ + +#define NDK_HTTP_MAIN_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_1MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_1MORE|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_2MORE(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_2MORE|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_ANY(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ANY|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_ARGS_NUMBER(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_ARGS_NUMBER|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_BLOCK(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_BLOCK|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_FLAG(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_FLAG|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_MULTI(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_MULTI|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE1(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE12(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE12|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE123(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE123|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE1234(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE1234|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE13(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE13|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE2(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE2|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE23(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE23|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE3(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE3|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE4(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE4|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE5(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE5|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE6(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE6|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE7(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE7|NDK_ANY_CONF,\ + func, off1, off2, post}, + + +#define NDK_HTTP_MAIN_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_LIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_SRV_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_SIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_LIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SRV_LIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_SIF_LIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_SIF_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_SRV_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_SRV_LIF_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_MAIN_SRV_SIF_LOC_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_UPS_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_UPS_CONF,\ + func, off1, off2, post}, + +#define NDK_HTTP_ANY_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_HTTP_ANY_CONF,\ + func, off1, off2, post}, + +#define NDK_ANY_CONF_TAKE8(name,func,off1,off2,post)\ + {ngx_string (name),\ + NGX_CONF_TAKE8|NDK_ANY_CONF,\ + func, off1, off2, post}, + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_extra.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_extra.h new file mode 100644 index 0000000..68e276f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_cmd_extra.h @@ -0,0 +1,5423 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* conf command macros */ + +#define NDK_HTTP_MAIN_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_BITMASK(name,p,post)\ + NDK_HTTP_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_BITMASK(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_BITMASK(name,p,post)\ + NDK_HTTP_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_BITMASK(name,p,post)\ + NDK_HTTP_UPS_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_BITMASK(name,p,post)\ + NDK_HTTP_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_BITMASK(name,p,post)\ + NDK_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_bitmask_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_BUFS(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_BUFS(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_BUFS(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_BUFS(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_BUFS(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_BUFS(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_bufs_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_COMPLEX_KEYVAL(name,p,post)\ + NDK_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_http_complex_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_COMPLEX_PATH(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_COMPLEX_PATH(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_UPS_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_HTTP_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_COMPLEX_VALUE_ARRAY(name,p,post)\ + NDK_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_http_complex_value_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_COMPLEX_VALUE(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_http_complex_value_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_ENCODING(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_ENCODING(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_ENCODING(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_ENCODING(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_ENCODING(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_ENCODING(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_encoding_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_ENUM(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_ENUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_ENUM(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_ENUM(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_ENUM(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_ENUM(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_enum_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_FALSE(name,p,post)\ + NDK_HTTP_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_FALSE(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_FALSE(name,p,post)\ + NDK_HTTP_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_FALSE(name,p,post)\ + NDK_HTTP_UPS_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_FALSE(name,p,post)\ + NDK_HTTP_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_FALSE(name,p,post)\ + NDK_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_false_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_FULL_PATH(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_FULL_PATH(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_full_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_KEYVAL1(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_KEYVAL1(name,p,post)\ + NDK_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval1_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_KEYVAL(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_KEYVAL(name,p,post)\ + NDK_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_keyval_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_MSEC(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_MSEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_MSEC(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_MSEC(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_MSEC(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_MSEC(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_msec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_NULL(name,p,post)\ + NDK_HTTP_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_NULL(name,p,post)\ + NDK_HTTP_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_NULL(name,p,post)\ + NDK_HTTP_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_NULL(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_NULL(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NULL(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_NULL(name,p,post)\ + NDK_HTTP_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_NULL(name,p,post)\ + NDK_HTTP_UPS_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_NULL(name,p,post)\ + NDK_HTTP_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_NULL(name,p,post)\ + NDK_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_null_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_NUM64(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NUM64(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_NUM64(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_NUM64(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_NUM64(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_NUM64(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_num64_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_NUM_FLAG(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_NUM_FLAG(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_NUM(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_NUM(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_NUM(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_NUM(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_NUM(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NUM(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_NUM(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_NUM(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_NUM(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_NUM(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_num_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_OFF(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_OFF(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_OFF(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_OFF(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_OFF(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_OFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_OFF(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_OFF(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_OFF(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_OFF(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_off_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_ONOFF(name,p,post)\ + NDK_HTTP_SRV_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_SIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_LIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_ONOFF(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_ONOFF(name,p,post)\ + NDK_HTTP_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_ONOFF(name,p,post)\ + NDK_HTTP_UPS_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_ONOFF(name,p,post)\ + NDK_HTTP_ANY_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_ONOFF(name,p,post)\ + NDK_ANY_CONF_FLAG\ + (name,\ + ndk_conf_set_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_PATH(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_PATH(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_PATH(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_PATH(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_PATH(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_PATH(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_PATH(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_PATH(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_PATH(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_PATH(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_split_path_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_PTR(name,p,post)\ + NDK_HTTP_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_PTR(name,p,post)\ + NDK_HTTP_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_PTR(name,p,post)\ + NDK_HTTP_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_PTR(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_PTR(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_PTR(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_PTR(name,p,post)\ + NDK_HTTP_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_PTR(name,p,post)\ + NDK_HTTP_UPS_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_PTR(name,p,post)\ + NDK_HTTP_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_PTR(name,p,post)\ + NDK_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_ptr_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_UPS_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_REGEX_ARRAY(name,p,post)\ + NDK_HTTP_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_REGEX_ARRAY(name,p,post)\ + NDK_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_UPS_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_HTTP_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_REGEX_ARRAY_CL(name,p,post)\ + NDK_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_regex_array_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_REGEX_CL(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_REGEX_CL(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_caseless_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_REXEX(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_REXEX(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_REXEX(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_REXEX(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_REXEX(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_REXEX(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_regex_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_SEC_FLAG(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_SEC_FLAG(name,p,post)\ + NDK_ANY_CONF_TAKE2\ + (name,\ + ndk_conf_set_sec_flag_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_SEC(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_SEC(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_SEC(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_SEC(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_SEC(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_SEC(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_SEC(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_SEC(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_SEC(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_SEC(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_sec_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_SIZE(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_SIZE(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_SIZE(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_SIZE(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_SIZE(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_SIZE(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_size_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_UPS_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_STR_ARRAY(name,p,post)\ + NDK_HTTP_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_STR_ARRAY(name,p,post)\ + NDK_ANY_CONF_1MORE\ + (name,\ + ndk_conf_set_str_array_multi_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_STR_ARRAY1(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_STR_ARRAY1(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_array_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_STR(name,p,post)\ + NDK_HTTP_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_STR(name,p,post)\ + NDK_HTTP_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_STR(name,p,post)\ + NDK_HTTP_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_STR(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_STR(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_STR(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_STR(name,p,post)\ + NDK_HTTP_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_STR(name,p,post)\ + NDK_HTTP_UPS_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_STR(name,p,post)\ + NDK_HTTP_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_STR(name,p,post)\ + NDK_ANY_CONF_TAKE1\ + (name,\ + ndk_conf_set_str_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + +#define NDK_HTTP_MAIN_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_MAIN_CONF_OFFSET,\ + offsetof (ndk_module_main_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_CONF_TRUE(name,p,post)\ + NDK_HTTP_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_LIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_SIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_SRV_CONF_OFFSET,\ + offsetof (ndk_module_srv_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_LIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SRV_LIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_SIF_LIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_SIF_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_LIF_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_LIF_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SIF_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_TRUE(name,p,post)\ + NDK_HTTP_MAIN_SRV_SIF_LOC_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_CONF_TRUE(name,p,post)\ + NDK_HTTP_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_UPS_CONF_TRUE(name,p,post)\ + NDK_HTTP_UPS_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_HTTP_ANY_CONF_TRUE(name,p,post)\ + NDK_HTTP_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + +#define NDK_ANY_CONF_TRUE(name,p,post)\ + NDK_ANY_CONF_NOARGS\ + (name,\ + ndk_conf_set_true_slot,\ + NGX_HTTP_LOC_CONF_OFFSET,\ + offsetof (ndk_module_loc_conf_t, p),\ + post) + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_merge.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_merge.h new file mode 100644 index 0000000..4f7855f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_conf_merge.h @@ -0,0 +1,227 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* conf-merge-value macros */ + +/* TODO : check that all the main types have a corresponding merge function */ + +#define ndk_conf_merge_value ngx_conf_merge_value +#define ndk_conf_merge_off_value ngx_conf_merge_off_value +#define ndk_conf_merge_ptr_value ngx_conf_merge_ptr_value +#define ndk_conf_merge_str_value ngx_conf_merge_str_value +#define ndk_conf_merge_size_value ngx_conf_merge_size_value + + +#define ndk_conf_merge_keyval_value(conf,prev,default) \ + \ + conf = prev ? prev : default; + +#define ndk_conf_merge_str_array_value(conf,prev,val1,...) \ + \ + if (conf == NGX_CONF_UNSET_PTR) { \ + if (prev == NGX_CONF_UNSET_PTR) { \ + if (val1 == NULL) { \ + conf = NULL; \ + } else { \ + char * elts[] = {val1,##__VA_ARGS__}; \ + int n = sizeof(elts)/sizeof(char*); \ + \ + conf = ndk_str_array_create (cf->pool, elts, n); \ + \ + if (conf == NULL) \ + return NGX_CONF_ERROR; \ + } \ + } else { \ + conf = prev; \ + } \ + } + +#define ndk_conf_merge_http_complex_value_value(conf,prev,default) \ + \ + if (!conf.str.len) { \ + if (prev.str.len) { \ + conf = prev; \ + } else { \ + conf.str.data = (u_char *) default; \ + conf.str.len = sizeof (default) - 1; \ + \ + if (ndk_http_complex_value_compile (cf, &conf)) \ + return NGX_CONF_ERROR; \ + } \ + } + +#define ndk_conf_merge_http_complex_value_array_value(conf,prev,val1,...) \ + \ + if (conf == NGX_CONF_UNSET_PTR) { \ + if (prev == NGX_CONF_UNSET_PTR) { \ + if (val1 == NULL) \ + conf = NULL; \ + else { \ + char * elts[] = {val1,##__VA_ARGS__}; \ + int n = sizeof(elts)/sizeof(char*); \ + \ + conf = ndk_http_complex_value_array_create (cf, elts, n); \ + \ + if (conf == NULL) \ + return NGX_CONF_ERROR; \ + } \ + } else { \ + conf = prev; \ + } \ + } + +#define ndk_conf_merge_http_complex_path_value(conf,prev,...) \ + ndk_conf_merge_http_complex_value_array_value (conf.a, prev.a, __VA_ARGS__) + +#define ndk_conf_merge_split_path_value(conf,prev,path) \ + \ + if (conf == NGX_CONF_UNSET_PTR) { \ + conf = (prev == NGX_CONF_UNSET_PTR ? \ + ndk_split_path_create_raw (cf, path) : prev); \ + } + + +/* conf-merge-prop macros */ + +#define ndk_conf_merge_prop(prop,default)\ + ndk_conf_merge_value\ + (conf->prop, prev->prop, default) + +#define ndk_conf_merge_bitmask_prop(prop,default,...)\ + ndk_conf_merge_bitmask_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_bufs_prop(prop,default,...)\ + ndk_conf_merge_bufs_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_encoding_prop(prop,default,...)\ + ndk_conf_merge_encoding_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_enum_prop(prop,default,...)\ + ndk_conf_merge_enum_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_false_prop(prop,default,...)\ + ndk_conf_merge_false_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_flag_prop(prop,default,...)\ + ndk_conf_merge_flag_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_full_path_prop(prop,default,...)\ + ndk_conf_merge_full_path_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_http_complex_keyval_prop(prop,default,...)\ + ndk_conf_merge_http_complex_keyval_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_http_complex_path_prop(prop,default,...)\ + ndk_conf_merge_http_complex_path_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_http_complex_value_prop(prop,default,...)\ + ndk_conf_merge_http_complex_value_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_http_complex_value_array_prop(prop,default,...)\ + ndk_conf_merge_http_complex_value_array_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_keyval_prop(prop,default,...)\ + ndk_conf_merge_keyval_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_keyval1_prop(prop,default,...)\ + ndk_conf_merge_keyval1_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_msec_prop(prop,default,...)\ + ndk_conf_merge_msec_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_null_prop(prop,default,...)\ + ndk_conf_merge_null_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_num_prop(prop,default,...)\ + ndk_conf_merge_num_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_num64_prop(prop,default,...)\ + ndk_conf_merge_num64_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_num_flag_prop(prop,default,...)\ + ndk_conf_merge_num_flag_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_off_prop(prop,default,...)\ + ndk_conf_merge_off_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_ptr_prop(prop,default,...)\ + ndk_conf_merge_ptr_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_regex_prop(prop,default,...)\ + ndk_conf_merge_regex_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_regex_array_prop(prop,default,...)\ + ndk_conf_merge_regex_array_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_regex_array_caseless_prop(prop,default,...)\ + ndk_conf_merge_regex_array_caseless_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_regex_caseless_prop(prop,default,...)\ + ndk_conf_merge_regex_caseless_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_sec_prop(prop,default,...)\ + ndk_conf_merge_sec_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_sec_flag_prop(prop,default,...)\ + ndk_conf_merge_sec_flag_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_size_prop(prop,default,...)\ + ndk_conf_merge_size_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_split_path_prop(prop,default,...)\ + ndk_conf_merge_split_path_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_str_prop(prop,default,...)\ + ndk_conf_merge_str_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_str_array_prop(prop,default,...)\ + ndk_conf_merge_str_array_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_str_array_multi_prop(prop,default,...)\ + ndk_conf_merge_str_array_multi_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + +#define ndk_conf_merge_true_prop(prop,default,...)\ + ndk_conf_merge_true_value\ + (conf->prop, prev->prop, default,##__VA_ARGS__) + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.c new file mode 100644 index 0000000..d2e572f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.c @@ -0,0 +1,72 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* optional includes */ + +#if (NDK_BUF) +#include +#endif +#if (NDK_COMPLEX_PATH) +#include +#endif +#if (NDK_COMPLEX_VALUE) +#include +#endif +#if (NDK_CONF_FILE) +#include +#endif +#if (NDK_ENCODING) +#include +#endif +#if (NDK_HASH) +#include +#endif +#if (NDK_HTTP) +#include +#endif +#if (NDK_PATH) +#include +#endif +#if (NDK_PROCESS) +#include +#endif +#if (NDK_REGEX) +#include +#endif +#if (NDK_REWRITE) +#include +#endif +#if (NDK_SET_VAR) +#include +#endif +#if (NDK_STRING) +#include +#endif +#if (NDK_UPSTREAM_LIST) +#include +#endif +#if (NDK_URI) +#include +#endif + + +/* module commands */ + +static ngx_command_t ndk_http_commands[] = { +#if (NDK_UPSTREAM_LIST) +#define NDK_UPSTREAM_LIST_CMDS 1 +#include +#undef NDK_UPSTREAM_LIST_CMDS +#endif + ngx_null_command +}; diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.h new file mode 100644 index 0000000..7223950 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_config.h @@ -0,0 +1,98 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* include all optional modules */ + +#ifdef NDK_ALL + +#ifndef NDK_BUF +#define NDK_BUF 1 +#endif +#ifndef NDK_COMPLEX_PATH +#define NDK_COMPLEX_PATH 1 +#endif +#ifndef NDK_COMPLEX_VALUE +#define NDK_COMPLEX_VALUE 1 +#endif +#ifndef NDK_CONF_FILE +#define NDK_CONF_FILE 1 +#endif +#ifndef NDK_ENCODING +#define NDK_ENCODING 1 +#endif +#ifndef NDK_HASH +#define NDK_HASH 1 +#endif +#ifndef NDK_HTTP +#define NDK_HTTP 1 +#endif +#ifndef NDK_PATH +#define NDK_PATH 1 +#endif +#ifndef NDK_PROCESS +#define NDK_PROCESS 1 +#endif +#ifndef NDK_REGEX +#define NDK_REGEX 1 +#endif +#ifndef NDK_REWRITE +#define NDK_REWRITE 1 +#endif +#ifndef NDK_SET_VAR +#define NDK_SET_VAR 1 +#endif +#ifndef NDK_STRING +#define NDK_STRING 1 +#endif +#ifndef NDK_UPSTREAM_LIST +#define NDK_UPSTREAM_LIST 1 +#endif +#ifndef NDK_URI +#define NDK_URI 1 +#endif + +#endif + + +/* module dependencies */ + +#ifdef NDK_COMPLEX_PATH +#ifndef NDK_COMPLEX_VALUE +#define NDK_COMPLEX_VALUE 1 +#endif +#ifndef NDK_PATH +#define NDK_PATH 1 +#endif +#endif +#ifdef NDK_CONF_FILE +#ifndef NDK_STRING +#define NDK_STRING 1 +#endif +#endif +#ifdef NDK_HASH +#ifndef NDK_STRING +#define NDK_STRING 1 +#endif +#endif +#ifdef NDK_SET_VAR +#ifndef NDK_REWRITE +#define NDK_REWRITE 1 +#endif +#endif +#ifdef NDK_UPSTREAM_LIST +#ifndef NDK_HTTP_CREATE_MAIN_CONF +#define NDK_HTTP_CREATE_MAIN_CONF 1 +#endif +#endif + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_includes.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_includes.h new file mode 100644 index 0000000..cbbf60a --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_includes.h @@ -0,0 +1,66 @@ +/* optional includes */ + +#if (NDK_BUF) +#include +#endif +#if (NDK_COMPLEX_PATH) +#include +#endif +#if (NDK_COMPLEX_VALUE) +#include +#endif +#if (NDK_CONF_FILE) +#include +#endif +#if (NDK_ENCODING) +#include +#endif +#if (NDK_HASH) +#include +#endif +#if (NDK_HTTP) +#include +#endif +#if (NDK_PATH) +#include +#endif +#if (NDK_PROCESS) +#include +#endif +#if (NDK_REGEX) +#include +#endif +#if (NDK_REWRITE) +#include +#endif +#if (NDK_SET_VAR) +#include +#endif +#if (NDK_STRING) +#include +#endif +#if (NDK_UPSTREAM_LIST) +#include +#endif +#if (NDK_URI) +#include +#endif + + +/* non-optional includes */ + +#include +#include +#include +#include + + +/* auto-generated headers */ + +#include +#include +#include +#include +#include + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_palloc.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_palloc.h new file mode 100644 index 0000000..db8aaf1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/objs/ndk_palloc.h @@ -0,0 +1,112 @@ + +/* + * 2010 (C) Marcus Clyne + * + * DO NOT EDIT THIS FILE MANUALLY + * ------------------------------ + * This file has been generated automatically from scripts in the $base/auto dir and + * data in the $base/auto/data dir. If you wish to edit the output of this file, then + * you should edit these files instead. + * +*/ + + +/* Non-generated macros */ + +#define ndk_pallocp(p,pl) p = ngx_palloc (pl,sizeof(*p)) +#define ndk_pallocpn(p,pl,n) p = ngx_palloc (pl,sizeof(*p)*(n)) + +#define ndk_pcallocp(p,pl) p = ngx_pcalloc (pl,sizeof(*p)) +#define ndk_pcallocpn(p,pl,n) p = ngx_pcalloc (pl,sizeof(*p)*(n)) + + +/* base action macro macros */ + +#define ndk_palloc_ac(p,pl,sz,ac) {p = ngx_palloc (pl,sz); if (p == NULL) ac;} +#define ndk_pallocp_ac(p,pl,ac) {ndk_pallocp (p,pl); if (p == NULL) ac;} +#define ndk_pallocpn_ac(p,pl,n,ac) {ndk_pallocpn (p,pl,n); if (p == NULL) ac;} +#define ndk_pcalloc_ac(p,pl,sz,ac) {p = ngx_pcalloc (pl,sz); if (p == NULL) ac;} +#define ndk_pcallocp_ac(p,pl,ac) {ndk_pcallocp (p,pl); if (p == NULL) ac;} +#define ndk_pcallocpn_ac(p,pl,n,ac) {ndk_pcallocpn (p,pl,n); if (p == NULL) ac;} + + +/* generated action macros */ + +#define ndk_palloc_r0(p,pl,sz) ndk_palloc_ac (p,pl,sz,return 0) +#define ndk_palloc_r1(p,pl,sz) ndk_palloc_ac (p,pl,sz,return 1) +#define ndk_palloc_r_1(p,pl,sz) ndk_palloc_ac (p,pl,sz,return -1) +#define ndk_palloc_rok(p,pl,sz) ndk_palloc_ac (p,pl,sz,return NGX_OK) +#define ndk_palloc_rce(p,pl,sz) ndk_palloc_ac (p,pl,sz,return NGX_CONF_ERROR) +#define ndk_palloc_rcok(p,pl,sz) ndk_palloc_ac (p,pl,sz,return NGX_CONF_OK) +#define ndk_palloc_re(p,pl,sz) ndk_palloc_ac (p,pl,sz,return NGX_ERROR) +#define ndk_palloc_rn(p,pl,sz) ndk_palloc_ac (p,pl,sz,return NULL) +#define ndk_palloc_rse(p,pl,sz) ndk_palloc_ac (p,pl,sz,{ngx_script_error (e); return;}) +#define ndk_palloc_sce(p,pl,sz) ndk_palloc_ac (p,pl,sz,{ngx_script_configure_error (c); return;}) +#define ndk_palloc_g(p,pl,sz,_lb) ndk_palloc_ac (p,pl,sz,goto _lb) +#define ndk_palloc_ge(p,pl,sz) ndk_palloc_ac (p,pl,sz,goto error) + +#define ndk_pallocp_r0(p,pl) ndk_pallocp_ac (p,pl,return 0) +#define ndk_pallocp_r1(p,pl) ndk_pallocp_ac (p,pl,return 1) +#define ndk_pallocp_r_1(p,pl) ndk_pallocp_ac (p,pl,return -1) +#define ndk_pallocp_rok(p,pl) ndk_pallocp_ac (p,pl,return NGX_OK) +#define ndk_pallocp_rce(p,pl) ndk_pallocp_ac (p,pl,return NGX_CONF_ERROR) +#define ndk_pallocp_rcok(p,pl) ndk_pallocp_ac (p,pl,return NGX_CONF_OK) +#define ndk_pallocp_re(p,pl) ndk_pallocp_ac (p,pl,return NGX_ERROR) +#define ndk_pallocp_rn(p,pl) ndk_pallocp_ac (p,pl,return NULL) +#define ndk_pallocp_rse(p,pl) ndk_pallocp_ac (p,pl,{ngx_script_error (e); return;}) +#define ndk_pallocp_sce(p,pl) ndk_pallocp_ac (p,pl,{ngx_script_configure_error (c); return;}) +#define ndk_pallocp_g(p,pl,_lb) ndk_pallocp_ac (p,pl,goto _lb) +#define ndk_pallocp_ge(p,pl) ndk_pallocp_ac (p,pl,goto error) + +#define ndk_pallocpn_r0(p,pl,n) ndk_pallocpn_ac (p,pl,n,return 0) +#define ndk_pallocpn_r1(p,pl,n) ndk_pallocpn_ac (p,pl,n,return 1) +#define ndk_pallocpn_r_1(p,pl,n) ndk_pallocpn_ac (p,pl,n,return -1) +#define ndk_pallocpn_rok(p,pl,n) ndk_pallocpn_ac (p,pl,n,return NGX_OK) +#define ndk_pallocpn_rce(p,pl,n) ndk_pallocpn_ac (p,pl,n,return NGX_CONF_ERROR) +#define ndk_pallocpn_rcok(p,pl,n) ndk_pallocpn_ac (p,pl,n,return NGX_CONF_OK) +#define ndk_pallocpn_re(p,pl,n) ndk_pallocpn_ac (p,pl,n,return NGX_ERROR) +#define ndk_pallocpn_rn(p,pl,n) ndk_pallocpn_ac (p,pl,n,return NULL) +#define ndk_pallocpn_rse(p,pl,n) ndk_pallocpn_ac (p,pl,n,{ngx_script_error (e); return;}) +#define ndk_pallocpn_sce(p,pl,n) ndk_pallocpn_ac (p,pl,n,{ngx_script_configure_error (c); return;}) +#define ndk_pallocpn_g(p,pl,n,_lb) ndk_pallocpn_ac (p,pl,n,goto _lb) +#define ndk_pallocpn_ge(p,pl,n) ndk_pallocpn_ac (p,pl,n,goto error) + +#define ndk_pcalloc_r0(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return 0) +#define ndk_pcalloc_r1(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return 1) +#define ndk_pcalloc_r_1(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return -1) +#define ndk_pcalloc_rok(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return NGX_OK) +#define ndk_pcalloc_rce(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return NGX_CONF_ERROR) +#define ndk_pcalloc_rcok(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return NGX_CONF_OK) +#define ndk_pcalloc_re(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return NGX_ERROR) +#define ndk_pcalloc_rn(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,return NULL) +#define ndk_pcalloc_rse(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,{ngx_script_error (e); return;}) +#define ndk_pcalloc_sce(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,{ngx_script_configure_error (c); return;}) +#define ndk_pcalloc_g(p,pl,sz,_lb) ndk_pcalloc_ac (p,pl,sz,goto _lb) +#define ndk_pcalloc_ge(p,pl,sz) ndk_pcalloc_ac (p,pl,sz,goto error) + +#define ndk_pcallocp_r0(p,pl) ndk_pcallocp_ac (p,pl,return 0) +#define ndk_pcallocp_r1(p,pl) ndk_pcallocp_ac (p,pl,return 1) +#define ndk_pcallocp_r_1(p,pl) ndk_pcallocp_ac (p,pl,return -1) +#define ndk_pcallocp_rok(p,pl) ndk_pcallocp_ac (p,pl,return NGX_OK) +#define ndk_pcallocp_rce(p,pl) ndk_pcallocp_ac (p,pl,return NGX_CONF_ERROR) +#define ndk_pcallocp_rcok(p,pl) ndk_pcallocp_ac (p,pl,return NGX_CONF_OK) +#define ndk_pcallocp_re(p,pl) ndk_pcallocp_ac (p,pl,return NGX_ERROR) +#define ndk_pcallocp_rn(p,pl) ndk_pcallocp_ac (p,pl,return NULL) +#define ndk_pcallocp_rse(p,pl) ndk_pcallocp_ac (p,pl,{ngx_script_error (e); return;}) +#define ndk_pcallocp_sce(p,pl) ndk_pcallocp_ac (p,pl,{ngx_script_configure_error (c); return;}) +#define ndk_pcallocp_g(p,pl,_lb) ndk_pcallocp_ac (p,pl,goto _lb) +#define ndk_pcallocp_ge(p,pl) ndk_pcallocp_ac (p,pl,goto error) + +#define ndk_pcallocpn_r0(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return 0) +#define ndk_pcallocpn_r1(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return 1) +#define ndk_pcallocpn_r_1(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return -1) +#define ndk_pcallocpn_rok(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return NGX_OK) +#define ndk_pcallocpn_rce(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return NGX_CONF_ERROR) +#define ndk_pcallocpn_rcok(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return NGX_CONF_OK) +#define ndk_pcallocpn_re(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return NGX_ERROR) +#define ndk_pcallocpn_rn(p,pl,n) ndk_pcallocpn_ac (p,pl,n,return NULL) +#define ndk_pcallocpn_rse(p,pl,n) ndk_pcallocpn_ac (p,pl,n,{ngx_script_error (e); return;}) +#define ndk_pcallocpn_sce(p,pl,n) ndk_pcallocpn_ac (p,pl,n,{ngx_script_configure_error (c); return;}) +#define ndk_pcallocpn_g(p,pl,n,_lb) ndk_pcallocpn_ac (p,pl,n,goto _lb) +#define ndk_pcallocpn_ge(p,pl,n) ndk_pcallocpn_ac (p,pl,n,goto error) + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/auto_config b/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/auto_config new file mode 100644 index 0000000..ba4fdd4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/auto_config @@ -0,0 +1,16 @@ +diff -pNr a/src/core/ngx_config.h b/src/core/ngx_config.h +*** a/src/core/ngx_config.h 2008-09-19 13:47:13.000000000 +0100 +--- b/src/core/ngx_config.h 2010-10-09 17:14:13.000000000 +0100 +*************** typedef intptr_t ngx_flag_t; +*** 127,131 **** + #define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffff + #endif + +! + #endif /* _NGX_CONFIG_H_INCLUDED_ */ +--- 127,131 ---- + #define NGX_MAX_UINT32_VALUE (uint32_t) 0xffffffff + #endif + +! #include + #endif /* _NGX_CONFIG_H_INCLUDED_ */ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/expose_rewrite_functions b/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/expose_rewrite_functions new file mode 100644 index 0000000..ec1d6d8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/expose_rewrite_functions @@ -0,0 +1,291 @@ +diff -rNp 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-10-09 14:47:10.000000000 +0100 +*************** +*** 8,14 **** + #include + #include + +! + typedef struct { + ngx_array_t *codes; /* uintptr_t */ + +--- 8,14 ---- + #include + #include + +! #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) + typedef struct { + ngx_array_t *codes; /* uintptr_t */ + +*************** typedef struct { +*** 17,23 **** + 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, +--- 17,23 ---- + ngx_flag_t log; + ngx_flag_t uninitialized_variable_warn; + } ngx_http_rewrite_loc_conf_t; +! #endif + + static void *ngx_http_rewrite_create_loc_conf(ngx_conf_t *cf); + static char *ngx_http_rewrite_merge_loc_conf(ngx_conf_t *cf, +*************** static char *ngx_http_rewrite_return(ngx +*** 28,44 **** + 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[] = { + +--- 28,47 ---- + void *conf); + static char *ngx_http_rewrite_break(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); ++ #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) + 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); ++ #endif + static char *ngx_http_rewrite_set(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); ++ #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) + static char * ngx_http_rewrite_value(ngx_conf_t *cf, + ngx_http_rewrite_loc_conf_t *lcf, ngx_str_t *value); +! #endif + + static ngx_command_t ngx_http_rewrite_commands[] = { + +*************** ngx_http_rewrite_handler(ngx_http_reques +*** 178,185 **** + return r->err_status; + } + +! +! static ngx_int_t + ngx_http_rewrite_var(ngx_http_request_t *r, ngx_http_variable_value_t *v, + uintptr_t data) + { +--- 181,190 ---- + return r->err_status; + } + +! #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) +! static +! #endif +! ngx_int_t + ngx_http_rewrite_var(ngx_http_request_t *r, ngx_http_variable_value_t *v, + uintptr_t data) + { +*************** ngx_http_rewrite_break(ngx_conf_t *cf, n +*** 511,517 **** + } + + +! static char * + ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + { + ngx_http_rewrite_loc_conf_t *lcf = conf; +--- 516,525 ---- + } + + +! #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) +! static +! #endif +! char * + ngx_http_rewrite_if(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) + { + ngx_http_rewrite_loc_conf_t *lcf = conf; +*************** ngx_http_rewrite_if(ngx_conf_t *cf, ngx_ +*** 627,633 **** + } + + +! static char * + ngx_http_rewrite_if_condition(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf) + { + u_char *p; +--- 635,644 ---- + } + + +! #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) +! static +! #endif +! char * + ngx_http_rewrite_if_condition(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf) + { + u_char *p; +*************** ngx_http_rewrite_if_condition(ngx_conf_t +*** 847,853 **** + } + + +! static char * + ngx_http_rewrite_variable(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, + ngx_str_t *value) + { +--- 858,867 ---- + } + + +! #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) +! static +! #endif +! char * + ngx_http_rewrite_variable(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, + ngx_str_t *value) + { +*************** ngx_http_rewrite_set(ngx_conf_t *cf, ngx +*** 948,954 **** + } + + +! static char * + ngx_http_rewrite_value(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, + ngx_str_t *value) + { +--- 962,971 ---- + } + + +! #if !(NDK_EXPOSE_REWRITE_FUNCTIONS) +! static +! #endif +! char * + ngx_http_rewrite_value(ngx_conf_t *cf, ngx_http_rewrite_loc_conf_t *lcf, + ngx_str_t *value) + { +diff -rNp 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-10-09 14:38:04.000000000 +0100 +*************** +*** 0 **** +--- 1,47 ---- ++ ++ /* ++ * Copyright (C) Marcus Clyne ++ * ++ * Note : this file has been created by the Nginx Development Kit using ++ * some code from ngx_http_rewrite_module.c ++ */ ++ ++ #if (NDK_EXPOSE_REWRITE_FUNCTIONS) ++ ++ #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 ++ #endif +diff -rNp 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-10-09 14:25:56.000000000 +0100 +*************** typedef u_char *(*ngx_http_log_handler_p +*** 43,48 **** +--- 43,52 ---- + #include + #endif + ++ #if (NDK_EXPOSE_REWRITE_FUNCTIONS) ++ #include ++ #endif ++ + + struct ngx_http_log_ctx_s { + ngx_connection_t *connection; +diff -rNp a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c +*** a/src/http/ngx_http_script.c 2010-09-13 13:44:43.000000000 +0100 +--- b/src/http/ngx_http_script.c 2010-10-09 14:36:10.000000000 +0100 +*************** static size_t ngx_http_script_full_name_ +*** 26,35 **** +--- 26,43 ---- + static void ngx_http_script_full_name_code(ngx_http_script_engine_t *e); + + ++ #if (NDK_EXPOSE_REWRITE_FUNCTIONS) ++ ++ uintptr_t ngx_http_script_exit_code = (uintptr_t) NULL; ++ ++ #else ++ + #define ngx_http_script_exit (u_char *) &ngx_http_script_exit_code + + static uintptr_t ngx_http_script_exit_code = (uintptr_t) NULL; + ++ #endif ++ + + void + ngx_http_script_flush_complex_value(ngx_http_request_t *r, +diff -rNp a/src/http/ngx_http_script.h b/src/http/ngx_http_script.h +*** a/src/http/ngx_http_script.h 2010-09-13 13:44:43.000000000 +0100 +--- b/src/http/ngx_http_script.h 2010-10-09 14:33:40.000000000 +0100 +*************** +*** 12,17 **** +--- 12,25 ---- + #include + #include + ++ #if (NDK_EXPOSE_REWRITE_FUNCTIONS) ++ ++ #define ngx_http_script_exit (u_char *) &ngx_http_script_exit_code ++ ++ extern uintptr_t ngx_http_script_exit_code; ++ ++ #endif ++ + + typedef struct { + u_char *ip; diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/rewrite_phase_handler b/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/rewrite_phase_handler new file mode 100644 index 0000000..bd5161f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/patches/rewrite_phase_handler @@ -0,0 +1,19 @@ +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/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/md5.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/md5.h new file mode 100644 index 0000000..4cbf843 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/md5.h @@ -0,0 +1,117 @@ +/* crypto/md5/md5.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_MD5_H +#define HEADER_MD5_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef OPENSSL_NO_MD5 +#error MD5 is disabled. +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! MD5_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! MD5_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(__LP32__) +#define MD5_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define MD5_LONG unsigned long +#define MD5_LONG_LOG2 3 +/* + * _CRAY note. I could declare short, but I have no idea what impact + * does it have on performance on none-T3E machines. I could declare + * int, but at least on C90 sizeof(int) can be chosen at compile time. + * So I've chosen long... + * + */ +#else +#define MD5_LONG unsigned int +#endif + +#define MD5_CBLOCK 64 +#define MD5_LBLOCK (MD5_CBLOCK/4) +#define MD5_DIGEST_LENGTH 16 + +typedef struct MD5state_st + { + MD5_LONG A,B,C,D; + MD5_LONG Nl,Nh; + MD5_LONG data[MD5_LBLOCK]; + unsigned int num; + } MD5_CTX; + +int MD5_Init(MD5_CTX *c); +int MD5_Update(MD5_CTX *c, const void *data, size_t len); +int MD5_Final(unsigned char *md, MD5_CTX *c); +unsigned char *MD5(const unsigned char *d, size_t n, unsigned char *md); +void MD5_Transform(MD5_CTX *c, const unsigned char *b); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/murmurhash2.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/murmurhash2.c new file mode 100644 index 0000000..ac899b4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/murmurhash2.c @@ -0,0 +1,77 @@ + + +#ifndef MURMURHASH2_C +#define MURMURHASH2_C + +#define MURMURHASH2_DIGEST_LENGTH 4 + +/* + * ----------------------------------------------------------------------------- + * MurmurHash2, by Austin Appleby + + * Note - This code makes a few assumptions about how your machine behaves - + + * 1. We can read a 4-byte value from any address without crashing + * 2. sizeof(int) == 4 + + * And it has a few limitations - + + * 1. It will not work incrementally. + * 2. It will not produce the same results on little-endian and big-endian + * machines. + */ + +unsigned int MurmurHash2 ( const void * key, int len, unsigned int seed ) +{ + /* + * 'm' and 'r' are mixing constants generated offline. + * They're not really 'magic', they just happen to work well. + */ + + const unsigned int m = 0x5bd1e995; + const int r = 24; + + /* Initialize the hash to a 'random' value */ + + unsigned int h = seed ^ len; + + /* Mix 4 bytes at a time into the hash */ + + const unsigned char * data = (const unsigned char *)key; + + while(len >= 4) + { + unsigned int k = *(unsigned int *)data; + + k *= m; + k ^= k >> r; + k *= m; + + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + /* Handle the last few bytes of the input array */ + + switch(len) + { + case 3: h ^= data[2] << 16; + case 2: h ^= data[1] << 8; + case 1: h ^= data[0]; + h *= m; + }; + + /* Do a few final mixes of the hash to ensure the last few + * bytes are well-incorporated. */ + + h ^= h >> 13; + h *= m; + h ^= h >> 15; + + return h; +} + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/sha.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/sha.h new file mode 100644 index 0000000..16cacf9 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/hash/sha.h @@ -0,0 +1,200 @@ +/* crypto/sha/sha.h */ +/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_SHA_H +#define HEADER_SHA_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(OPENSSL_NO_SHA) || (defined(OPENSSL_NO_SHA0) && defined(OPENSSL_NO_SHA1)) +#error SHA is disabled. +#endif + +#if defined(OPENSSL_FIPS) +#define FIPS_SHA_SIZE_T size_t +#endif + +/* + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + * ! SHA_LONG has to be at least 32 bits wide. If it's wider, then ! + * ! SHA_LONG_LOG2 has to be defined along. ! + * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + */ + +#if defined(__LP32__) +#define SHA_LONG unsigned long +#elif defined(OPENSSL_SYS_CRAY) || defined(__ILP64__) +#define SHA_LONG unsigned long +#define SHA_LONG_LOG2 3 +#else +#define SHA_LONG unsigned int +#endif + +#define SHA_LBLOCK 16 +#define SHA_CBLOCK (SHA_LBLOCK*4) /* SHA treats input data as a + * contiguous array of 32 bit + * wide big-endian values. */ +#define SHA_LAST_BLOCK (SHA_CBLOCK-8) +#define SHA_DIGEST_LENGTH 20 + +typedef struct SHAstate_st + { + SHA_LONG h0,h1,h2,h3,h4; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num; + } SHA_CTX; + +#ifndef OPENSSL_NO_SHA0 +int SHA_Init(SHA_CTX *c); +int SHA_Update(SHA_CTX *c, const void *data, size_t len); +int SHA_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA(const unsigned char *d, size_t n, unsigned char *md); +void SHA_Transform(SHA_CTX *c, const unsigned char *data); +#endif +#ifndef OPENSSL_NO_SHA1 +int SHA1_Init(SHA_CTX *c); +int SHA1_Update(SHA_CTX *c, const void *data, size_t len); +int SHA1_Final(unsigned char *md, SHA_CTX *c); +unsigned char *SHA1(const unsigned char *d, size_t n, unsigned char *md); +void SHA1_Transform(SHA_CTX *c, const unsigned char *data); +#endif + +#define SHA256_CBLOCK (SHA_LBLOCK*4) /* SHA-256 treats input data as a + * contiguous array of 32 bit + * wide big-endian values. */ +#define SHA224_DIGEST_LENGTH 28 +#define SHA256_DIGEST_LENGTH 32 + +typedef struct SHA256state_st + { + SHA_LONG h[8]; + SHA_LONG Nl,Nh; + SHA_LONG data[SHA_LBLOCK]; + unsigned int num,md_len; + } SHA256_CTX; + +#ifndef OPENSSL_NO_SHA256 +int SHA224_Init(SHA256_CTX *c); +int SHA224_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA224_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA224(const unsigned char *d, size_t n,unsigned char *md); +int SHA256_Init(SHA256_CTX *c); +int SHA256_Update(SHA256_CTX *c, const void *data, size_t len); +int SHA256_Final(unsigned char *md, SHA256_CTX *c); +unsigned char *SHA256(const unsigned char *d, size_t n,unsigned char *md); +void SHA256_Transform(SHA256_CTX *c, const unsigned char *data); +#endif + +#define SHA384_DIGEST_LENGTH 48 +#define SHA512_DIGEST_LENGTH 64 + +#ifndef OPENSSL_NO_SHA512 +/* + * Unlike 32-bit digest algorithms, SHA-512 *relies* on SHA_LONG64 + * being exactly 64-bit wide. See Implementation Notes in sha512.c + * for further details. + */ +#define SHA512_CBLOCK (SHA_LBLOCK*8) /* SHA-512 treats input data as a + * contiguous array of 64 bit + * wide big-endian values. */ +#if (defined(_WIN32) || defined(_WIN64)) && !defined(__MINGW32__) +#define SHA_LONG64 unsigned __int64 +#define U64(C) C##UI64 +#elif defined(__arch64__) +#define SHA_LONG64 unsigned long +#define U64(C) C##UL +#else +#define SHA_LONG64 unsigned long long +#define U64(C) C##ULL +#endif + +typedef struct SHA512state_st + { + SHA_LONG64 h[8]; + SHA_LONG64 Nl,Nh; + union { + SHA_LONG64 d[SHA_LBLOCK]; + unsigned char p[SHA512_CBLOCK]; + } u; + unsigned int num,md_len; + } SHA512_CTX; +#endif + +#ifndef OPENSSL_NO_SHA512 +int SHA384_Init(SHA512_CTX *c); +int SHA384_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA384_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA384(const unsigned char *d, size_t n,unsigned char *md); +int SHA512_Init(SHA512_CTX *c); +int SHA512_Update(SHA512_CTX *c, const void *data, size_t len); +int SHA512_Final(unsigned char *md, SHA512_CTX *c); +unsigned char *SHA512(const unsigned char *d, size_t n,unsigned char *md); +void SHA512_Transform(SHA512_CTX *c, const unsigned char *data); +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.c new file mode 100644 index 0000000..d57040a --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.c @@ -0,0 +1,155 @@ + +/* + * 2010 (C) Marcus Clyne + */ + +#include + +#include + + +#if (NDK_HTTP_PRE_CONFIG) +static ngx_int_t ndk_http_preconfiguration (ngx_conf_t *cf); +#endif +#if (NDK_HTTP_POST_CONFIG) +static ngx_int_t ndk_http_postconfiguration (ngx_conf_t *cf); +#endif +#if (NDK_HTTP_CREATE_MAIN_CONF) +static void * ndk_http_create_main_conf (ngx_conf_t *cf); +#endif +#if (NDK_HTTP_INIT_MAIN_CONF) +static char * ndk_http_init_main_conf (ngx_conf_t *cf, void *conf); +#endif +#if (NDK_HTTP_CREATE_SRV_CONF) +static void * ndk_http_create_srv_conf (ngx_conf_t *cf); +#endif +#if (NDK_HTTP_MERGE_SRV_CONF) +static char * ndk_http_merge_srv_conf (ngx_conf_t *cf, void *parent, void *child); +#endif +#if (NDK_HTTP_CREATE_LOC_CONF) +static void * ndk_http_create_loc_conf (ngx_conf_t *cf); +#endif +#if (NDK_HTTP_MERGE_LOC_CONF) +static char * ndk_http_merge_loc_conf (ngx_conf_t *cf, void *parent, void *child); +#endif + + +#if (NDK_HTTP_INIT_MASTER) +static ngx_int_t ndk_http_init_master (ngx_log_t *log); +#endif +#if (NDK_HTTP_INIT_MODULE) +static ngx_int_t ndk_http_init_module (ngx_cycle_t *cycle); +#endif +#if (NDK_HTTP_INIT_PROCESS) +static ngx_int_t ndk_http_init_process (ngx_cycle_t *cycle); +#endif +#if (NDK_HTTP_EXIT_PROCESS) +static void ndk_http_exit_process (ngx_cycle_t *cycle); +#endif +#if (NDK_HTTP_EXIT_MASTER) +static void ndk_http_exit_master (ngx_cycle_t *cycle); +#endif + + +ngx_http_module_t ndk_http_module_ctx = { + +#if (NDK_HTTP_PRE_CONFIG) + ndk_http_preconfiguration, +#else + NULL, +#endif +#if (NDK_HTTP_POST_CONFIG) + ndk_http_postconfiguration, +#else + NULL, +#endif + +#if (NDK_HTTP_CREATE_MAIN_CONF) + ndk_http_create_main_conf, +#else + NULL, +#endif +#if (NDK_HTTP_INIT_MAIN_CONF) + ndk_http_merge_main_conf, +#else + NULL, +#endif + +#if (NDK_HTTP_CREATE_SVR_CONF) + ndk_http_create_srv_conf, +#else + NULL, +#endif +#if (NDK_HTTP_MERGE_SVR_CONF) + ndk_http_merge_srv_conf, +#else + NULL, +#endif + +#if (NDK_HTTP_CREATE_LOC_CONF) + ndk_http_create_loc_conf, +#else + NULL, +#endif +#if (NDK_HTTP_MERGE_LOC_CONF) + ndk_http_merge_loc_conf, +#else + NULL, +#endif + +}; + +ngx_module_t ndk_http_module = { + + NGX_MODULE_V1, + &ndk_http_module_ctx, /* module context */ + ndk_http_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + +#if (NDK_HTTP_INIT_MASTER) + ndk_http_init_master, +#else + NULL, +#endif + +#if (NDK_HTTP_INIT_MODULE) + ndk_http_init_module, +#else + NULL, +#endif +#if (NDK_HTTP_INIT_PROCESS) + ndk_http_init_process, +#else + NULL, +#endif + + NULL, /* init thread */ + NULL, /* exit thread */ + +#if (NDK_HTTP_EXIT_PROCESS) + ndk_http_exit_process, +#else + NULL, +#endif +#if (NDK_HTTP_EXIT_MASTER) + ndk_http_exit_master, +#else + NULL, +#endif + NGX_MODULE_V1_PADDING +}; + + + +#if (NDK_HTTP_CREATE_MAIN_CONF) +static void * +ndk_http_create_main_conf (ngx_conf_t *cf) +{ + ndk_http_main_conf_t *mcf; + + ndk_pcallocp_rce (mcf, cf->pool); + + return mcf; +} +#endif + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h new file mode 100644 index 0000000..e08dfac --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk.h @@ -0,0 +1,53 @@ + +/* + * 2010 (C) Marcus Clyne +*/ + + +#ifndef NDK_H +#define NDK_H + + +#include +#include +#include + + +#define ndk_version 3004 +#define NDK_VERSION "0.3.4" + + +#if (NGX_DEBUG) +#ifndef NDK_DEBUG +#define NDK_DEBUG 1 +#endif +#else +#ifndef NDK_DEBUG +#define NDK_DEBUG 0 +#endif +#endif + + +#include + + +#if (NDK_HTTP_CREATE_MAIN_CONF) + +#define ndk_http_conf_get_main_conf(cf) ngx_http_conf_get_module_main_conf (cf, ndk_http_module) +#define ndk_http_get_main_conf(r) ngx_http_get_module_main_conf (r, ndk_http_module) + +typedef struct { +#if (NDK_UPSTREAM_LIST) + ngx_array_t *upstreams; +#endif +} ndk_http_main_conf_t; + +#endif /* NDK_HTTP_CREATE_MAIN_CONF */ + +#include + + +extern ngx_module_t ndk_http_module; + + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c new file mode 100644 index 0000000..c491f72 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.c @@ -0,0 +1,43 @@ + +ngx_int_t +ndk_copy_chain_to_str (ngx_pool_t *pool, ngx_chain_t *in, ngx_str_t *str) +{ + ngx_chain_t *cl; + size_t len; + u_char *p; + ngx_buf_t *b; + + len = 0; + for (cl = in; cl; cl = cl->next) + len += ngx_buf_size (cl->buf); + + ndk_palloc_re (p, pool, len + 1); + + str->data = p; + str->len = len; + + for (cl = in; cl; cl = cl->next) { + + b = cl->buf; + + if (ngx_buf_in_memory (b)) { + p = ngx_cpymem (p, b->pos, b->last - b->pos); + } + } + + *p = '\0'; + + return NGX_OK; +} + + +char * +ndk_copy_chain_to_charp (ngx_pool_t *pool, ngx_chain_t *in) +{ + ngx_str_t str; + + if (ndk_copy_chain_to_str (pool, in, &str) != NGX_OK) + return NULL; + + return (char *) str.data; +} \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h new file mode 100644 index 0000000..e6334ad --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_buf.h @@ -0,0 +1,5 @@ + + +ngx_int_t ndk_copy_chain_to_str (ngx_pool_t *pool, ngx_chain_t *in, ngx_str_t *str); +char * ndk_copy_chain_to_charp (ngx_pool_t *pool, ngx_chain_t *in); + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c new file mode 100644 index 0000000..8b32713 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.c @@ -0,0 +1,129 @@ + + +ndk_http_complex_path_value_t ndk_empty_http_complex_path_value = {{0,NULL},0}; + + +ngx_int_t +ndk_http_complex_path_value_compile (ngx_conf_t *cf, ngx_http_complex_value_t *cv, ngx_str_t *value, ngx_uint_t prefix) +{ + ngx_http_compile_complex_value_t ccv; + + ngx_memzero (&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = value; + ccv.complex_value = cv; + + switch (prefix) { + + case 1 : + ccv.root_prefix = 1; + break; + + case 2 : + ccv.conf_prefix = 1; + break; + } + + ndk_path_to_dir_safe (value, 1, 0); + + if (!value->len) + return NGX_OK; + + return ngx_http_compile_complex_value (&ccv); +} + + + +ngx_array_t * +ndk_http_complex_path_create_compile (ngx_conf_t *cf, ngx_str_t *path, ngx_uint_t prefix) +{ + ndk_http_complex_path_elt_t *cpe; + ngx_array_t *a; + ngx_int_t n; + u_char *m, *s, *e; + ngx_str_t value; + + n = ndk_strcntc (path, ':') + 1; + + a = ngx_array_create (cf->pool, n, sizeof (ndk_http_complex_path_elt_t)); + if (a == NULL) { + return NULL; + } + + s = path->data; + e = s + path->len; + + + while (s < e) { + + m = s; + + while (m < e && *m != ':') m++; + + if (m == s) { + s = m+1; + continue; + } + + cpe = ngx_array_push (a); + if (cpe == NULL) { + return NULL; + } + + if (*s == '#') { + s++; + cpe->dynamic = 1; + } else { + cpe->dynamic = 0; + } + + value.data = s; + value.len = m - s; + + if (ndk_http_complex_path_value_compile (cf, &cpe->val, &value, prefix) == NGX_ERROR) + return NULL; + + s = m+1; + } + + return a; +} + + + + +char * +ndk_conf_set_http_complex_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *path; + ngx_conf_post_t *post; + ndk_http_complex_path_t *cp; + + cp = (ndk_http_complex_path_t *) (p + cmd->offset); + + if (cp->a != NGX_CONF_UNSET_PTR) { + return "is duplicate"; + } + + path = cf->args->elts; + path++; + + cp->a = ndk_http_complex_path_create_compile (cf, path, cp->prefix); + if (cp->a == NULL) { + /* TODO : log */ + return NGX_CONF_ERROR; + } + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, cp->a); + } + + return NGX_CONF_OK; +} + + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.h new file mode 100644 index 0000000..eb93d1f --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_path.h @@ -0,0 +1,30 @@ + + +typedef struct { + ngx_array_t *a; + ngx_uint_t prefix; +} ndk_http_complex_path_t; + +typedef struct { + ngx_http_complex_value_t val; + ngx_flag_t dynamic; +} ndk_http_complex_path_elt_t; + +typedef struct { + ngx_str_t val; + ngx_flag_t dynamic; +} ndk_http_complex_path_value_t; + +typedef struct { + ndk_http_complex_path_value_t *elts; + ngx_uint_t nelts; +} ndk_http_complex_path_values_t; + + +extern ndk_http_complex_path_value_t ndk_empty_http_complex_path_value; + + +ngx_array_t * ndk_http_complex_path_create_compile (ngx_conf_t *cf, ngx_str_t *path, ngx_uint_t prefix); +ngx_int_t ndk_http_complex_path_value_compile (ngx_conf_t *cf, ngx_http_complex_value_t *cv, + ngx_str_t *value, ngx_uint_t prefix); +char * ndk_conf_set_http_complex_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c new file mode 100644 index 0000000..97681ff --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.c @@ -0,0 +1,192 @@ + + + +ngx_int_t +ndk_http_complex_value_compile (ngx_conf_t *cf, ngx_http_complex_value_t *cv, ngx_str_t *value) +{ + ngx_http_compile_complex_value_t ccv; + + ngx_memzero (&ccv, sizeof(ngx_http_compile_complex_value_t)); + + ccv.cf = cf; + ccv.value = value; + ccv.complex_value = cv; + + return ngx_http_compile_complex_value (&ccv); +} + + + + +ngx_array_t * +ndk_http_complex_value_array_create (ngx_conf_t *cf, char **s, ngx_int_t n) +{ + ngx_int_t i; + ngx_http_complex_value_t *cv; + ngx_array_t *a; + ngx_str_t value; + + a = ngx_array_create (cf->pool, n, sizeof (ngx_http_complex_value_t)); + if (a == NULL) + return NULL; + + + for (i=0; ielts; + + for (i=0; inelts; i++, cv++) { + + if (ndk_http_complex_value_compile (cf, cv, &cv->value)) + return NGX_ERROR; + } + + return NGX_OK; +} + + + +char * +ndk_conf_set_http_complex_value_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_http_complex_value_t *cv; + ngx_str_t *value; + ngx_conf_post_t *post; + + cv = (ngx_http_complex_value_t *) (p + cmd->offset); + + if (cv->value.data) { + return "is duplicate"; + } + + value = cf->args->elts; + + if (ndk_http_complex_value_compile (cf, cv, value + 1)) + return NGX_CONF_ERROR; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, cv); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_http_complex_value_array_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_http_complex_value_t *cv; + ngx_array_t **a; + ngx_conf_post_t *post; + ngx_uint_t i, alloc; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a == NULL || *a == NGX_CONF_UNSET_PTR) { + + alloc = cf->args->nelts > 4 ? cf->args->nelts : 4; + + *a = ngx_array_create (cf->pool, alloc, sizeof (ngx_http_complex_value_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + } + + value = cf->args->elts; + + for (i=1; iargs->nelts; i++) { + + cv = ngx_array_push (*a); + if (cv == NULL) { + return NGX_CONF_ERROR; + } + + if (ndk_http_complex_value_compile (cf, cv, &value[i]) == NGX_ERROR) + return NGX_CONF_ERROR; + } + + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, a); + } + + return NGX_CONF_OK; +} + + +char * +ndk_conf_set_http_complex_keyval_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ndk_http_complex_keyval_t *ckv; + ngx_array_t **a; + ngx_conf_post_t *post; + ngx_int_t alloc; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a == NULL || *a == NGX_CONF_UNSET_PTR) { + + alloc = cf->args->nelts > 4 ? cf->args->nelts : 4; + + *a = ngx_array_create (cf->pool, alloc, sizeof (ndk_http_complex_keyval_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + } + + ckv = ngx_array_push (*a); + if (ckv == NULL) { + return NGX_CONF_ERROR; + } + + value = cf->args->elts; + + ckv->key = value[1]; + + if (ndk_http_complex_value_compile (cf, &ckv->value, &value[2]) == NGX_ERROR) + return NGX_CONF_ERROR; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, a); + } + + return NGX_CONF_OK; +} + +/* TODO : complex keyval1 */ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.h new file mode 100644 index 0000000..4178d62 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_complex_value.h @@ -0,0 +1,21 @@ + + +typedef struct { + ngx_str_t key; + ngx_http_complex_value_t value; +} ndk_http_complex_keyval_t; + + + +/* create/compile functions */ + +ngx_int_t ndk_http_complex_value_compile (ngx_conf_t *cf, ngx_http_complex_value_t *cv, ngx_str_t *value); +ngx_array_t * ndk_http_complex_value_array_create (ngx_conf_t *cf, char **s, ngx_int_t n); +ngx_int_t ndk_http_complex_value_array_compile (ngx_conf_t *cf, ngx_array_t *a); + + +/* conf set slot functions */ + +char * ndk_conf_set_http_complex_keyval_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_http_complex_value_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_http_complex_value_array_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.c new file mode 100644 index 0000000..980641c --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.c @@ -0,0 +1,396 @@ + + +/* NOTE : you will find other conf_set functions in the following files : + * + * complex_value.c + * encoding.c + * path.c + * + */ + + +char * +ndk_conf_set_true_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_flag_t *fp; + ngx_conf_post_t *post; + + fp = (ngx_flag_t*) (p + cmd->offset); + + if (*fp != NGX_CONF_UNSET) { + return "is duplicate"; + } + + *fp = 1; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, fp); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_false_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_flag_t *fp; + ngx_conf_post_t *post; + + fp = (ngx_flag_t*) (p + cmd->offset); + + if (*fp != NGX_CONF_UNSET) { + return "is duplicate"; + } + + *fp = 0; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, fp); + } + + return NGX_CONF_OK; +} + + + + +char * +ndk_conf_set_ptr_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + void **ptr; + + ptr = (void**) (p + cmd->offset); + + if (*ptr != NGX_CONF_UNSET_PTR) { + return "is duplicate"; + } + + *ptr = cmd->post; + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_null_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + void **pp; + ngx_conf_post_t *post; + + pp = (void **) (p + cmd->offset); + + if (*pp != NGX_CONF_UNSET_PTR) { + return "is duplicate"; + } + + *pp = NULL; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, pp); + } + + return NGX_CONF_OK; +} + + +char * +ndk_conf_set_num64_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + int64_t *np; + ngx_str_t *value; + ngx_conf_post_t *post; + + + np = (int64_t *) (p + cmd->offset); + + if (*np != NGX_CONF_UNSET) { + return "is duplicate"; + } + + value = cf->args->elts; + *np = ndk_atoi64 (value[1].data, value[1].len); + if (*np == NGX_ERROR) { + return "invalid number"; + } + + if (cmd->post) { + post = cmd->post; + return post->post_handler(cf, post, np); + } + + return NGX_CONF_OK; +} + + +char * +ndk_conf_set_str_array_multi_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value, *s; + ngx_array_t **a; + ngx_conf_post_t *post; + ngx_uint_t i; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a == NGX_CONF_UNSET_PTR) { + *a = ngx_array_create(cf->pool, 4, sizeof(ngx_str_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + } + + s = NULL; + + for (i=cf->args->nelts-1; i; i--) { + + s = ngx_array_push(*a); + if (s == NULL) { + return NGX_CONF_ERROR; + } + + value = cf->args->elts; + + *s = value[i]; + } + + if (cmd->post) { + post = cmd->post; + return post->post_handler(cf, post, s); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_keyval1_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_keyval_t *kv; + ngx_conf_post_t *post; + + kv = (ngx_keyval_t *) (p + cmd->offset); + + if (kv->key.data) + return "is duplicate"; + + value = cf->args->elts; + + kv->key = value[1]; + kv->value = value[2]; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, kv); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_num_flag_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_int_t *np; + ngx_str_t *value; + ngx_conf_post_t *post; + + np = (ngx_int_t *) (p + cmd->offset); + + if (*np != NGX_CONF_UNSET) { + return "is duplicate"; + } + + value = cf->args->elts; + + if (ngx_strcasecmp (value[1].data, (u_char *) "on") == 0) { + *np = NDK_CONF_SET_TRUE; + + } else if (ngx_strcasecmp (value[1].data, (u_char *) "off") == 0) { + *np = NDK_CONF_SET_FALSE; + + } else { + *np = ngx_atoi (value[1].data, value[1].len); + if (*np == NGX_ERROR) { + return "invalid number and not 'on'/'off'"; + } + } + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, np); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_sec_flag_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + time_t *tp; + ngx_str_t *value; + ngx_conf_post_t *post; + + tp = (time_t *) (p + cmd->offset); + + if (*tp != NGX_CONF_UNSET) { + return "is duplicate"; + } + + value = cf->args->elts; + + if (ngx_strcasecmp (value[1].data, (u_char *) "on") == 0) { + *tp = NDK_CONF_SET_TRUE; + + } else if (ngx_strcasecmp (value[1].data, (u_char *) "off") == 0) { + *tp = NDK_CONF_SET_FALSE; + + } else { + *tp = ngx_parse_time (&value[1], 1); + if (*tp == NGX_ERROR) { + return "has an invalid time and not 'on'/'off'"; + } + } + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, tp); + } + + return NGX_CONF_OK; +} + + + +ngx_http_conf_ctx_t * +ndk_conf_create_http_location (ngx_conf_t *cf) +{ + ngx_http_conf_ctx_t *ctx, *pctx; + void *mconf; + ngx_http_core_loc_conf_t *clcf, *pclcf; + ngx_uint_t i; + ngx_http_module_t *module; + + ndk_pcallocp_rce (ctx, cf->pool); + + pctx = cf->ctx; + ctx->main_conf = pctx->main_conf; + ctx->srv_conf = pctx->srv_conf; + + ndk_pcalloc_rce (ctx->loc_conf, cf->pool, sizeof(void *) * ngx_http_max_module); + + + for (i = 0; ngx_modules[i]; i++) { + if (ngx_modules[i]->type != NGX_HTTP_MODULE) { + continue; + } + + module = ngx_modules[i]->ctx; + + if (module->create_loc_conf) { + + mconf = module->create_loc_conf(cf); + if (mconf == NULL) { + return NGX_CONF_ERROR; + } + + ctx->loc_conf[ngx_modules[i]->ctx_index] = mconf; + } + } + + pclcf = pctx->loc_conf[ngx_http_core_module.ctx_index]; + + clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; + clcf->loc_conf = ctx->loc_conf; + clcf->name = pclcf->name; + clcf->noname = 1; + + if (ngx_http_add_location(cf, &pclcf->locations, clcf) != NGX_OK) { + return NGX_CONF_ERROR; + } + + return ctx; +} + + +ngx_http_conf_ctx_t * +ngx_conf_create_http_named_location (ngx_conf_t *cf, ngx_str_t *name) +{ + ngx_http_conf_ctx_t *ctx; + ngx_http_core_loc_conf_t *clcf; + + ctx = ndk_conf_create_http_location (cf); + if (ctx == NGX_CONF_ERROR) + return NGX_CONF_ERROR; + + clcf = ctx->loc_conf[ngx_http_core_module.ctx_index]; + + /* in case the developer forgets to add '@' at the beginning of the named location */ + + if (name->data[0] != '@' && ndk_catstrf (cf->pool, name, "sS", "@", name) == NULL) + return NGX_CONF_ERROR; + + clcf->name = *name; /* TODO : copy? */ + clcf->noname = 0; + clcf->named = 1; + + return ctx; +} + + +ngx_int_t +ndk_replace_command (ngx_command_t *new_cmd, ngx_uint_t module_type) +{ + ngx_uint_t i; + ngx_command_t *cmd; + + for (i = 0; ngx_modules[i]; i++) { + + if (ngx_modules[i]->type != module_type) + continue; + + cmd = ngx_modules[i]->commands; + if (cmd == NULL) { + continue; + } + + for ( /* void */ ; cmd->name.len; cmd++) { + + if (ndk_cmpstr (&new_cmd->name, &cmd->name) == 0) { + + ndk_memcpyp (cmd, new_cmd); + return NGX_OK; + } + } + } + + return NGX_DECLINED; +} diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.h new file mode 100644 index 0000000..6956b17 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_conf_file.h @@ -0,0 +1,44 @@ + + +/* conf set functions */ + +char * ndk_conf_set_true_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_false_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_full_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_ptr_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_null_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_str_array_multi_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_keyval1_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_num_flag (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_num64_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_sec_flag_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + +ngx_http_conf_ctx_t * ndk_conf_create_http_location (ngx_conf_t *cf); +ngx_http_conf_ctx_t * ngx_conf_create_http_named_location (ngx_conf_t *cf, ngx_str_t *name); + +ngx_int_t ndk_replace_command (ngx_command_t *new_cmd, ngx_uint_t module_type); + + +/* values for conf_set_xxx_flag */ + +#define NDK_CONF_SET_TRUE -2 +#define NDK_CONF_SET_FALSE -3 + + +/* wrappers for utility macros */ + +#define ndk_conf_set_bitmask_slot ngx_conf_set_bitmask_slot +#define ndk_conf_set_bufs_slot ngx_conf_set_bufs_slot +#define ndk_conf_set_enum_slot ngx_conf_set_enum_slot +#define ndk_conf_set_flag_slot ngx_conf_set_flag_slot +#define ndk_conf_set_keyval_slot ngx_conf_set_keyval_slot +#define ndk_conf_set_msec_slot ngx_conf_set_msec_slot +#define ndk_conf_set_num_slot ngx_conf_set_num_slot +#define ndk_conf_set_off_slot ngx_conf_set_off_slot +#define ndk_conf_set_sec_slot ngx_conf_set_sec_slot +#define ndk_conf_set_size_slot ngx_conf_set_size_slot +#define ndk_conf_set_str_slot ngx_conf_set_str_slot + + + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.c new file mode 100644 index 0000000..e0251cc --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.c @@ -0,0 +1,72 @@ + +#if (NGX_DEBUG) + +void +ndk_debug_helper (const char *func, const char *fmt, ...) +{ + size_t len, flen, tlen; + char *s, *p, *e; + + /* check to see if the format is empty */ + + flen = strlen (fmt); + + /* build func name */ + + len = strlen (func); + + if (flen == 0) + tlen = len + 1; + else + + char func_name [len + flen + 1]; + + s = func_name; + e = s + len; + + memcpy (s, func, len); + + /* remove initial ngx_ */ + + if (strncmp (s, "ngx_", 4) == 0) + s += 4; + + /* replace '_' with ' ' */ + + for (p=s; pmethod_name.len, r->method_name.data, + (int) r->uri.len, r->uri.data, + (int) r->args.len, r->args.data, + 0/*(int) r->main->count*/, r->main, + r, r->connection->data, r->parent); + + if (r->posted_requests) { + fprintf(stderr, " posted:"); + + for (pr = r->posted_requests; pr; pr = pr->next) { + fprintf (stderr, "%p,", pr); + } + } + + fprintf (stderr, "\n"); +} + + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.h new file mode 100644 index 0000000..883a6eb --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_debug.h @@ -0,0 +1,171 @@ +#ifndef NDK_DEBUG_H +#define NDK_DEBUG_H + + +/* TODO : use the Nginx printf function */ + + +#include +#include + +/* TODO +- andk_debug variety of debugging formats +- global include file for all debugging - can pass declaration to cflags for the option +*/ + + +#if (NDK_DEBUG) + + #if (NGX_HAVE_VARIADIC_MACROS) + + #define ndk_debug(...) ndk_debug_helper (__func__,__VA_ARGS__) + + #define ndk_debug_helper(func,...) \ + fprintf(stderr, "%-60s", func); \ + fprintf(stderr, (const char *)__VA_ARGS__); \ + fprintf(stderr,"\n"); + /*fprintf(stderr, " at %s line %d.\n", __FILE__, __LINE__)*/ + + #else + + /* NOTE : these includes might not be necessary since they're probably included with the core */ + + #include + #include + #include + + static void ndk_debug (const char * fmt, ...) { + } + + #endif + + #if NDK_DEBUG > 1 + + #define ndk_debug_request() ndk_debug_request_helper(r, __func__) + + static ngx_inline void + ndk_debug_request_helper (ngx_http_request_t *r, const char *func) + { + ngx_http_posted_request_t *pr; + + /* TODO : improve the format */ + + fprintf (stderr, "%s %.*s %.*s?%.*s c:%d m:%p r:%p ar:%p pr:%p", + func, + (int) r->method_name.len, r->method_name.data, + (int) r->uri.len, r->uri.data, + (int) r->args.len, r->args.data, + 0/*(int) r->main->count*/, r->main, + r, r->connection->data, r->parent); + + if (r->posted_requests) { + fprintf(stderr, " posted:"); + + for (pr = r->posted_requests; pr; pr = pr->next) { + fprintf (stderr, "%p,", pr); + } + } + + fprintf (stderr, "\n"); + } + + + #else + + #define ndk_debug_request() + + #endif + + + static ngx_inline void + ndk_debug_print_posted_requests (ngx_http_request_t *r) + { + ngx_http_posted_request_t *pr; + + ndk_request_log_debug_http (r, "ndk debug - http posted requests"); + + for (pr = r->main->posted_requests; pr; pr = pr->next) { + + if (!pr->request) + continue; + + ndk_request_log_debug_http (r, "ndk debug - http posted request:%V", &pr->request->uri); + } + } + + + #define ndk_debug_http_conf_location(cf) ndk_debug_http_conf_location_helper (cf, __func__) + + static ngx_inline void + ndk_debug_http_conf_location_helper (ngx_conf_t *cf, const char *func) + { + ngx_http_core_loc_conf_t *lcf; + + lcf = ngx_http_conf_get_module_loc_conf (cf, ngx_http_core_module); + + ndk_debug_helper (func, "[%s]", lcf->name.data); + } + + /* + static void + ndk_debug_log_chain (ngx_log_t *log, ngx_chain_t *cl) + { + + + } + */ + +#else + + #if (NGX_HAVE_VARIADIC_MACROS) + + #define ndk_debug(...) + #define ndk_debug_request() + + #else + + #include + + static void ndk_debug (const char * fmt, ...) { + } + + static void ndk_debug_request() { + } + + #endif + + #define ndk_debug_http_conf_location(cf) + +#endif + +#if (NDK_DEBUG) + + #define ndk_debug_check_read_event_handler(r) \ + \ + ndk_debug("r->read_event_handler = %s", \ + r->read_event_handler == ngx_http_block_reading ? \ + "ngx_http_block_reading" : \ + r->read_event_handler == ngx_http_test_reading ? \ + "ngx_http_test_reading" : \ + r->read_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + + #define ndk_debug_check_write_event_handler(r) \ + \ + ndk_debug ("r->write_event_handler = %s", \ + r->write_event_handler == ngx_http_handler ? \ + "ngx_http_handler" : \ + r->write_event_handler == ngx_http_core_run_phases ? \ + "ngx_http_core_run_phases" : \ + r->write_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#else + + #define ndk_debug_check_read_event_handler(r) + #define ndk_debug_check_write_event_handler(r) + +#endif + +#endif /* NDK_DEBUG_H */ + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.c new file mode 100644 index 0000000..4a07872 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.c @@ -0,0 +1,57 @@ + + + +char * +ndk_conf_set_encoding_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ndk_encoding_t *ep; + ngx_str_t *value; + size_t len; + iconv_t ic; + + ep = (ndk_encoding_t *) (p + cmd->offset); + if (ep->from && ep->to) + return "is duplicate"; + + value = cf->args->elts; + + + if (ep->from) { + + ep->to = (char *) value[1].data; + len = strlen (ep->from); + + } else if (ep->to) { + + ep->from = (char *) value[1].data; + len = strlen (ep->to); + + } else { + return "has no base encoding"; + } + + + if (len == value[1].len && !strncasecmp (ep->to, ep->from, len)) { + + ngx_log_error (NGX_LOG_WARN, cf->log, 0, + "\"%V\" '%V' encoding is ignored (no conversion)", &value[0], &value[1]); + + return NGX_CONF_OK; + } + + + ic = iconv_open (ep->to, ep->from); + if (ic == (iconv_t)-1) + return "has an invalid encoding"; + + + if (iconv_close (ic)) { + ngx_log_error (NGX_LOG_EMERG, cf->log, errno, "iconv_close()"); + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.h new file mode 100644 index 0000000..b295b18 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_encoding.h @@ -0,0 +1,12 @@ + + +#include + +typedef struct { + char *from; + char *to; +} ndk_encoding_t; + + +char * ndk_conf_set_encoding_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.c new file mode 100644 index 0000000..dec3d41 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.c @@ -0,0 +1,82 @@ + +#include + + + +/* openssl hashes */ + +#define NDK_OPENSSL_HASH(type,ctxt_type,upper) \ + u_char md [ctxt_type ## _DIGEST_LENGTH]; \ + ctxt_type ##_CTX c; \ + \ + type ## _Init (&c); \ + type ## _Update (&c, data, len); \ + type ## _Final (md, &c); \ + \ + ndk_hex_dump (p, (u_char *) md, ctxt_type ## _DIGEST_LENGTH); \ + if (upper) { \ + ndk_strtoupper (p, (ctxt_type ## _DIGEST_LENGTH) *2); \ + } + + +#ifdef NDK_MD5 + +void +ndk_md5_hash (u_char *p, char *data, size_t len) +{ + NDK_OPENSSL_HASH (MD5, MD5, 0); +} + +void +ndk_md5_hash_upper (u_char *p, char *data, size_t len) +{ + NDK_OPENSSL_HASH (MD5, MD5, 1); +} + +#endif +#ifdef NDK_SHA1 + +void +ndk_sha1_hash (u_char *p, char *data, size_t len) +{ + NDK_OPENSSL_HASH (SHA1, SHA, 0); +} + +void +ndk_sha1_hash_upper (u_char *p, char *data, size_t len) +{ + NDK_OPENSSL_HASH (SHA1, SHA, 1); +} + +#endif + + + +/* non-openssl hashes */ + +#ifdef NDK_MURMUR2 + +#include "hash/murmurhash2.c" + +void +ndk_murmur2_hash (u_char *p, char *data, size_t len) +{ + uint32_t hash; + + hash = MurmurHash2 (data, len, 47); + + ndk_hex_dump (p, (u_char*) &hash, 4); +} + +void +ndk_murmur2_hash_upper (u_char *p, char *data, size_t len) +{ + uint32_t hash; + + hash = MurmurHash2 (data, len, 47); + + ndk_hex_dump (p, (u_char*) &hash, 4); + ndk_strtoupper (p, 8); +} + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.h new file mode 100644 index 0000000..a15e923 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_hash.h @@ -0,0 +1,45 @@ + +#ifndef NDK_HASH_H +#define NDK_HASH_H + +#ifdef NDK_HASH_ALL + +#ifndef NDK_MD5 +#define NDK_MD5 +#endif + +#ifndef NDK_MURMUR2 +#define NDK_MURMUR2 +#endif + +#ifndef NDK_SHA1 +#define NDK_SHA1 +#endif + +#endif + +#include +#include +typedef void (*ndk_hash_pt) (u_char *p, char *data, size_t len); + + +#ifdef NDK_MD5 +#include +void ndk_md5_hash (u_char *p, char *data, size_t len); +void ndk_md5_hash_upper (u_char *p, char *data, size_t len); +#endif + +#ifdef NDK_MURMUR2 +#define MURMURHASH2_DIGEST_LENGTH 4 +void ndk_murmur2_hash (u_char *p, char *data, size_t len); +void ndk_murmur2_hash_upper (u_char *p, char *data, size_t len); +#endif + +#ifdef NDK_SHA1 +#include +void ndk_sha1_hash (u_char *p, char *data, size_t len); +void ndk_sha1_hash_upper (u_char *p, char *data, size_t len); +#endif + +#endif /* NDK_HASH_H */ + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.c new file mode 100644 index 0000000..60728bb --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.c @@ -0,0 +1,138 @@ + +ngx_uint_t +ndk_http_count_phase_handlers (ngx_http_core_main_conf_t *cmcf) +{ + ngx_http_phase_handler_t *ph; + ngx_uint_t i; + + ph = cmcf->phase_engine.handlers; + + for (i=0; ph[i].checker; i++) /* void */; + + return i; +} + + +ngx_uint_t +ndk_http_parse_request_method (ngx_str_t *m) +{ + switch (m->len) { + + case 3: + +#if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED) + { + u_char t[4]; + + ngx_memcpy (t, m->data, 3); + t[3] = ' '; + + if (ndk_str3_cmp (t, 'G', 'E', 'T', ' ')) { + return NGX_HTTP_GET; + } + + if (ndk_str3_cmp (t, 'P', 'U', 'T', ' ')) { + return NGX_HTTP_PUT; + } + } + +#else + + if (ndk_str3_cmp (m->data, 'G', 'E', 'T', ' ')) { + return NGX_HTTP_GET; + } + + if (ndk_str3_cmp (m->data, 'P', 'U', 'T', ' ')) { + return NGX_HTTP_PUT; + } + +#endif + break; + + case 4: + + if (m->data[1] == 'O') { + + if (ndk_str3Ocmp (m->data, 'P', 'O', 'S', 'T')) { + return NGX_HTTP_POST; + } + + if (ndk_str3Ocmp (m->data, 'C', 'O', 'P', 'Y')) { + return NGX_HTTP_COPY; + } + + if (ndk_str3Ocmp (m->data, 'M', 'O', 'V', 'E')) { + return NGX_HTTP_MOVE; + } + + if (ndk_str3Ocmp (m->data, 'L', 'O', 'C', 'K')) { + return NGX_HTTP_LOCK; + } + + } else { + + if (ndk_str4cmp (m->data, 'H', 'E', 'A', 'D')) { + return NGX_HTTP_HEAD; + } + } + + break; + + case 5: + + if (ndk_str5cmp (m->data, 'M', 'K', 'C', 'O', 'L')) { + return NGX_HTTP_MKCOL; + } + + if (ndk_str5cmp (m->data, 'P', 'A', 'T', 'C', 'H')) { + return NGX_HTTP_PATCH; + } + + if (ndk_str5cmp (m->data, 'T', 'R', 'A', 'C', 'E')) { + return NGX_HTTP_TRACE; + } + + break; + + case 6: + + if (ndk_str6cmp (m->data, 'D', 'E', 'L', 'E', 'T', 'E')) { + return NGX_HTTP_DELETE; + } + + if (ndk_str6cmp (m->data, 'U', 'N', 'L', 'O', 'C', 'K')) { + return NGX_HTTP_UNLOCK; + } + + break; + + case 7: + + if (ndk_str7_cmp (m->data, 'O', 'P', 'T', 'I', 'O', 'N', 'S', ' ')) + { + return NGX_HTTP_OPTIONS; + } + + break; + + case 8: + + if (ndk_str8cmp (m->data, 'P', 'R', 'O', 'P', 'F', 'I', 'N', 'D')) + { + return NGX_HTTP_PROPFIND; + } + + break; + + case 9: + + if (ndk_str9cmp (m->data, 'P', 'R', 'O', 'P', 'P', 'A', 'T', 'C', 'H')) + { + return NGX_HTTP_PROPPATCH; + } + + break; + } + + return 0; +} \ No newline at end of file diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.h new file mode 100644 index 0000000..6a9d1c5 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http.h @@ -0,0 +1,3 @@ + +ngx_uint_t ndk_http_count_phase_handlers (ngx_http_core_main_conf_t *cmcf); +ngx_uint_t ndk_http_parse_request_method (ngx_str_t *m); diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http_headers.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http_headers.h new file mode 100644 index 0000000..e71c70e --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_http_headers.h @@ -0,0 +1,35 @@ + + +/* TODO : organize and add */ +/* TODO : check - should it be r->main? */ + +#define ndk_http_uri(r) (r)->uri +#define ndk_http_request_uri(r) (r)->unparsed_uri + +#define ndk_http_header_in(r,name) ((r)->headers_in.name ? &(r)->headers_in.name->value : NULL) +#define ndk_http_header_out(r,name) ((r)->headers_out.name ? &(r)->headers_out.name->value : NULL) + +#define ndk_http_host_header(r) ndk_http_header_in (r, host) +#define ndk_http_connection_header(r) ndk_http_header_in (r, connection) +#define ndk_http_if_modified_since_header(r) ndk_http_header_in (r, if_modified_since) +#define ndk_http_user_agent_header(r) ndk_http_header_in (r, user_agent) +#define ndk_http_referer_header(r) ndk_http_header_in (r, referer) +#define ndk_http_content_length_header(r) ndk_http_header_in (r, content_length) +#define ndk_http_content_type_header(r) ndk_http_header_in (r, content_type) +#define ndk_http_range_header(r) ndk_http_header_in (r, range) +#define ndk_http_if_range_header(r) ndk_http_header_in (r, if_range) +#define ndk_http_transfer_encoding_header(r) ndk_http_header_in (r, transfer_encoding) +#define ndk_http_expect_header(r) ndk_http_header_in (r, expect) +#define ndk_http_accept_encoding_header(r) ndk_http_header_in (r, accept_encoding) +#define ndk_http_via_header(r) ndk_http_header_in (r, via) +#define ndk_http_authorization_header(r) ndk_http_header_in (r, authorization) +#define ndk_http_keep_alive_header(r) ndk_http_header_in (r, keep_alive) +#define ndk_http_x_forwarded_for_header(r) ndk_http_header_in (r, x_forwarded_for) +#define ndk_http_x_real_ip_header(r) ndk_http_header_in (r, x_real_ip) +#define ndk_http_accept_header(r) ndk_http_header_in (r, accept) +#define ndk_http_accept_language_header(r) ndk_http_header_in (r, accept_language) +#define ndk_http_depth_header(r) ndk_http_header_in (r, depth) +#define ndk_http_destination_header(r) ndk_http_header_in (r, destination) +#define ndk_http_overwrite_header(r) ndk_http_header_in (r, overwrite) +#define ndk_http_date_header(r) ndk_http_header_in (r, date) + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.c new file mode 100644 index 0000000..36dca15 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.c @@ -0,0 +1,3 @@ + + +/* TODO : the required functions if the compiler does not have variadic macros */ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.h new file mode 100644 index 0000000..1dd9c22 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_log.h @@ -0,0 +1,165 @@ + +/* TODO : fix the conf_log macros */ + +#define NGX_LOG_DEBUG_SCRIPT NGX_LOG_DEBUG_HTTP /* TODO : add new section to log/conf directives */ + +#define ndk_conf_to_log(cf) ((cf)->log) + +#ifndef ndk_request_to_log +#define ndk_request_to_log(r) ((r)->connection->log) +#endif + + +/*********************************/ + +#if (NGX_HAVE_C99_VARIADIC_MACROS) + +#define ndk_log_stderr(log,...) ngx_log_error (NGX_LOG_STDERR, log, 0, __VA_ARGS__) +#define ndk_log_emerg(log,...) ngx_log_error (NGX_LOG_EMERG, log, 0, __VA_ARGS__) +#define ndk_log_alert(log,...) ngx_log_error (NGX_LOG_ALERT, log, 0, __VA_ARGS__) +#define ndk_log_crit(log,...) ngx_log_error (NGX_LOG_CRIT, log, 0, __VA_ARGS__) +#define ndk_log_err(log,...) ngx_log_error (NGX_LOG_ERR, log, 0, __VA_ARGS__) +#define ndk_log_warning(log,...) ngx_log_error (NGX_LOG_WARN, log, 0, __VA_ARGS__) +#define ndk_log_notice(log,...) ngx_log_error (NGX_LOG_NOTICE, log, 0, __VA_ARGS__) +#define ndk_log_info(log,...) ngx_log_error (NGX_LOG_INFO, log, 0, __VA_ARGS__) + +#define ndk_conf_log_stderr(cf,...) ngx_conf_log_error (NGX_LOG_STDERR, cf, 0, __VA_ARGS__) +#define ndk_conf_log_emerg(cf,...) ngx_conf_log_error (NGX_LOG_EMERG, cf, 0, __VA_ARGS__) +#define ndk_conf_log_alert(cf,...) ngx_conf_log_error (NGX_LOG_ALERT, cf, 0, __VA_ARGS__) +#define ndk_conf_log_crit(cf,...) ngx_conf_log_error (NGX_LOG_CRIT, cf, 0, __VA_ARGS__) +#define ndk_conf_log_err(cf,...) ngx_conf_log_error (NGX_LOG_ERR, cf, 0, __VA_ARGS__) +#define ndk_conf_log_warning(cf,...) ngx_conf_log_error (NGX_LOG_WARN, cf, 0, __VA_ARGS__) +#define ndk_conf_log_notice(cf,...) ngx_conf_log_error (NGX_LOG_NOTICE, cf, 0, __VA_ARGS__) +#define ndk_conf_log_info(cf,...) ngx_conf_log_error (NGX_LOG_INFO, cf, 0, __VA_ARGS__) + +#define ndk_request_log_stderr(r,...) ndk_log_stderr (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_emerg(r,...) ndk_log_emerg (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_alert(r,...) ndk_log_alert (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_crit(r,...) ndk_log_crit (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_err(r,...) ndk_log_err (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_warning(r,...) ndk_log_warning (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_notice(r,...) ndk_log_notice (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_info(r,...) ndk_log_info (ndk_request_to_log(r), __VA_ARGS__) + + +#if (NGX_DEBUG) + +#define ndk_log_debug_core(log,...) ngx_log_debug (NGX_LOG_DEBUG_CORE, log, 0, __VA_ARGS__) +#define ndk_log_debug_alloc(log,...) ngx_log_debug (NGX_LOG_DEBUG_ALLOC, log, 0, __VA_ARGS__) +#define ndk_log_debug_mutex(log,...) ngx_log_debug (NGX_LOG_DEBUG_MUTEX, log, 0, __VA_ARGS__) +#define ndk_log_debug_event(log,...) ngx_log_debug (NGX_LOG_DEBUG_EVENT, log, 0, __VA_ARGS__) +#define ndk_log_debug_http(log,...) ngx_log_debug (NGX_LOG_DEBUG_HTTP, log, 0, __VA_ARGS__) +#define ndk_log_debug_mail(log,...) ngx_log_debug (NGX_LOG_DEBUG_MAIL, log, 0, __VA_ARGS__) +#define ndk_log_debug_mysql(log,...) ngx_log_debug (NGX_LOG_DEBUG_MYSQL, log, 0, __VA_ARGS__) + +#define ndk_conf_log_debug_core(r,...) ndk_log_debug_core (ndk_conf_to_log(r), __VA_ARGS__) +#define ndk_conf_log_debug_alloc(r,...) ndk_log_debug_alloc (ndk_conf_to_log(r), __VA_ARGS__) +#define ndk_conf_log_debug_mutex(r,...) ndk_log_debug_mutex (ndk_conf_to_log(r), __VA_ARGS__) +#define ndk_conf_log_debug_event(r,...) ndk_log_debug_event (ndk_conf_to_log(r), __VA_ARGS__) +#define ndk_conf_log_debug_http(r,...) ndk_log_debug_http (ndk_conf_to_log(r), __VA_ARGS__) +#define ndk_conf_log_debug_mail(r,...) ndk_log_debug_mail (ndk_conf_to_log(r), __VA_ARGS__) +#define ndk_conf_log_debug_mysql(r,...) ndk_log_debug_mysql (ndk_conf_to_log(r), __VA_ARGS__) + +#define ndk_request_log_debug_core(r,...) ndk_log_debug_core (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_debug_alloc(r,...) ndk_log_debug_alloc (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_debug_mutex(r,...) ndk_log_debug_mutex (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_debug_event(r,...) ndk_log_debug_event (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_debug_http(r,...) ndk_log_debug_http (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_debug_mail(r,...) ndk_log_debug_mail (ndk_request_to_log(r), __VA_ARGS__) +#define ndk_request_log_debug_mysql(r,...) ndk_log_debug_mysql (ndk_request_to_log(r), __VA_ARGS__) + +#else + +#define ndk_log_debug_core(log,...) +#define ndk_log_debug_alloc(log,...) +#define ndk_log_debug_mutex(log,...) +#define ndk_log_debug_event(log,...) +#define ndk_log_debug_http(log,...) +#define ndk_log_debug_mail(log,...) +#define ndk_log_debug_mysql(log,...) + +#define ndk_conf_log_debug_core(r,...) +#define ndk_conf_log_debug_alloc(r,...) +#define ndk_conf_log_debug_mutex(r,...) +#define ndk_conf_log_debug_event(r,...) +#define ndk_conf_log_debug_http(r,...) +#define ndk_conf_log_debug_mail(r,...) +#define ndk_conf_log_debug_mysql(r,...) + +#define ndk_request_log_debug_core(r,...) +#define ndk_request_log_debug_alloc(r,...) +#define ndk_request_log_debug_mutex(r,...) +#define ndk_request_log_debug_event(r,...) +#define ndk_request_log_debug_http(r,...) +#define ndk_request_log_debug_mail(r,...) +#define ndk_request_log_debug_mysql(r,...) + +#endif + + +/*********************************/ + +#elif (NGX_HAVE_GCC_VARIADIC_MACROS) + +#define ndk_log_stderr(log,args...) ngx_log_error (NGX_LOG_STDERR, log, 0, args) +#define ndk_log_emerg(log,args...) ngx_log_error (NGX_LOG_EMERG, log, 0, args) +#define ndk_log_alert(log,args...) ngx_log_error (NGX_LOG_ALERT, log, 0, args) +#define ndk_log_crit(log,args...) ngx_log_error (NGX_LOG_CRIT, log, 0, args) +#define ndk_log_err(log,args...) ngx_log_error (NGX_LOG_ERR, log, 0, args) +#define ndk_log_warning(log,args...) ngx_log_error (NGX_LOG_WARN, log, 0, args) +#define ndk_log_notice(log,args...) ngx_log_error (NGX_LOG_NOTICE, log, 0, args) +#define ndk_log_info(log,args...) ngx_log_error (NGX_LOG_INFO, log, 0, args) + +#define ndk_log_debug_core(log,args...) ngx_log_debug (NGX_LOG_DEBUG_CORE, log, 0, args) +#define ndk_log_debug_alloc(log,args...) ngx_log_debug (NGX_LOG_DEBUG_ALLOC, log, 0, args) +#define ndk_log_debug_mutex(log,args...) ngx_log_debug (NGX_LOG_DEBUG_MUTEX, log, 0, args) +#define ndk_log_debug_event(log,args...) ngx_log_debug (NGX_LOG_DEBUG_EVENT, log, 0, args) +#define ndk_log_debug_http(log,args...) ngx_log_debug (NGX_LOG_DEBUG_HTTP, log, 0, args) +#define ndk_log_debug_mail(log,args...) ngx_log_debug (NGX_LOG_DEBUG_MAIL, log, 0, args) +#define ndk_log_debug_mysql(log,args...) ngx_log_debug (NGX_LOG_DEBUG_MYSQL, log, 0, args) +#define ndk_log_debug_script(log,args...) ngx_log_debug (NGX_LOG_DEBUG_SCRIPT, log, 0, args) + +#define ndk_conf_log_stderr(cf,args...) ngx_conf_log_error (NGX_LOG_STDERR, cf, 0, args) +#define ndk_conf_log_emerg(cf,args...) ngx_conf_log_error (NGX_LOG_EMERG, cf, 0, args) +#define ndk_conf_log_alert(cf,args...) ngx_conf_log_error (NGX_LOG_ALERT, cf, 0, args) +#define ndk_conf_log_crit(cf,args...) ngx_conf_log_error (NGX_LOG_CRIT, cf, 0, args) +#define ndk_conf_log_err(cf,args...) ngx_conf_log_error (NGX_LOG_ERR, cf, 0, args) +#define ndk_conf_log_warning(cf,args...) ngx_conf_log_error (NGX_LOG_WARN, cf, 0, args) +#define ndk_conf_log_notice(cf,args...) ngx_conf_log_error (NGX_LOG_NOTICE, cf, 0, args) +#define ndk_conf_log_info(cf,args...) ngx_conf_log_error (NGX_LOG_INFO, cf, 0, args) + +#define ndk_conf_log_debug_core(r,args...) ndk_log_debug_core (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_alloc(r,args...) ndk_log_debug_alloc (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_mutex(r,args...) ndk_log_debug_mutex (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_event(r,args...) ndk_log_debug_event (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_http(r,args...) ndk_log_debug_http (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_mail(r,args...) ndk_log_debug_mail (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_mysql(r,args...) ndk_log_debug_mysql (ndk_conf_to_log(r), args) +#define ndk_conf_log_debug_script(r,args...) ndk_log_debug_script (ndk_conf_to_log(r), args) + +#define ndk_request_log_stderr(r,args...) ndk_log_stderr (ndk_request_to_log(r), args) +#define ndk_request_log_emerg(r,args...) ndk_log_emerg (ndk_request_to_log(r), args) +#define ndk_request_log_alert(r,args...) ndk_log_alert (ndk_request_to_log(r), args) +#define ndk_request_log_crit(r,args...) ndk_log_crit (ndk_request_to_log(r), args) +#define ndk_request_log_err(r,args...) ndk_log_err (ndk_request_to_log(r), args) +#define ndk_request_log_warning(r,args...) ndk_log_warning (ndk_request_to_log(r), args) +#define ndk_request_log_notice(r,args...) ndk_log_notice (ndk_request_to_log(r), args) +#define ndk_request_log_info(r,args...) ndk_log_info (ndk_request_to_log(r), args) + +#define ndk_request_log_debug_core(r,args...) ndk_log_debug_core (ndk_request_to_log(r), args) +#define ndk_request_log_debug_alloc(r,args...) ndk_log_debug_alloc (ndk_request_to_log(r), args) +#define ndk_request_log_debug_mutex(r,args...) ndk_log_debug_mutex (ndk_request_to_log(r), args) +#define ndk_request_log_debug_event(r,args...) ndk_log_debug_event (ndk_request_to_log(r), args) +#define ndk_request_log_debug_http(r,args...) ndk_log_debug_http (ndk_request_to_log(r), args) +#define ndk_request_log_debug_mail(r,args...) ndk_log_debug_mail (ndk_request_to_log(r), args) +#define ndk_request_log_debug_mysql(r,args...) ndk_log_debug_mysql (ndk_request_to_log(r), args) +#define ndk_request_log_debug_script(r,args...) ndk_log_debug_script (ndk_request_to_log(r), args) + +/*********************************/ + +#else /* NO VARIADIC MACROS */ + +/* #warning does not work on Windows */ +#pragma message("Nginx Devel Kit logging without variadic macros not yet implemented") + +#endif /* VARIADIC MACROS */ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_parse.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_parse.h new file mode 100644 index 0000000..7c43e14 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_parse.h @@ -0,0 +1,67 @@ + + + +#if (NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED) + +#define ndk_str3_cmp(m, c0, c1, c2, c3) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) + +#define ndk_str3Ocmp(m, c0, c1, c2, c3) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) + +#define ndk_str4cmp(m, c0, c1, c2, c3) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) + +#define ndk_str5cmp(m, c0, c1, c2, c3, c4) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \ + && m[4] == c4 + +#define ndk_str6cmp(m, c0, c1, c2, c3, c4, c5) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \ + && (((uint32_t *) m)[1] & 0xffff) == ((c5 << 8) | c4) + +#define ndk_str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \ + && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) + +#define ndk_str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \ + && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) + +#define ndk_str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \ + *(uint32_t *) m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0) \ + && ((uint32_t *) m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \ + && m[8] == c8 + +#else /* !(NGX_HAVE_LITTLE_ENDIAN && NGX_HAVE_NONALIGNED) */ + +#define ndk_str3_cmp(m, c0, c1, c2, c3) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 + +#define ndk_str3Ocmp(m, c0, c1, c2, c3) \ + m[0] == c0 && m[2] == c2 && m[3] == c3 + +#define ndk_str4cmp(m, c0, c1, c2, c3) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 + +#define ndk_str5cmp(m, c0, c1, c2, c3, c4) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 && m[4] == c4 + +#define ndk_str6cmp(m, c0, c1, c2, c3, c4, c5) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \ + && m[4] == c4 && m[5] == c5 + +#define ndk_str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \ + && m[4] == c4 && m[5] == c5 && m[6] == c6 + +#define ndk_str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \ + && m[4] == c4 && m[5] == c5 && m[6] == c6 && m[7] == c7 + +#define ndk_str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8) \ + m[0] == c0 && m[1] == c1 && m[2] == c2 && m[3] == c3 \ + && m[4] == c4 && m[5] == c5 && m[6] == c6 && m[7] == c7 && m[8] == c8 + +#endif + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.c new file mode 100644 index 0000000..0b7c266 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.c @@ -0,0 +1,583 @@ + + + +/* This function cleans a path to its most basic form, performing the following transformations : + * + * - ./ -> [empty] + * - // -> / + * - /base/parent/../ -> /base/ + * + * If possible, it leaves the original string in place and does not copy characters, otherwise + * characters are copied. +*/ + +void +ndk_clean_path (ngx_str_t *path, ngx_uint_t complex, size_t off) +{ + u_char *s, *p, *m, *e, c, *l; + ngx_uint_t root; + + if (path->len == 1) { + + if (path->data[0] == '.') { + path->len = 0; + } + + return; + } + + /* strip initial './' */ + + s = path->data; + e = s + path->len; + + if (off) { + p = s + off; + goto check_basic; + } + + if (*s == '/') + root = 1; + else + root = 0; + + while (s < e) { + + switch (*s) { + + case '/' : + + /* '//' => '/' */ + + s++; + continue; + + case '.' : + + if (s == e-1) { + + if (root) { + path->data[0] = '/'; + path->len = 1; + } else { + path->len = 0; + } + + return; + } + + /* './' => '' */ + + if (s[1] == '/') { + + s += 2; + + if (s == e) { + + path->len = 0; + return; + } + + continue; + } + } + + break; + } + + if (root && *s != '/') { + s--; + } + + p = s; + +check_basic : + + for ( ; p '/' */ + + m = p + 2; + goto copy; + + case '.' : + + if (e - p == 2) + break; + + switch (p[2]) { + + case '/' : + + /* './' => '' */ + + m = p + 2; + goto copy; + + case '.' : + + if (e - p == 3 || p[3] == '/') { + + if (p == s) { + + s += 3; + continue; + } + + if (p - s >= 2) { + + if (p[-1] == '.' && p[-2] == '.') { + + if (p - s == 2 || p[-3] == '/') { /* = '../../' */ + + p += 2; /* 3? */ + continue; + } + } + } + + m = p + 4; + + if (complex) { + + for (p--; p >= s; p--) { + + switch (*p) { + + case '/' : + goto copy; + + case '$' : + + p = m - 1; + + if (m == e) + goto end_basic; + + goto new_dir_first; + } + } + + } else { + + for (p--; p > s; p--) { + + /* '/path/folder/../' => '/path/' */ + + if (*p == '/') + break; + } + } + + goto copy; + } + } + } + } + } + +end_basic : + + path->data = s; + path->len = p - s; + + return; + +copy : + + p++; + + if (m < e) + goto new_dir; + + while (m < e) { + + c = *m; + *p = c; + p++; + + if (c == '/') { + + m++; + + new_dir : + + for ( ; m '' */ + + m += 2; + if (m == e) + break; + + goto new_dir; + + case '.' : + + if (e - m == 2 || m[2] == '/') { + + if (m - s >= 3) { /* NOTE : this is one higher than above because m has moved on 1 */ + + if (p[-2] == '.' && p[-3] == '.') { + + if (m - s == 3 || p[-4] == '/') { /* = '../../' */ + + p[0] = '.'; + p[1] = '.'; + p[2] = '/'; + p += 3; + m += 3; + goto new_dir; + } + } + } + + if (complex) { + + l = p; + + for (p -= 2; p >= s; p--) { + + switch (*p) { + + case '/' : + break; + + case '$' : + + l[0] = '.'; + l[1] = '.'; + l[2] = '/'; + p = l + 4; + break; + + default : + continue; + } + + break; + } + + m += 3; + if (m == e) + goto end; + + goto new_dir; + + } else { + + for (p -= 2; p > s; p--) { + + /* '/path/folder/../' => '/path/' */ + + if (*p == '/') + break; + } + + m += 3; + if (m == e) + goto end; + + goto new_dir; + } + } + } + } + + } else { + m++; + } + } + +end : + + path->data = s; + path->len = p - s; +} + + +/* This function converts a path to its directory version, and assumes that there is always space + * to allocatate an extra character on the end (which is only true if the provided strings always + * have NULL's at the end (hence the 'safe'). +*/ + +void +ndk_path_to_dir_safe (ngx_str_t *path, ngx_uint_t complex, size_t off) +{ + size_t len; + u_char *p, *m; + + ndk_clean_path (path, complex, off); + + len = path->len; + if (!len) + return; + + p = path->data; + m = p + len - 1; + + if (*m != '/') { + + p [len] = '/'; + path->len++; + } +} + + +/* Divides a path given by path/to/path1:path/to/path2 into separate strings and returns an + * array of these strings. +*/ + +ngx_array_t * +ndk_split_path_create (ngx_conf_t *cf, ngx_str_t *path) +{ + ngx_str_t *str; + int n; + u_char *m, *s, *e; + ngx_array_t *a; + + if (path == NULL) + return NULL; + + n = ndk_strcntc (path, ':'); + + a = ngx_array_create (cf->pool, n + 1, sizeof (ngx_str_t)); + if (a == NULL) { + return NULL; + } + + s = path->data; + e = s + path->len; + + while (s < e) { + + m = s; + + while (m < e && *m != ':') m++; + + if (m == s) { + s = m+1; + continue; + } + + str = ngx_array_push (a); + if (str == NULL) { + return NULL; + } + + str->data = s; + str->len = m - s; + + if (ngx_conf_full_name (cf->cycle, str, 0) == NGX_ERROR) + return NULL; + + s = m+1; + } + + return a; +} + + + +ngx_array_t * +ndk_split_path_create_raw (ngx_conf_t *cf, char *path) +{ + ngx_str_t *str; + int n; + char *m, *s; + ngx_array_t *a; + + if (path == NULL) + return NULL; + + n = ndk_strccnt (path, ':'); + + a = ngx_array_create (cf->pool, n + 1, sizeof (ngx_str_t)); + if (a == NULL) { + return NULL; + } + + s = path; + + + while (*s != '\0') { + + m = s; + + while (*m != '\0' && *m != ':') m++; + + if (m == s) { + s = m+1; + continue; + } + + str = ngx_array_push (a); + if (str == NULL) { + return NULL; + } + + str->data = (u_char *) s; + str->len = m - s; + + if (ngx_conf_full_name (cf->cycle, str, 0) == NGX_ERROR) + return NULL; + + if (*m == '\0') + break; + + s = m+1; + } + + return a; +} + + + +char * +ndk_conf_set_full_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *path, *value; + ngx_conf_post_t *post; + + path = (ngx_str_t *) (p + cmd->offset); + + if (path->data) { + return "is duplicate"; + } + + value = cf->args->elts; + + *path = value[1]; + + if (ngx_conf_full_name (cf->cycle, path, 0) == NGX_ERROR) + return NGX_CONF_ERROR; + + if (cmd->post) { + post = cmd->post; + return post->post_handler(cf, post, path); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_split_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + /* TODO : change to use the path func above */ + + char *p = conf; + + ngx_str_t *value, *str; + ngx_array_t **a; + ngx_conf_post_t *post; + int n; + u_char *m, *s, *e; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a != NGX_CONF_UNSET_PTR) { + return "is duplicate"; + } + + value = cf->args->elts; + value++; + + n = ndk_strcntc (value, ':') + 1; + + *a = ngx_array_create (cf->pool, n, sizeof (ngx_str_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + + s = value->data; + e = s + value->len; + + while (s < e) { + + m = s; + + while (m < e && *m != ':') m++; + + if (m == s) { + s = m+1; + continue; + } + + str = ngx_array_push (*a); + if (str == NULL) { + return NGX_CONF_ERROR; + } + + str->data = s; + str->len = m - s; + + if (ngx_conf_full_name (cf->cycle, str, 0) == NGX_ERROR) + return NGX_CONF_ERROR; + + s = m+1; + } + + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, a); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_full_path (ngx_conf_t *cf, void *data, ngx_str_t *path) +{ + if (ngx_conf_full_name (cf->cycle, path, 0) == NGX_ERROR) + return NGX_CONF_ERROR; + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_full_conf_path (ngx_conf_t *cf, void *data, ngx_str_t *path) +{ + if (ngx_conf_full_name (cf->cycle, path, 1) == NGX_ERROR) + return NGX_CONF_ERROR; + + return NGX_CONF_OK; +} + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.h new file mode 100644 index 0000000..22ba945 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_path.h @@ -0,0 +1,22 @@ + + +/* path conversion functions */ + +void ndk_clean_path (ngx_str_t *path, ngx_uint_t complex, size_t off); +void ndk_path_to_dir_safe (ngx_str_t *path, ngx_uint_t complex, size_t off); + +/* path create functions */ + +ngx_array_t * ndk_split_path_create (ngx_conf_t *cf, ngx_str_t *path); +ngx_array_t * ndk_split_path_create_raw (ngx_conf_t *cf, char *path); + +/* conf set functions */ + +char * ndk_conf_set_full_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_split_path_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + +/* conf set post functions */ + +char * ndk_conf_set_full_path (ngx_conf_t *cf, void *data, ngx_str_t *path); +char * ndk_conf_set_full_conf_path (ngx_conf_t *cf, void *data, ngx_str_t *path); + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.c new file mode 100644 index 0000000..fbc789c --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.c @@ -0,0 +1,20 @@ + +ngx_int_t +ndk_init_signals (ngx_signal_t *sig, ngx_log_t *log) +{ + struct sigaction sa; + + for ( ; sig->signo != 0; sig++) { + ndk_zerov (sa); + sa.sa_handler = sig->handler; + sigemptyset (&sa.sa_mask); + + if (sigaction (sig->signo, &sa, NULL) == -1) { + ngx_log_error (NGX_LOG_EMERG, log, ngx_errno, + "sigaction(%s) failed", sig->signame); + return NGX_ERROR; + } + } + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.h new file mode 100644 index 0000000..7ac1d99 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_process.h @@ -0,0 +1,12 @@ + + +typedef struct { + int signo; + char *signame; + char *name; + void (*handler)(int signo); +} ngx_signal_t; + + +ngx_int_t ndk_init_signals (ngx_signal_t *sig, ngx_log_t *log); + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c new file mode 100644 index 0000000..c1efd86 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.c @@ -0,0 +1,215 @@ + + +char * +ndk_conf_set_regex_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_conf_post_t *post; + ngx_regex_elt_t *re; + ngx_regex_compile_t rc; + u_char errstr[NGX_MAX_CONF_ERRSTR]; + + re = (ngx_regex_elt_t *) (p + cmd->offset); + + if (re->name) { + return "is duplicate"; + } + + value = cf->args->elts; + value++; + + ndk_zerov (rc); + + rc.pool = cf->pool; + rc.err.len = NGX_MAX_CONF_ERRSTR; + rc.err.data = errstr; + rc.pattern = *value; + + if (ngx_regex_compile(&rc) != NGX_OK) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err); + return NGX_CONF_ERROR; + } + + re->regex = rc.regex; + re->name = value->data; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, re); + } + + return NGX_CONF_OK; +} + + +char * +ndk_conf_set_regex_caseless_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_conf_post_t *post; + ngx_regex_elt_t *re; + ngx_regex_compile_t rc; + u_char errstr[NGX_MAX_CONF_ERRSTR]; + + re = (ngx_regex_elt_t *) (p + cmd->offset); + + if (re->name) { + return "is duplicate"; + } + + value = cf->args->elts; + value++; + + ndk_zerov (rc); + + rc.pool = cf->pool; + rc.err.len = NGX_MAX_CONF_ERRSTR; + rc.err.data = errstr; + rc.pattern = *value; + rc.options = NGX_REGEX_CASELESS; + + if (ngx_regex_compile(&rc) != NGX_OK) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V", &rc.err); + return NGX_CONF_ERROR; + } + + re->regex = rc.regex; + re->name = value->data; + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, re); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_regex_array_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_conf_post_t *post; + ngx_array_t **a; + ngx_regex_elt_t *re; + ngx_regex_compile_t rc; + ngx_uint_t i, n = 0; + u_char errstr[NGX_MAX_CONF_ERRSTR]; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a != NGX_CONF_UNSET_PTR) { + + n = cf->args->nelts > 4 ? cf->args->nelts : 4; + + *a = ngx_array_create (cf->pool, n, sizeof (ngx_regex_elt_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + } + + ndk_zerov (rc); + + rc.pool = cf->pool; + rc.err.len = NGX_MAX_CONF_ERRSTR; + rc.err.data = errstr; + + value = cf->args->elts; + value++; + + for (i=0; iregex = rc.regex; + re->name = value->data; + } + + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, a); + } + + return NGX_CONF_OK; +} + + + +char * +ndk_conf_set_regex_array_caseless_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + char *p = conf; + + ngx_str_t *value; + ngx_conf_post_t *post; + ngx_array_t **a; + ngx_regex_elt_t *re; + ngx_regex_compile_t rc; + ngx_uint_t i, n = 0; + u_char errstr[NGX_MAX_CONF_ERRSTR]; + + a = (ngx_array_t **) (p + cmd->offset); + + if (*a != NGX_CONF_UNSET_PTR) { + + n = cf->args->nelts > 4 ? cf->args->nelts : 4; + + *a = ngx_array_create (cf->pool, n, sizeof (ngx_regex_elt_t)); + if (*a == NULL) { + return NGX_CONF_ERROR; + } + } + + ndk_zerov (rc); + + rc.pool = cf->pool; + rc.err.len = NGX_MAX_CONF_ERRSTR; + rc.err.data = errstr; + + value = cf->args->elts; + value++; + + for (i=0; iregex = rc.regex; + re->name = value->data; + } + + + if (cmd->post) { + post = cmd->post; + return post->post_handler (cf, post, a); + } + + return NGX_CONF_OK; +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.h new file mode 100644 index 0000000..4319b04 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_regex.h @@ -0,0 +1,7 @@ + + +char * ndk_conf_set_regex_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_regex_caseless_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_regex_array_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_conf_set_regex_array_caseless_slot (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.c new file mode 100644 index 0000000..77ce9f8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.c @@ -0,0 +1,103 @@ + + +/* these have been taken from the rewrite module and http_script file + * because those functions are defined as being static - a patch will + * be provided later to un-define them as being static + */ + + +uintptr_t ndk_http_script_exit_code = (uintptr_t) NULL; + + +char * +ndk_http_rewrite_value (ngx_conf_t *cf, ndk_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; + + n = ngx_http_script_variables_count(value); + + if (n == 0) { + val = ngx_http_script_start_code(cf->pool, &lcf->codes, + sizeof(ngx_http_script_value_code_t)); + if (val == NULL) { + return NGX_CONF_ERROR; + } + + n = ngx_atoi(value->data, value->len); + + if (n == NGX_ERROR) { + n = 0; + } + + val->code = ngx_http_script_value_code; + val->value = (uintptr_t) n; + val->text_len = (uintptr_t) value->len; + val->text_data = (uintptr_t) value->data; + + return NGX_CONF_OK; + } + + complex = ngx_http_script_start_code(cf->pool, &lcf->codes, + sizeof(ngx_http_script_complex_value_code_t)); + if (complex == NULL) { + return NGX_CONF_ERROR; + } + + complex->code = ngx_http_script_complex_value_code; + complex->lengths = NULL; + + ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); + + sc.cf = cf; + sc.source = value; + sc.lengths = &complex->lengths; + sc.values = &lcf->codes; + sc.variables = n; + sc.complete_lengths = 1; + + if (ngx_http_script_compile(&sc) != NGX_OK) { + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + + +ngx_int_t +ndk_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; + ndk_http_rewrite_loc_conf_t *rlcf; + + rlcf = ngx_http_get_module_loc_conf(r, ngx_http_rewrite_module); + + if (rlcf->uninitialized_variable_warn == 0) { + *v = ngx_http_variable_null_value; + return NGX_OK; + } + + cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); + + var = cmcf->variables.elts; + + /* + * the ngx_http_rewrite_module sets variables directly in r->variables, + * and they should be handled by ngx_http_get_indexed_variable(), + * so the handler is called only if the variable is not initialized + */ + + ngx_log_error(NGX_LOG_WARN, r->connection->log, 0, + "using uninitialized \"%V\" variable", &var[data].name); + + *v = ngx_http_variable_null_value; + + return NGX_OK; +} + + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.h new file mode 100644 index 0000000..2479aa2 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_rewrite.h @@ -0,0 +1,26 @@ + + +/* TODO : should remove this when not needed */ + + + +/* used for plugging into the rewrite module (taken from the 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; +} ndk_http_rewrite_loc_conf_t; + + +extern ngx_module_t ngx_http_rewrite_module; +extern uintptr_t ndk_http_script_exit_code; + +char * ndk_http_rewrite_value (ngx_conf_t *cf, ndk_http_rewrite_loc_conf_t *lcf, + ngx_str_t *value); +ngx_int_t ndk_http_rewrite_var (ngx_http_request_t *r, + ngx_http_variable_value_t *v, uintptr_t data); + +#define ndk_http_script_exit (u_char *) &ndk_http_script_exit_code + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.c new file mode 100644 index 0000000..388f873 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.c @@ -0,0 +1,602 @@ +#include + + +typedef struct { + ngx_http_script_code_pt code; + void *func; +} ndk_set_var_code_t; + + +typedef struct { + ngx_http_script_code_pt code; + void *func; + size_t size; +} ndk_set_var_size_code_t; + + +typedef struct { + ngx_http_script_code_pt code; + void *func; + void *data; +} ndk_set_var_data_code_t; + + +typedef struct { + ngx_http_script_code_pt code; + void *func; + size_t size; + void *data; +} ndk_set_var_size_data_code_t; + + +typedef struct { + ngx_int_t index; + ngx_str_t *value; + ngx_http_variable_t *v; + ngx_conf_t *cf; + ndk_http_rewrite_loc_conf_t *rlcf; +} ndk_set_var_info_t; + + +static void ndk_set_var_code (ngx_http_script_engine_t *e); +static void ndk_set_var_hash_code (ngx_http_script_engine_t *e); +static void ndk_set_var_value_code (ngx_http_script_engine_t *e); + + +static ngx_inline void +ndk_set_var_code_finalize(ngx_http_script_engine_t *e, ngx_int_t rc, + ngx_http_variable_value_t *v, ngx_str_t *str) +{ + switch (rc) { + + case NGX_OK: + + v->data = str->data; + v->len = str->len; + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, + "http script value (post filter): \"%v\"", v); + break; + + case NGX_DECLINED: + + v->valid = 0; + v->not_found = 1; + v->no_cacheable = 1; + break; + + case NGX_ERROR: + + e->ip = ndk_http_script_exit; + e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; + break; + } +} + + + +static void +ndk_set_var_code(ngx_http_script_engine_t *e) +{ + ngx_int_t rc; + ngx_str_t str; + ngx_http_variable_value_t *v; + ndk_set_var_code_t *sv; + ndk_set_var_pt func; + + sv = (ndk_set_var_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_code_t); + + v = e->sp++; + + func = (ndk_set_var_pt) sv->func; + + rc = func(e->request, &str); + + ndk_set_var_code_finalize(e, rc, v, &str); +} + + +static void +ndk_set_var_data_code(ngx_http_script_engine_t *e) +{ + ngx_int_t rc; + ngx_str_t str; + ngx_http_variable_value_t *v; + ndk_set_var_data_code_t *svd; + ndk_set_var_data_pt func; + + svd = (ndk_set_var_data_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_data_code_t); + + v = e->sp++; + + func = (ndk_set_var_data_pt) svd->func; + + rc = func(e->request, &str, svd->data); + + ndk_set_var_code_finalize(e, rc, v, &str); +} + + +static void +ndk_set_var_value_code(ngx_http_script_engine_t *e) +{ + ngx_int_t rc; + ngx_str_t str; + ngx_http_variable_value_t *v; + ndk_set_var_code_t *sv; + ndk_set_var_value_pt func; + + sv = (ndk_set_var_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_code_t); + + v = e->sp - 1; + + func = (ndk_set_var_value_pt) sv->func; + + rc = func(e->request, &str, v); + + ndk_set_var_code_finalize(e, rc, v, &str); +} + + +static void +ndk_set_var_value_data_code(ngx_http_script_engine_t *e) +{ + ngx_int_t rc; + ngx_str_t str; + ngx_http_variable_value_t *v; + ndk_set_var_data_code_t *svd; + ndk_set_var_value_data_pt func; + + svd = (ndk_set_var_data_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_data_code_t); + + v = e->sp - 1; + + func = (ndk_set_var_value_data_pt) svd->func; + + rc = func(e->request, &str, v, svd->data); + + ndk_set_var_code_finalize(e, rc, v, &str); +} + + +static void +ndk_set_var_multi_value_code(ngx_http_script_engine_t *e) +{ + ngx_int_t rc; + ngx_str_t str; + ngx_http_variable_value_t *v; + ndk_set_var_size_code_t *svs; + ndk_set_var_value_pt func; + + svs = (ndk_set_var_size_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_size_code_t); + + v = e->sp - svs->size; + e->sp = v + 1; + + func = (ndk_set_var_value_pt) svs->func; + + rc = func(e->request, &str, v); + + ndk_set_var_code_finalize(e, rc, v, &str); +} + + +static void +ndk_set_var_multi_value_data_code(ngx_http_script_engine_t *e) +{ + ngx_int_t rc; + ngx_str_t str; + ngx_http_variable_value_t *v; + ndk_set_var_size_data_code_t *svsd; + ndk_set_var_value_data_pt func; + + svsd = (ndk_set_var_size_data_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_size_data_code_t); + + v = e->sp - svsd->size; + e->sp = v + 1; + + func = (ndk_set_var_value_data_pt) svsd->func; + + rc = func(e->request, &str, v, svsd->data); + + ndk_set_var_code_finalize(e, rc, v, &str); +} + + +static void +ndk_set_var_hash_code(ngx_http_script_engine_t *e) +{ + u_char *p; + ngx_http_variable_value_t *v; + ndk_set_var_size_code_t *svs; + ndk_set_var_hash_pt func; + + svs = (ndk_set_var_size_code_t *) e->ip; + + e->ip += sizeof(ndk_set_var_size_code_t); + + p = ngx_palloc(e->request->pool, svs->size); + if (p == NULL) { + e->ip = ndk_http_script_exit; + e->status = NGX_HTTP_INTERNAL_SERVER_ERROR; + return; + } + + v = e->sp - 1; + + func = (ndk_set_var_hash_pt) svs->func; + + func(p, (char *) v->data, v->len); + + v->data = (u_char *) p; + v->len = svs->size; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, e->request->connection->log, 0, + "http script hashed value: \"%v\"", v); +} + + + +static char * +ndk_set_var_name(ndk_set_var_info_t *info, ngx_str_t *varname) +{ + ngx_int_t index; + ngx_http_variable_t *v; + ngx_conf_t *cf; + ndk_http_rewrite_loc_conf_t *rlcf; + ngx_str_t name; + + name = *varname; + + cf = info->cf; + rlcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_rewrite_module); + + if (name.data[0] != '$') { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid variable name \"%V\"", &name); + return NGX_CONF_ERROR; + } + + name.len--; + name.data++; + + v = ngx_http_add_variable(cf, &name, NGX_HTTP_VAR_CHANGEABLE); + if (v == NULL) { + return NGX_CONF_ERROR; + } + + index = ngx_http_get_variable_index(cf, &name); + if (index == NGX_ERROR) { + return NGX_CONF_ERROR; + } + + if (v->get_handler == NULL + && ngx_strncasecmp(name.data, (u_char *) "arg_", 4) != 0 + && ngx_strncasecmp(name.data, (u_char *) "cookie_", 7) != 0 + && ngx_strncasecmp(name.data, (u_char *) "http_", 5) != 0 + && ngx_strncasecmp(name.data, (u_char *) "sent_http_", 10) != 0 + && ngx_strncasecmp(name.data, (u_char *) "upstream_http_", 14) != 0) + { + v->get_handler = ndk_http_rewrite_var; + v->data = index; + } + + info->v = v; + info->index = index; + info->rlcf = rlcf; + + return NGX_CONF_OK; +} + + + +static void +ndk_set_variable_value_space(ndk_http_rewrite_loc_conf_t *rlcf, ngx_uint_t count) +{ + /* if the number of variable values that will be used is greater than 10, + * make sure there is enough space allocated on the rewrite value stack + */ + + if (count <= 10) + return; + + if (rlcf->stack_size == NGX_CONF_UNSET_UINT) { + rlcf->stack_size = count; + return; + } + + if (rlcf->stack_size < count) + rlcf->stack_size = count; +} + + + +static char * +ndk_set_var_filter(ngx_conf_t *cf, ndk_http_rewrite_loc_conf_t *rlcf, + ndk_set_var_t *filter) +{ + ndk_set_var_code_t *sv; + ndk_set_var_size_code_t *svs; + ndk_set_var_data_code_t *svd; + ndk_set_var_size_data_code_t *svsd; + + if (filter == NULL) { + return "no filter set"; + } + + switch (filter->type) { + case NDK_SET_VAR_BASIC: + + sv = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_code_t)); + if (sv == NULL) { + return NGX_CONF_ERROR; + } + + sv->code = ndk_set_var_code; + sv->func = filter->func; + break; + + case NDK_SET_VAR_DATA: + + svd = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_data_code_t)); + if (svd == NULL) { + return NGX_CONF_ERROR; + } + + svd->code = ndk_set_var_data_code; + svd->func = filter->func; + svd->data = filter->data; + break; + + case NDK_SET_VAR_VALUE: + + sv = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_code_t)); + if (sv == NULL) { + return NGX_CONF_ERROR; + } + + sv->code = ndk_set_var_value_code; + sv->func = filter->func; + break; + + case NDK_SET_VAR_VALUE_DATA: + + svd = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_data_code_t)); + if (svd == NULL) { + return NGX_CONF_ERROR; + } + + svd->code = ndk_set_var_value_data_code; + svd->func = filter->func; + svd->data = filter->data; + break; + + case NDK_SET_VAR_MULTI_VALUE: + + svs = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_size_code_t)); + if (svs == NULL) { + return NGX_CONF_ERROR; + } + + svs->code = ndk_set_var_multi_value_code; + svs->func = filter->func; + svs->size = filter->size; + + ndk_set_variable_value_space(rlcf, svs->size); + break; + + case NDK_SET_VAR_MULTI_VALUE_DATA: + + svsd = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_size_data_code_t)); + if (svsd == NULL) { + return NGX_CONF_ERROR; + } + + svsd->code = ndk_set_var_multi_value_data_code; + svsd->func = filter->func; + svsd->size = filter->size; + svsd->data = filter->data; + + ndk_set_variable_value_space(rlcf, svsd->size); + break; + + + case NDK_SET_VAR_HASH: + + svs = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ndk_set_var_size_code_t)); + if (svs == NULL) { + return NGX_CONF_ERROR; + } + + svs->code = ndk_set_var_hash_code; + svs->func = filter->func; + svs->size = filter->size; + break; + + default: + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "invalid filter type \"%ul\"", filter->type); + return NGX_CONF_ERROR; + } + + return NGX_CONF_OK; +} + + +static char * +ndk_set_var_filter_value(ndk_set_var_info_t *info, ndk_set_var_t *filter) +{ + ngx_conf_t *cf; + ngx_http_variable_t *v; + ndk_http_rewrite_loc_conf_t *rlcf; + ngx_http_script_var_code_t *vcode; + ngx_http_script_var_handler_code_t *vhcode; + + v = info->v; + cf = info->cf; + rlcf = info->rlcf; + + if (ndk_set_var_filter(cf, rlcf, filter) != NGX_CONF_OK) { + return NGX_CONF_ERROR; + } + + if (v->set_handler) { + vhcode = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ngx_http_script_var_handler_code_t)); + if (vhcode == NULL) { + return NGX_CONF_ERROR; + } + + vhcode->code = ngx_http_script_var_set_handler_code; + vhcode->handler = v->set_handler; + vhcode->data = v->data; + + return NGX_CONF_OK; + } + + vcode = ngx_http_script_start_code(cf->pool, &rlcf->codes, + sizeof(ngx_http_script_var_code_t)); + if (vcode == NULL) { + return NGX_CONF_ERROR; + } + + vcode->code = ngx_http_script_set_var_code; + vcode->index = (uintptr_t) info->index; + + return NGX_CONF_OK; +} + + +char * +ndk_set_var_core(ngx_conf_t *cf, ngx_str_t *name, ndk_set_var_t *filter) +{ + char *p; + ndk_set_var_info_t info; + + info.cf = cf; + + p = ndk_set_var_name(&info, name); + if (p != NGX_CONF_OK) { + return p; + } + + return ndk_set_var_filter_value(&info, filter); +} + + +char * +ndk_set_var_value_core(ngx_conf_t *cf, ngx_str_t *name, ngx_str_t *value, ndk_set_var_t *filter) +{ + char *p; + ndk_set_var_info_t info; + + info.cf = cf; + + p = ndk_set_var_name(&info, name); + if (p != NGX_CONF_OK) { + return p; + } + + p = ndk_http_rewrite_value(cf, info.rlcf, value); + if (p != NGX_CONF_OK) { + return p; + } + + return ndk_set_var_filter_value(&info, filter); +} + + +char * +ndk_set_var_multi_value_core(ngx_conf_t *cf, ngx_str_t *name, + ngx_str_t *value, ndk_set_var_t *filter) +{ + char *p; + ndk_set_var_info_t info; + ngx_int_t i; + + info.cf = cf; + + p = ndk_set_var_name(&info, name); + if (p != NGX_CONF_OK) { + return p; + } + + for (i = filter->size; i; i--, value++) { + + p = ndk_http_rewrite_value(cf, info.rlcf, value); + if (p != NGX_CONF_OK) { + return p; + } + } + + return ndk_set_var_filter_value(&info, filter); +} + + +char * +ndk_set_var(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value; + ndk_set_var_t *filter; + + value = cf->args->elts; + value++; + + filter = (ndk_set_var_t *) cmd->post; + + return ndk_set_var_core(cf, value, filter); +} + + +char * +ndk_set_var_value(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value; + ndk_set_var_t *filter; + + value = cf->args->elts; + value++; + + filter = (ndk_set_var_t *) cmd->post; + + return ndk_set_var_value_core(cf, value, + cf->args->nelts == 1 + 1 ? value : value + 1, filter); +} + + +char * +ndk_set_var_multi_value(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value; + ndk_set_var_t *filter; + + value = cf->args->elts; + value++; + + filter = (ndk_set_var_t *) cmd->post; + + return ndk_set_var_multi_value_core(cf, value, value + 1, filter); +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.h new file mode 100644 index 0000000..5dcba97 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_set_var.h @@ -0,0 +1,44 @@ +/* + * 2010 (C) Marcus Clyne + */ + +#ifndef _NDK_SET_VAR_H_INCLUDED_ +#define _NDK_SET_VAR_H_INCLUDED_ + + +typedef ngx_int_t (*ndk_set_var_pt) (ngx_http_request_t *r, ngx_str_t *val); +typedef ngx_int_t (*ndk_set_var_data_pt) (ngx_http_request_t *r, ngx_str_t *val, void *data); +typedef ngx_int_t (*ndk_set_var_value_pt) (ngx_http_request_t *r, ngx_str_t *val, ngx_http_variable_value_t *v); +typedef ngx_int_t (*ndk_set_var_value_data_pt) (ngx_http_request_t *r, ngx_str_t *val, ngx_http_variable_value_t *v, void *data); +typedef void (*ndk_set_var_hash_pt) (u_char *p, char *data, size_t len); + + +typedef struct { + ngx_uint_t type; + void *func; + size_t size; + void *data; +} ndk_set_var_t; + + +enum { + NDK_SET_VAR_BASIC = 0, + NDK_SET_VAR_DATA, + NDK_SET_VAR_VALUE, + NDK_SET_VAR_VALUE_DATA, + NDK_SET_VAR_MULTI_VALUE, + NDK_SET_VAR_MULTI_VALUE_DATA, + NDK_SET_VAR_HASH +}; + + +char * ndk_set_var (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_set_var_value (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); +char * ndk_set_var_multi_value (ngx_conf_t *cf, ngx_command_t *cmd, void *conf); + + +char * ndk_set_var_core (ngx_conf_t *cf, ngx_str_t *name, ndk_set_var_t *filter); +char * ndk_set_var_value_core (ngx_conf_t *cf, ngx_str_t *name, ngx_str_t *value, ndk_set_var_t *filter); +char * ndk_set_var_multi_value_core (ngx_conf_t *cf, ngx_str_t *name, ngx_str_t *value, ndk_set_var_t *filter); + +#endif /* _NDK_SET_VAR_H_INCLUDED_ */ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.c new file mode 100644 index 0000000..7c2a965 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.c @@ -0,0 +1,434 @@ + + +int64_t +ndk_atoi64 (u_char *line, size_t n) +{ + int64_t value; + + if (n == 0ll) { + return NGX_ERROR; + } + + for (value = 0ll; n--; line++) { + if (*line < '0' || *line > '9') { + return NGX_ERROR; + } + + value = value * 10ll + (*line - '0'); + } + + if (value < 0ll) { + return NGX_ERROR; + } + + return value; +} + + +ngx_int_t +ndk_strcntc (ngx_str_t *s, char c) +{ + ngx_int_t n; + size_t i; + u_char *p; + + i = s->len; + p = s->data; + + for (n=0; i; i--, p++) { + + if (*p == (u_char) c) + n++; + } + + return n; +} + + +ngx_int_t +ndk_strccnt (char *s, char c) +{ + ngx_int_t n; + + n = 0; + + while (*s != '\0') { + + if (*s == 'c') + n++; + + s++; + } + + return n; +} + + + +ngx_array_t * +ndk_str_array_create (ngx_pool_t *pool, char **s, ngx_int_t n) +{ + ngx_int_t i; + ngx_str_t *str; + ngx_array_t *a; + + a = ngx_array_create (pool, n, sizeof (ngx_str_t)); + if (a == NULL) + return NULL; + + + for (i=0; idata = (u_char *) *s; + str->len = strlen (*s); + } + + return a; +} + + + +u_char * +ndk_vcatstrf (ngx_pool_t *pool, ngx_str_t *dest, const char *fmt, va_list args) +{ + size_t len, l, el; + int argc; + u_char *p, *m, *e, c, c1, *cp; + + argc = strlen (fmt); + + ngx_str_t *s; + ndk_estr_t *sp, *sp2, ss [argc]; + u_char cs [argc]; + + sp = sp2 = ss; + cp = cs; + + len = 0; + + /* TODO : maybe have 'e' at the beginning? */ + + /* parse format to get strings */ + + while (*fmt) { + + switch (*fmt) { + + case 'S' : + + s = va_arg (args, ngx_str_t *); + + sp->data = s->data; + sp->len = s->len; + sp->escaped = 0; + + len += sp->len; + break; + + case 's' : + + sp->data = va_arg (args, u_char *); + sp->len = (size_t) ngx_strlen (sp->data); + sp->escaped = 0; + + len += sp->len; + break; + + case 'l' : + + sp->data = va_arg (args, u_char *); + sp->len = (size_t) va_arg (args, int); + sp->escaped = 0; + + len += sp->len; + break; + + case 'L' : + + sp->data = va_arg (args, u_char *); + sp->len = va_arg (args, size_t); + sp->escaped = 0; + + len += sp->len; + break; + + case 'e' : + + p = va_arg (args, u_char *); + + sp->data = p; + + l = 0; + el = 0; + c = *p; + + while (c != '\0') { + + if (c == '\\') { + l += 2; + p += 2; + } else { + l++; + p++; + } + + el++; + c = *p; + } + + sp->len = l; + sp->escaped = 1; + + len += el; + break; + + case 'E' : + + s = va_arg (args, ngx_str_t *); + + sp->data = s->data; + sp->len = s->len; + + p = sp->data; + + el = 0; + e = p + sp->len; + + while (p < e) { + + c = *p; + + if (c == '\\') { + p += 2; + } else { + p++; + } + + el++; + } + + sp->escaped = 1; + + len += el; + break; + + case 'n' : + + sp->data = va_arg (args, u_char *); + sp->len = (size_t) va_arg (args, int); + + p = sp->data; + + el = 0; + e = p + sp->len; + + while (p < e) { + + c = *p; + + if (c == '\\') { + p += 2; + } else { + p++; + } + + el++; + } + + sp->escaped = 1; + + len += el; + break; + + case 'c' : + + *cp = (u_char) va_arg (args, int); + + sp->data = cp; + sp->len = (size_t) 1; + + len++; + cp++; + + break; + + default : + + ndk_log_alert (pool->log, 0, "catstrf () : format [%s] incorrect", fmt); + + return NULL; + + } + + sp++; + fmt++; + } + + + + /* create space for string (assumes no NULL's in strings) */ + + ndk_palloc_rn (p, pool, len + 1); + + dest->data = p; + dest->len = len; + + /* copy other strings */ + + if (len) { + + while (sp2 < sp) { + + if (sp2->escaped) { + + m = sp2->data; + e = m + sp2->len; + + while (m < e) { + + c = *m; + + if (c == '\\') { + + if (m == e - 1) { + *p = '\\'; + p++; + break; + } + + c1 = m[1]; + + switch (c1) { + + case 'n' : + *p = '\n'; + break; + + case 't' : + *p = '\t'; + break; + + case '0' : + *p = '\0'; + break; + + case '\\' : + *p = '\\'; + break; + + case 's' : + *p = ' '; + break; + + case 'b' : + *p = '\b'; + break; + + case 'r' : + *p = '\r'; + break; + + default : + + *p = c1; + break; + } + + m += 2; + + } else { + + *p = c; + m++; + } + + p++; + } + + } else { + + p = ngx_cpymem (p, sp2->data, sp2->len); + } + + sp2++; + } + } + + *p = '\0'; + + return dest->data; +} + + +u_char * +ndk_catstrf (ngx_pool_t *pool, ngx_str_t *dest, const char *fmt, ...) +{ + u_char *p; + va_list args; + + va_start (args, fmt); + p = ndk_vcatstrf (pool, dest, fmt, args); + va_end (args); + + return p; +} + + +ngx_int_t +ndk_cmpstr (ngx_str_t *s1, ngx_str_t *s2) +{ + ngx_int_t rv; + size_t len1, len2; + + len1 = s1->len; + len2 = s2->len; + + if (len1 == len2) { + return ngx_strncmp (s1->data, s2->data, len1); + } + + if (len1 > len2) { + + rv = ngx_strncmp (s1->data, s2->data, len2); + if (rv == 0) + return 1; + + return rv; + } + + rv = ngx_strncmp (s1->data, s2->data, len1); + if (rv == 0) + return -1; + + return rv; +} + + +u_char * +ndk_dupstr (ngx_pool_t *pool, ngx_str_t *dest, ngx_str_t *src) +{ + u_char *d; + size_t n; + + n = src->len; + + ndk_palloc_rn (d, pool, n + 1); + ndk_strncpy (d, src->data, n); + + dest->data = d; + dest->len = n; + + return d; +} + +/* +ngx_keyval_t * +ndk_url_args_to_keyval_list (ngx_pool_t *pool, ngx_str_t *str) +{ + ngx_keyval_t *kv; + ngx_st + +} +*/ diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.h new file mode 100644 index 0000000..ecd21c4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_string.h @@ -0,0 +1,37 @@ + + +#if 1 +/* TODO : set ndk_hex_dump for older versions of Nginx */ +#define ndk_hex_dump ngx_hex_dump +#endif + +typedef struct { + size_t len; + u_char *data; + ngx_flag_t escaped; +} ndk_estr_t; + +int64_t ndk_atoi64 (u_char *line, size_t n); + +ngx_int_t ndk_strcntc (ngx_str_t *s, char c); +ngx_int_t ndk_strccnt (char *s, char c); +ngx_array_t * ndk_str_array_create (ngx_pool_t *pool, char **s, ngx_int_t n); +u_char * ndk_catstrf (ngx_pool_t *pool, ngx_str_t *dest, const char *fmt, ...); +ngx_int_t ndk_cmpstr (ngx_str_t *s1, ngx_str_t *s2); +u_char * ndk_dupstr (ngx_pool_t *pool, ngx_str_t *dest, ngx_str_t *src); + +static ngx_inline void +ndk_strtoupper (u_char *p, size_t len) +{ + u_char *e = p + len; + for ( ; pdata = (u_char*) s; (ns)->len = sizeof (s) - 1;} + +#define ndk_zero(p,sz) memset (p,'\0',sz) +#define ndk_zerop(p) ndk_zero (p,sizeof(*p)) +#define ndk_zeropn(p,n) ndk_zero (p,sizeof(*p)*(n)) +#define ndk_zerov(v) ndk_zero (&v,sizeof(v)) + +#define ngx_null_enum { ngx_null_string, 0 } + +#define ndk_memcpyp(d,s) ngx_memcpy(d,s,sizeof(*s)) + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c new file mode 100644 index 0000000..3a83a25 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.c @@ -0,0 +1,205 @@ + + +/* TODO : generalize this into a generic list module, with weight */ + + +typedef struct { + ngx_uint_t weight; + ngx_str_t s; + ngx_conf_t *cf; +} ndk_upstream_list_parse_t; + + + +static ngx_int_t +ndk_upstream_list_parse_weight (ndk_upstream_list_parse_t *ulp) +{ + size_t i; + ngx_str_t *s; + + s = &ulp->s; + + for (i=0; ilen; i++) { + + if (s->data[i] < '0' || s->data[i] > '9') + break; + } + + if (!i) { + ulp->weight = 1; + return NGX_OK; + } + + if (i == s->len) { + ngx_conf_log_error (NGX_LOG_EMERG, ulp->cf, 0, + "upstream list just consists of number \"%V\"", s); + + return NGX_ERROR; + } + + if (s->data[i] != ':') { + ngx_conf_log_error (NGX_LOG_EMERG, ulp->cf, 0, + "upstream list not correct format \"%V\"", s); + + return NGX_ERROR; + } + + + ulp->weight = ngx_atoi (s->data, i); + + s->data += (i + 1); + s->len -= (i + 1); + + return NGX_OK; +} + + + +static char * +ndk_upstream_list (ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + /* TODO : change this for getting upstream pointer if available */ + + ngx_uint_t buckets, count, i, j; + ngx_str_t *value, **bucket, *us; + ngx_array_t *ula; + ndk_upstream_list_t *ul, *ule; + ndk_upstream_list_parse_t ulp; + + ndk_http_main_conf_t *mcf; + + mcf = ngx_http_conf_get_module_main_conf (cf, ndk_http_module); + + ula = mcf->upstreams; + + /* create array of upstream lists it doesn't already exist */ + + if (ula == NULL) { + + ula = ngx_array_create (cf->pool, 4, sizeof (ndk_upstream_list_t)); + if (ula == NULL) + return NGX_CONF_ERROR; + + mcf->upstreams = ula; + } + + + /* check to see if the list already exists */ + + value = cf->args->elts; + value++; + + ul = ula->elts; + ule = ul + ula->nelts; + + for ( ; ulname.len == value->len && + ngx_strncasecmp (ul->name.data, value->data, value->len) == 0) { + + ngx_conf_log_error (NGX_LOG_EMERG, cf, 0, + "duplicate upstream list name \"%V\"", value); + + return NGX_CONF_ERROR; + } + } + + + /* create a new list */ + + ul = ngx_array_push (ula); + if (ul == NULL) + return NGX_CONF_ERROR; + + ul->name = *value; + + + + /* copy all the upstream names */ + + count = cf->args->nelts - 2; + + us = ngx_palloc (cf->pool, count * sizeof (ngx_str_t)); + if (us == NULL) + return NGX_CONF_ERROR; + + ngx_memcpy (us, value + 1, count * sizeof (ngx_str_t)); + + + /* calculate the total number of buckets */ + + buckets = 0; + + ulp.cf = cf; + + for (i=0; ipool, buckets * sizeof (ngx_str_t *)); + if (bucket == NULL) + return NGX_CONF_ERROR; + + ul->elts = bucket; + ul->nelts = buckets; + + + /* set values for each bucket */ + + us -= count; + + for (i=0; idata = ulp.s.data; + us->len = ulp.s.len; + + /* TODO : check format of upstream */ + /* TODO : add automatic adding of http:// in upstreams? */ + + for (j=0; jupstreams; + + if (ua == NULL) { + return NULL; + } + + ul = ua->elts; + ule = ul + ua->nelts; + + for (; ul < ule; ul++) { + if (ul->name.len == len && ngx_strncasecmp(ul->name.data, data, len) == 0) + { + return ul; + } + } + + return NULL; +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.h new file mode 100644 index 0000000..3786456 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_upstream_list.h @@ -0,0 +1,27 @@ + +#if (NDK_UPSTREAM_LIST_CMDS) + +/* TODO : use the generated commands */ + +{ + ngx_string ("upstream_list"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_2MORE, + ndk_upstream_list, + 0, + 0, + NULL +}, + +#else + +typedef struct { + ngx_str_t **elts; + ngx_uint_t nelts; + ngx_str_t name; +} ndk_upstream_list_t; + + +ndk_upstream_list_t * +ndk_get_upstream_list (ndk_http_main_conf_t *mcf, u_char *data, size_t len); + +#endif diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c new file mode 100644 index 0000000..19e90e8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.c @@ -0,0 +1,45 @@ + + +/* TODO : check that this is correct */ + +u_char * +ndk_map_uri_to_path_add_suffix (ngx_http_request_t *r, ngx_str_t *path, ngx_str_t *suffix, ngx_int_t dot) +{ + size_t root_size; + u_char *p; + + if (suffix->len) { + + if (dot) { + + p = ngx_http_map_uri_to_path (r, path, &root_size, suffix->len + 1); + + if (p == NULL) + return NULL; + + *p = '.'; + p++; + + } else { + + p = ngx_http_map_uri_to_path (r, path, &root_size, suffix->len); + + if (p == NULL) + return NULL; + } + + path->len--; + + p = ngx_cpymem (p, suffix->data, suffix->len); + *p = '\0'; + + return p; + } + + p = ngx_http_map_uri_to_path (r, path, &root_size, 0); + + path->len--; + + return p; +} + diff --git a/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h new file mode 100644 index 0000000..dac3880 --- /dev/null +++ b/modules_deb/libnginx-mod-http-ndk-0.3.4/src/ndk_uri.h @@ -0,0 +1,6 @@ + + + +u_char * ndk_map_uri_to_path_add_suffix (ngx_http_request_t *r, ngx_str_t *path, ngx_str_t *suffix, ngx_int_t dot); + + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/.gitattributes b/modules_deb/libnginx-mod-http-set-misc-0.33/.gitattributes new file mode 100644 index 0000000..6fe6f35 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/.gitattributes @@ -0,0 +1 @@ +*.t linguist-language=Text diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/.gitignore b/modules_deb/libnginx-mod-http-set-misc-0.33/.gitignore new file mode 100644 index 0000000..7500112 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/.gitignore @@ -0,0 +1,72 @@ +reindex +.libs +*.swp +*.slo +*.la +*.swo +*.lo +*~ +*.o +print.txt +.rsync +*.tar.gz +dist +build[789] +build +tags +update-readme +*.tmp +test/Makefile +test/blib +test.sh +all +t/t.sh +test/t/servroot/ +releng +reset +*.t_ +genmobi.sh +*.mobi +misc/chunked +ctags +src/base32.h +src/uri.c +src/module.c +src/upstream.c +src/upstream.h +src/uri.c +src/sql.c +src/uri.h +src/sql.h +src/uri.h +src/value.c +src/base32.c +src/value.h +src/hash.h +src/hash.c +src/today.h +src/today.c +src/json.[ch] +all.sh +go +t/servroot/ +src/base64.c +src/base64.h +src/hex.c +src/hex.h +src/hmac.c +src/hmac.h +src/rotate.[ch] +analyze +buildroot/ +src/module.h +work/ +src/random.[ch] +build1[0-9] +nginx +analyze +src/rotate.[ch] +*.plist +Makefile +src/base64url.[ch] +src/expired.[ch] diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/.travis.yml b/modules_deb/libnginx-mod-http-set-misc-0.33/.travis.yml new file mode 100644 index 0000000..a841a11 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/.travis.yml @@ -0,0 +1,54 @@ +sudo: required +dist: trusty + +branches: + only: + - "master" + +os: linux + +language: c +compiler: gcc + +env: + global: + - LUAJIT_PREFIX=/opt/luajit21 + - LUAJIT_LIB=$LUAJIT_PREFIX/lib + - LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH + - LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 + - LUA_INCLUDE_DIR=$LUAJIT_INC + - LUA_CMODULE_DIR=/lib + - JOBS=3 + - NGX_BUILD_JOBS=$JOBS + - TEST_NGINX_SLEEP=0.006 + matrix: + - NGINX_VERSION=1.19.9 + +before_install: + - sudo apt-get install -qq -y axel cpanminus libtest-base-perl libtext-diff-perl liburi-perl libwww-perl libtest-longstring-perl liblist-moreutils-perl > build.log 2>&1 || (cat build.log && exit 1) + +install: + - git clone https://github.com/openresty/nginx-devel-utils.git + - git clone https://github.com/openresty/openresty.git ../openresty + - git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx + - git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module + - git clone https://github.com/openresty/test-nginx.git + - git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git + - git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module + - git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core + - git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache + - git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module + - git clone https://github.com/calio/iconv-nginx-module.git ../iconv-nginx-module + +script: + - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH + - ngx-releng > check.txt || true + - lines=`wc -l check.txt | awk '{print $1}'`; if [ $lines -gt 3 ]; then cat check.txt; exit 1; fi + - cd luajit2 + - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) + - cd ../test-nginx && sudo cpanm . && cd .. + - export NGX_BUILD_CC=$CC + - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1) + - nginx -V + - prove -r t diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/README.markdown b/modules_deb/libnginx-mod-http-set-misc-0.33/README.markdown new file mode 100644 index 0000000..f7f4010 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/README.markdown @@ -0,0 +1,1451 @@ + + +Name +==== + +**ngx_set_misc** - Various set_xxx directives added to nginx's rewrite module (md5/sha1, sql/json quoting, and many more) + +*This module is not distributed with the Nginx source.* See [the installation instructions](#installation). + +Table of Contents +================= + +* [Name](#name) +* [Version](#version) +* [Synopsis](#synopsis) +* [Description](#description) +* [Directives](#directives) + * [set_if_empty](#set_if_empty) + * [set_quote_sql_str](#set_quote_sql_str) + * [set_quote_pgsql_str](#set_quote_pgsql_str) + * [set_quote_json_str](#set_quote_json_str) + * [set_unescape_uri](#set_unescape_uri) + * [set_escape_uri](#set_escape_uri) + * [set_hashed_upstream](#set_hashed_upstream) + * [set_encode_base32](#set_encode_base32) + * [set_base32_padding](#set_base32_padding) + * [set_misc_base32_padding](#set_misc_base32_padding) + * [set_base32_alphabet](#set_base32_alphabet) + * [set_decode_base32](#set_decode_base32) + * [set_encode_base64](#set_encode_base64) + * [set_decode_base64](#set_decode_base64) + * [set_encode_base64url](#set_encode_base64url) + * [set_decode_base64url](#set_decode_base64url) + * [set_encode_hex](#set_encode_hex) + * [set_decode_hex](#set_decode_hex) + * [set_sha1](#set_sha1) + * [set_md5](#set_md5) + * [set_hmac_sha1](#set_hmac_sha1) + * [set_hmac_sha256](#set_hmac_sha256) + * [set_random](#set_random) + * [set_secure_random_alphanum](#set_secure_random_alphanum) + * [set_secure_random_lcalpha](#set_secure_random_lcalpha) + * [set_rotate](#set_rotate) + * [set_local_today](#set_local_today) + * [set_formatted_gmt_time](#set_formatted_gmt_time) + * [set_formatted_local_time](#set_formatted_local_time) +* [Caveats](#caveats) +* [Installation](#installation) + * [Building as a dynamic module](#building-as-a-dynamic-module) +* [Compatibility](#compatibility) +* [Report Bugs](#report-bugs) +* [Source Repository](#source-repository) +* [Changes](#changes) +* [Test Suite](#test-suite) +* [Getting involved](#getting-involved) +* [Author](#author) +* [Copyright & License](#copyright--license) +* [See Also](#see-also) + +Version +======= + +This document describes ngx_set_misc [v0.32](https://github.com/openresty/set-misc-nginx-module/tags) released on 19 April 2018. + +Synopsis +======== + +```nginx + + location /foo { + set $a $arg_a; + set_if_empty $a 56; + + # GET /foo?a=32 will yield $a == 32 + # while GET /foo and GET /foo?a= will + # yeild $a == 56 here. + } + + location /bar { + set $foo "hello\n\n'\"\\"; + set_quote_sql_str $foo $foo; # for mysql + + # OR in-place editing: + # set_quote_sql_str $foo; + + # now $foo is: 'hello\n\n\'\"\\' + } + + location /bar { + set $foo "hello\n\n'\"\\"; + set_quote_pgsql_str $foo; # for PostgreSQL + + # now $foo is: E'hello\n\n\'\"\\' + } + + location /json { + set $foo "hello\n\n'\"\\"; + set_quote_json_str $foo $foo; + + # OR in-place editing: + # set_quote_json_str $foo; + + # now $foo is: "hello\n\n'\"\\" + } + + location /baz { + set $foo "hello%20world"; + set_unescape_uri $foo $foo; + + # OR in-place editing: + # set_unescape_uri $foo; + + # now $foo is: hello world + } + + upstream_list universe moon sun earth; + upstream moon { ... } + upstream sun { ... } + upstream earth { ... } + location /foo { + set_hashed_upstream $backend universe $arg_id; + drizzle_pass $backend; # used with ngx_drizzle + } + + location /base32 { + set $a 'abcde'; + set_encode_base32 $a; + set_decode_base32 $b $a; + + # now $a == 'c5h66p35' and + # $b == 'abcde' + } + + location /base64 { + set $a 'abcde'; + set_encode_base64 $a; + set_decode_base64 $b $a; + + # now $a == 'YWJjZGU=' and + # $b == 'abcde' + } + + location /hex { + set $a 'abcde'; + set_encode_hex $a; + set_decode_hex $b $a; + + # now $a == '6162636465' and + # $b == 'abcde' + } + + # GET /sha1 yields the output + # aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d + location /sha1 { + set_sha1 $a hello; + echo $a; + } + + # ditto + location /sha1 { + set $a hello; + set_sha1 $a; + echo $a; + } + + # GET /today yields the date of today in local time using format 'yyyy-mm-dd' + location /today { + set_local_today $today; + echo $today; + } + + # GET /signature yields the hmac-sha-1 signature + # given a secret and a string to sign + # this example yields the base64 encoded singature which is + # "HkADYytcoQQzqbjQX33k/ZBB/DQ=" + location /signature { + set $secret_key 'secret-key'; + set $string_to_sign "some-string-to-sign"; + set_hmac_sha1 $signature $secret_key $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } + + location = /rand { + set $from 3; + set $to 15; + set_random $rand $from $to; + + # or write directly + # set_random $rand 3 15; + + echo $rand; # will print a random integer in the range [3, 15] + } +``` + +Description +=========== + +This module extends the standard HttpRewriteModule's directive set to provide more functionalities like URI escaping and unescaping, JSON quoting, Hexadecimal/MD5/SHA1/Base32/Base64 digest encoding and decoding, random number generator, and more! + +Every directive provided by this module can be mixed freely with other [ngx_http_rewrite_module](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html)'s directives, like [if](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#if) and [set](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#set). (Thanks to the [Nginx Devel Kit](https://github.com/simpl/ngx_devel_kit)!) + +[Back to TOC](#table-of-contents) + +Directives +========== + +[Back to TOC](#table-of-contents) + +set_if_empty +------------ +**syntax:** *set_if_empty $dst <src>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Assign the value of the argument `` if and only if variable `$dst` is empty (i.e., not found or has an empty string value). + +In the following example, + +```nginx + + set $a 32; + set_if_empty $a 56; +``` + +the variable `$dst` will take the value 32 at last. But in the sample + +```nginx + + set $a ''; + set $value "hello, world" + set_if_empty $a $value; +``` + +`$a` will take the value `"hello, world"` at last. + +[Back to TOC](#table-of-contents) + +set_quote_sql_str +----------------- +**syntax:** *set_quote_sql_str $dst <src>* + +**syntax:** *set_quote_sql_str $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will quote the value of the second argument `` by MySQL's string value quoting rule and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set $value "hello\n\r'\"\\"; + set_quote_sql_str $quoted $value; + + echo $quoted; + } +``` + +Then request `GET /test` will yield the following output + +```sql + + 'hello\n\r\'\"\\' +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "hello\n\r'\"\\"; + set_quote_sql_str $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive is usually used to prevent SQL injection. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_quote_pgsql_str +------------------- +**syntax:** *set_quote_pgsql_str $dst <src>* + +**syntax:** *set_quote_pgsql_str $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +Very much like [set_quote_sql_str](#set_quote_sql_str), but with PostgreSQL quoting rules for SQL string literals. + +[Back to TOC](#table-of-contents) + +set_quote_json_str +------------------ +**syntax:** *set_quote_json_str $dst <src>* + +**syntax:** *set_quote_json_str $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will quote the value of the second argument `` by JSON string value quoting rule and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set $value "hello\n\r'\"\\"; + set_quote_json_str $quoted $value; + + echo $quoted; + } +``` + +Then request `GET /test` will yield the following output + +```javascript + + "hello\n\r'\"\\" +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "hello\n\r'\"\\"; + set_quote_json_str $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_unescape_uri +---------------- +**syntax:** *set_unescape_uri $dst <src>* + +**syntax:** *set_unescape_uri $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will unescape the value of the second argument `` as a URI component and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set_unescape_uri $key $arg_key; + echo $key; + } +``` + +Then request `GET /test?key=hello+world%21` will yield the following output + +``` +hello world! +``` + +The nginx standard [$arg_PARAMETER](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_) variable holds the raw (escaped) value of the URI parameter. So we need the `set_unescape_uri` directive to unescape it first. + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $key $arg_key; + set_unescape_uri $key; + + echo $key; + } +``` + +then request `GET /test?key=hello+world%21` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_escape_uri +-------------- +**syntax:** *set_escape_uri $dst <src>* + +**syntax:** *set_escape_uri $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +Very much like the [set_unescape_uri](#set_unescape_uri) directive, but does the conversion the other way around, i.e., URL component escaping. + +[Back to TOC](#table-of-contents) + +set_hashed_upstream +------------------- +**syntax:** *set_hashed_upstream $dst <upstream_list_name> <src>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Hashes the string argument `` into one of the upstream name included in the upstream list named ``. The hash function being used is simple modulo. + +Here's an example, + +```nginx + + upstream moon { ... } + upstream sun { ... } + upstream earth { ... } + + upstream_list universe moon sun earth; + + location /test { + set_unescape_uri $key $arg_key; + set $list_name universe; + set_hashed_upstream $backend $list_name $key; + + echo $backend; + } +``` + +Then `GET /test?key=blah` will output either "moon", "sun", or "earth", depending on the actual value of the `key` query argument. + +This directive is usually used to compute an nginx variable to be passed to [memc-nginx-module](http://github.com/openresty/memc-nginx-module)'s [memc_pass](http://github.com/openresty/memc-nginx-module#memc_pass) directive, [redis2-nginx-module](http://github.com/openresty/redis2-nginx-module)'s [[HttpRedis2Module#redis2_pass]] directive, and [ngx_http_proxy_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html)'s [proxy_pass](http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass) directive, among others. + +[Back to TOC](#table-of-contents) + +set_encode_base32 +----------------- +**syntax:** *set_encode_base32 $dst <src>* + +**syntax:** *set_encode_base32 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will encode the value of the second argument `` to its base32(hex) digest and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set $raw "abcde"; + set_encode_base32 $digest $raw; + + echo $digest; + } +``` + +Then request `GET /test` will yield the following output + +``` +c5h66p35 +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +RFC forces the `[A-Z2-7]` RFC-3548 compliant encoding, but we are using the "base32hex" encoding (`[0-9a-v]`) by default. The [set_base32_alphabet](#set_base32_alphabet) directive (first introduced in `v0.28`) allows you to change the alphabet used for encoding/decoding so RFC-3548 compliant encoding is still possible by custom configurations. + +By default, the `=` character is used to pad the left-over bytes due to alignment. But the padding behavior can be completely disabled by setting [set_base32_padding](#set_base32_padding) `off`. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "abcde"; + set_encode_base32 $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_base32_padding +------------------ +**syntax:** *set_base32_padding on|off* + +**default:** *on* + +**context:** *http, server, server if, location, location if* + +**phase:** *no* + +This directive can control whether to pad left-over bytes with the "=" character when encoding a base32 digest by the +[set_encode_base32](#set_encode_base32) directive. + +This directive was first introduced in `v0.28`. If you use earlier versions of this module, then you should use [set_misc_base32_padding](#set_misc_base32_padding) instead. + +[Back to TOC](#table-of-contents) + +set_misc_base32_padding +----------------------- +**syntax:** *set_misc_base32_padding on|off* + +**default:** *on* + +**context:** *http, server, server if, location, location if* + +**phase:** *no* + +This directive has been deprecated since `v0.28`. Use [set_base32_padding](#set_base32_padding) instead if you are using `v0.28+`. + +[Back to TOC](#table-of-contents) + +set_base32_alphabet +------------------- +**syntax:** *set_base32_alphabet <alphabet>* + +**default:** *"0123456789abcdefghijklmnopqrstuv"* + +**context:** *http, server, server if, location, location if* + +**phase:** *no* + +This directive controls the alphabet used for encoding/decoding a base32 digest. It accepts a string containing the desired alphabet like "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" for standard alphabet. + +Extended (base32hex) alphabet is used by default. + +This directive was first introduced in `v0.28`. + +[Back to TOC](#table-of-contents) + +set_decode_base32 +----------------- +**syntax:** *set_decode_base32 $dst <src>* + +**syntax:** *set_decode_base32 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +Similar to the [set_encode_base32](#set_encode_base32) directive, but does exactly the opposite operation, .i.e, decoding a base32(hex) digest into its original form. + +[Back to TOC](#table-of-contents) + +set_encode_base64 +----------------- +**syntax:** *set_encode_base64 $dst <src>* + +**syntax:** *set_encode_base64 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will encode the value of the second argument `` to its base64 digest and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set $raw "abcde"; + set_encode_base64 $digest $raw; + + echo $digest; + } +``` + +Then request `GET /test` will yield the following output + +``` +YWJjZGU= +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "abcde"; + set_encode_base64 $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_encode_base64url +----------------- +**syntax:** *set_encode_base64url $dst <src>* + +**syntax:** *set_encode_base64url $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will encode the value of the second argument `` to its base64 url safe digest and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set $raw "abcde"; + set_encode_base64url $digest $raw; + + echo $digest; + } +``` + +Then request `GET /test` will yield the following output + +``` +YWJjZGU= +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "abcde"; + set_encode_base64url $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_decode_base64 +----------------- +**syntax:** *set_decode_base64 $dst <src>* + +**syntax:** *set_decode_base64 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +Similar to the [set_encode_base64](#set_encode_base64) directive, but does exactly the opposite operation, .i.e, decoding a base64 digest into its original form. + +[Back to TOC](#table-of-contents) + +set_decode_base64url +----------------- +**syntax:** *set_decode_base64url $dst <src>* + +**syntax:** *set_decode_base64url $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +Similar to the [set_encode_base64url](#set_encode_base64url) directive, but does exactly the the opposite operation, .i.e, decoding a base64 url safe digest into its original form. + +[Back to TOC](#table-of-contents) + +set_encode_hex +-------------- +**syntax:** *set_encode_hex $dst <src>* + +**syntax:** *set_encode_hex $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will encode the value of the second argument `` to its hexadecimal digest and assign the result into the first argument, variable `$dst`. For example, + +```nginx + + location /test { + set $raw "章亦春"; + set_encode_hex $digest $raw; + + echo $digest; + } +``` + +Then request `GET /test` will yield the following output + +``` +e7aba0e4baa6e698a5 +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "章亦春"; + set_encode_hex $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_decode_hex +-------------- +**syntax:** *set_decode_hex $dst <src>* + +**syntax:** *set_decode_hex $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +Similar to the [set_encode_hex](#set_encode_hex) directive, but does exactly the opposite operation, .i.e, decoding a hexadecimal digest into its original form. + +[Back to TOC](#table-of-contents) + +set_sha1 +-------- +**syntax:** *set_sha1 $dst <src>* + +**syntax:** *set_sha1 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will encode the value of the second argument `` to its [SHA-1](http://en.wikipedia.org/wiki/SHA-1) digest and assign the result into the first argument, variable `$dst`. The hexadecimal form of the `SHA-1` digest will be generated automatically, use [set_decode_hex](#set_decode_hex) to decode the result if you want the binary form of the `SHA-1` digest. + +For example, + +```nginx + + location /test { + set $raw "hello"; + set_sha1 $digest $raw; + + echo $digest; + } +``` + +Then request `GET /test` will yield the following output + +``` +aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "hello"; + set_sha1 $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_md5 +------- +**syntax:** *set_md5 $dst <src>* + +**syntax:** *set_md5 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +**category:** *ndk_set_var_value* + +When taking two arguments, this directive will encode the value of the second argument `` to its [MD5](http://en.wikipedia.org/wiki/MD5) digest and assign the result into the first argument, variable `$dst`. The hexadecimal form of the `MD5` digest will be generated automatically, use [set_decode_hex](#set_decode_hex) to decode the result if you want the binary form of the `MD5` digest. + +For example, + +```nginx + + location /test { + set $raw "hello"; + set_md5 $digest $raw; + + echo $digest; + } +``` + +Then request `GET /test` will yield the following output + + + 5d41402abc4b2a76b9719d911017c592 + + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +When taking a single argument, this directive will do in-place modification of the argument variable. For example, + +```nginx + + location /test { + set $value "hello"; + set_md5 $value; + + echo $value; + } +``` + +then request `GET /test` will give exactly the same output as the previous example. + +This directive can be invoked by [lua-nginx-module](http://github.com/openresty/lua-nginx-module)'s [ndk.set_var.DIRECTIVE](http://github.com/openresty/lua-nginx-module#ndkset_vardirective) interface and [array-var-nginx-module](http://github.com/openresty/array-var-nginx-module)'s [array_map_op](http://github.com/openresty/array-var-nginx-module#array_map_op) directive. + +[Back to TOC](#table-of-contents) + +set_hmac_sha1 +------------- +**syntax:** *set_hmac_sha1 $dst <secret_key> <src>* + +**syntax:** *set_hmac_sha1 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Computes the [HMAC-SHA1](http://en.wikipedia.org/wiki/HMAC) digest of the argument `` and assigns the result into the argument variable `$dst` with the secret key ``. + +The raw binary form of the `HMAC-SHA1` digest will be generated, use [set_encode_base64](#set_encode_base64), for example, to encode the result to a textual representation if desired. + +For example, + +```nginx + + location /test { + set $secret 'thisisverysecretstuff'; + set $string_to_sign 'some string we want to sign'; + set_hmac_sha1 $signature $secret $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } +``` + +Then request `GET /test` will yield the following output + +``` +R/pvxzHC4NLtj7S+kXFg/NePTmk= +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +This directive requires the OpenSSL library enabled in your Nginx build (usually by passing the `--with-http_ssl_module` option to the `./configure` script). + +[Back to TOC](#table-of-contents) + +set_hmac_sha256 +--------------- +**syntax:** *set_hmac_sha256 $dst <secret_key> <src>* + +**syntax:** *set_hmac_sha256 $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Computes the [HMAC-SHA256](http://en.wikipedia.org/wiki/HMAC) digest of the argument `` and assigns the result into the argument variable `$dst` with the secret key ``. + +The raw binary form of the `HMAC-SHA256` digest will be generated, use [set_encode_base64](#set_encode_base64), for example, to encode the result to a textual representation if desired. + +For example, + +```nginx + + location /test { + set $secret 'thisisverysecretstuff'; + set $string_to_sign 'some string we want to sign'; + set_hmac_sha256 $signature $secret $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } +``` + +Then request `GET /test` will yield the following output + +``` +4pU3GRQrKKIoeLb9CqYsavHE2l6Hx+KMmRmesU+Cfrs= +``` + +Please note that we're using [echo-nginx-module](http://github.com/openresty/echo-nginx-module)'s [echo directive](http://github.com/openresty/echo-nginx-module#echo) here to output values of nginx variables directly. + +This directive requires the OpenSSL library enabled in your Nginx build (usually by passing the `--with-http_ssl_module` option to the `./configure` script). + +[Back to TOC](#table-of-contents) + +set_random +---------- +**syntax:** *set_random $res <from> <to>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Generates a (pseudo) random number (in textual form) within the range `[<$from>, <$to>]` (inclusive). + +Only non-negative numbers are allowed for the `` and `` arguments. + +When `` is greater than ``, their values will be exchanged accordingly. + +For instance, + +```nginx + + location /test { + set $from 5; + set $to 7; + set_random $res $from $to; + + echo $res; + } +``` + +then request `GET /test` will output a number between 5 and 7 (i.e., among 5, 6, 7). + +For now, there's no way to configure a custom random generator seed. + +Behind the scene, it makes use of the standard C function `rand()`. + +This directive was first introduced in the `v0.22rc1` release. + +See also [set_secure_random_alphanum](#set_secure_random_alphanum) and [set_secure_random_lcalpha](#set_secure_random_lcalpha). + +[Back to TOC](#table-of-contents) + +set_secure_random_alphanum +-------------------------- +**syntax:** *set_secure_random_alphanum $res <length>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Generates a cryptographically-strong random string `` characters long with the alphabet `[a-zA-Z0-9]`. + +`` may be between 1 and 64, inclusive. + +For instance, + +```nginx + + location /test { + set_secure_random_alphanum $res 32; + + echo $res; + } +``` + +then request `GET /test` will output a string like `ivVVRP2DGaAqDmdf3Rv4ZDJ7k0gOfASz`. + +This functionality depends on the presence of the `/dev/urandom` device, available on most UNIX-like systems. + +See also [set_secure_random_lcalpha](#set_secure_random_lcalpha) and [set_random](#set_random). + +This directive was first introduced in the `v0.22rc8` release. + +[Back to TOC](#table-of-contents) + +set_secure_random_lcalpha +------------------------- +**syntax:** *set_secure_random_lcalpha $res <length>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Generates a cryptographically-strong random string `` characters long with the alphabet `[a-z]`. + +`` may be between 1 and 64, inclusive. + +For instance, + +```nginx + + location /test { + set_secure_random_lcalpha $res 32; + + echo $res; + } +``` + +then request `GET /test` will output a string like `kcuxcddktffsippuekhshdaclaquiusj`. + +This functionality depends on the presence of the `/dev/urandom` device, available on most UNIX-like systems. + +This directive was first introduced in the `v0.22rc8` release. + +See also [set_secure_random_alphanum](#set_secure_random_alphanum) and [set_random](#set_random). + +[Back to TOC](#table-of-contents) + +set_rotate +---------- +**syntax:** *set_rotate $value <from> <to>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Increments `$value` but keeps it in range from `` to ``. +If `$value` is greater than `` or less than `` is will be +set to `` value. + +The current value after running this directive will always be saved on a per-location basis. And the this saved value will be used for incrementation when the `$value` is not initialized or has a bad value. + +Only non-negative numbers are allowed for the `` and `` arguments. + +When `` is greater than ``, their values will be exchanged accordingly. + +For instance, + +```nginx + + location /rotate { + default_type text/plain; + set $counter $cookie_counter; + set_rotate $counter 1 5; + echo $counter; + add_header Set-Cookie counter=$counter; + } +``` + +then request `GET /rotate` will output next number between 1 and 5 (i.e., 1, 2, 3, 4, 5) on each +refresh of the page. This directive may be userful for banner rotation purposes. + +Another example is to use server-side value persistence to do simple round-robin: + +```nginx + + location /rotate { + default_type text/plain; + set_rotate $counter 0 3; + echo $counter; + } +``` + +And accessing `/rotate` will also output integer sequence 0, 1, 2, 3, 0, 1, 2, 3, and so on. + +This directive was first introduced in the `v0.22rc7` release. + +[Back to TOC](#table-of-contents) + +set_local_today +--------------- +**syntax:** *set_local_today $dst* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Set today's date ("yyyy-mm-dd") in localtime to the argument variable `$dst`. + +Here's an example, + +```nginx + + location /today { + set_local_today $today; + echo $today; + } +``` + +then request `GET /today` will output something like + +``` +2011-08-16 +``` + +and year, the actual date you get here will vary every day ;) + +Behind the scene, this directive utilizes the `ngx_time` API in the Nginx core, so usually no syscall is involved due to the time caching mechanism in the Nginx core. + +[Back to TOC](#table-of-contents) + +set_formatted_gmt_time +---------------------- +**syntax:** *set_formatted_gmt_time $res <time-format>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Set a formatted GMT time to variable `$res` (as the first argument) using the format string in the second argument. + +All the conversion specification notations in the standard C function `strftime` are supported, like `%Y` (for 4-digit years) and `%M` (for minutes in decimal). See for a complete list of conversion specification symbols. + +Below is an example: + +```nginx + + location = /t { + set_formatted_gmt_time $timestr "%a %b %e %H:%M:%S %Y GMT"; + echo $timestr; + } +``` + +Accessing `/t` yields the output + +``` +Fri Dec 13 15:34:37 2013 GMT +``` + +This directive was first added in the `0.23` release. + +See also [set_formatted_local_time](#set_formatted_local_time). + +[Back to TOC](#table-of-contents) + +set_formatted_local_time +------------------------ +**syntax:** *set_formatted_local_time $res <time-format>* + +**default:** *no* + +**context:** *location, location if* + +**phase:** *rewrite* + +Set a formatted local time to variable `$res` (as the first argument) using the format string in the second argument. + +All the conversion specification notations in the standard C function `strftime` are supported, like `%Y` (for 4-digit years) and `%M` (for minutes in decimal). See for a complete list of conversion specification symbols. + +Below is an example: + +```nginx + + location = /t { + set_formatted_local_time $timestr "%a %b %e %H:%M:%S %Y %Z"; + echo $timestr; + } +``` + +Accessing `/t` yields the output + +``` +Fri Dec 13 15:42:15 2013 PST +``` + +This directive was first added in the `0.23` release. + +See also [set_formatted_gmt_time](#set_formatted_gmt_time). + +[Back to TOC](#table-of-contents) + +Caveats +======= + +Do not use [$arg_PARAMETER](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_arg_), [$cookie_COOKIE](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_cookie_), [$http_HEADER](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_http_) or other special variables defined in the Nginx core module as the target variable in this module's directives. For instance, + +```nginx + + set_if_empty $arg_user 'foo'; # DO NOT USE THIS! +``` + +may lead to segmentation faults. + +[Back to TOC](#table-of-contents) + +Installation +============ + +This module is included and enabled by default in the [OpenResty bundle](http://openresty.org). If you want to install this module manually with your own Nginx source tarball, then follow the steps below: + +Grab the nginx source code from [nginx.org](http://nginx.org/), for example, +the version 1.13.6 (see [nginx compatibility](#compatibility)), and then build the source with this module: + +```bash + + wget 'http://nginx.org/download/nginx-1.13.6.tar.gz' + tar -xzvf nginx-1.13.6.tar.gz + cd nginx-1.13.6/ + + # Here we assume you would install you nginx under /opt/nginx/. + ./configure --prefix=/opt/nginx \ + --with-http_ssl_module \ + --add-module=/path/to/ngx_devel_kit \ + --add-module=/path/to/set-misc-nginx-module + + make -j2 + make install +``` + +Download the latest version of the release tarball of this module from [set-misc-nginx-module file list](http://github.com/openresty/set-misc-nginx-module/tags), and the latest tarball for [ngx_devel_kit](https://github.com/simplresty/ngx_devel_kit) from its [file list](https://github.com/simplresty/ngx_devel_kit/tags). + +[Back to TOC](#table-of-contents) + +Building as a dynamic module +---------------------------- + +Starting from NGINX 1.9.11, you can also compile this module as a dynamic module, by using the `--add-dynamic-module=PATH` option instead of `--add-module=PATH` on the +`./configure` command line above. And then you can explicitly load the module in your `nginx.conf` via the [load_module](http://nginx.org/en/docs/ngx_core_module.html#load_module) +directive, for example, + +```nginx +load_module /path/to/modules/ndk_http_module.so; # assuming NDK is built as a dynamic module too +load_module /path/to/modules/ngx_http_set_misc_module.so; +``` + +Also, this module is included and enabled by default in the [OpenResty bundle](http://openresty.org/). + +[Back to TOC](#table-of-contents) + +Compatibility +============= + +The following versions of Nginx should work with this module: + +* **1.13.x** (last tested: 1.13.6) +* **1.12.x** +* **1.11.x** (last tested: 1.11.2) +* **1.10.x** +* **1.9.x** (last tested: 1.9.15) +* **1.8.x** +* **1.7.x** (last tested: 1.7.10) +* **1.6.x** +* **1.5.x** (last tested: 1.5.8) +* **1.4.x** (last tested: 1.4.4) +* **1.2.x** (last tested: 1.2.9) +* **1.1.x** (last tested: 1.1.5) +* **1.0.x** (last tested: 1.0.15) +* **0.9.x** (last tested: 0.9.4) +* **0.8.x** (last tested: 0.8.54) +* **0.7.x >= 0.7.46** (last tested: 0.7.68) + +If you find that any particular version of Nginx above 0.7.46 does not work with this module, please consider [reporting a bug](#report-bugs). + +[Back to TOC](#table-of-contents) + +Report Bugs +=========== + +Although a lot of effort has been put into testing and code tuning, there must be some serious bugs lurking somewhere in this module. So whenever you are bitten by any quirks, please don't hesitate to + +1. send a bug report or even patches to the [openresty-en mailing list](https://groups.google.com/group/openresty-en), +1. or create a ticket on the [issue tracking interface](http://github.com/openresty/set-misc-nginx-module/issues) provided by GitHub. + +[Back to TOC](#table-of-contents) + +Source Repository +================= + +Available on github at [openresty/set-misc-nginx-module](http://github.com/openresty/set-misc-nginx-module). + +[Back to TOC](#table-of-contents) + +Changes +======= + +The change logs for every release of this module can be obtained from the OpenResty bundle's change logs: + + + +[Back to TOC](#table-of-contents) + +Test Suite +========== + +This module comes with a Perl-driven test suite. The [test cases](http://github.com/openresty/set-misc-nginx-module/tree/master/t/) are +[declarative](http://github.com/openresty/set-misc-nginx-module/blob/master/t/escape-uri.t) too. Thanks to the [Test::Nginx](http://search.cpan.org/perldoc?Test::Nginx) module in the Perl world. + +To run it on your side: + +```bash + + $ PATH=/path/to/your/nginx-with-set-misc-module:$PATH prove -r t +``` + +You need to terminate any Nginx processes before running the test suite if you have changed the Nginx server binary. + +Because a single nginx server (by default, `localhost:1984`) is used across all the test scripts (`.t` files), it's meaningless to run the test suite in parallel by specifying `-jN` when invoking the `prove` utility. + +[Back to TOC](#table-of-contents) + +Getting involved +================ + +You'll be very welcomed to submit patches to the [author](#author) or just ask for a commit bit to the [source repository](#source-repository) on GitHub. + +[Back to TOC](#table-of-contents) + +Author +====== + +Yichun Zhang (agentzh) *<agentzh@gmail.com>*, OpenResty Inc. + +This wiki page is also maintained by the author himself, and everybody is encouraged to improve this page as well. + +[Back to TOC](#table-of-contents) + +Copyright & License +=================== + +Copyright (C) 2009-2018, Yichun Zhang (章亦春) , OpenResty Inc. + +This module is licensed under the terms of the BSD license. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +[Back to TOC](#table-of-contents) + +See Also +======== +* [Nginx Devel Kit](https://github.com/simpl/ngx_devel_kit) +* [The OpenResty bundle](http://openresty.org) + +[Back to TOC](#table-of-contents) + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/config b/modules_deb/libnginx-mod-http-set-misc-0.33/config new file mode 100755 index 0000000..7bb00af --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/config @@ -0,0 +1,79 @@ +ngx_addon_name=ngx_http_set_misc_module + +if test -n "$ngx_module_link"; then + if test -n "$NDK_SRCS"; then + echo "found ngx_devel_kit for ngx_set_misc; looks good." + else + echo "error: ngx_devel_kit is required to build ngx_set_misc; please put it before ngx_set_misc." 1>&2 + exit 1 + fi +else + if echo $HTTP_MODULES | grep " ndk_http_module" > /dev/null; then + echo "found ngx_devel_kit for ngx_set_misc; looks good." + else + echo "error: ngx_devel_kit is required to build ngx_set_misc; please put it before ngx_set_misc." 1>&2 + exit 1 + fi +fi + +SET_MISC_SRCS=" \ + $ngx_addon_dir/src/ngx_http_set_base32.c \ + $ngx_addon_dir/src/ngx_http_set_default_value.c \ + $ngx_addon_dir/src/ngx_http_set_hashed_upstream.c \ + $ngx_addon_dir/src/ngx_http_set_quote_sql.c \ + $ngx_addon_dir/src/ngx_http_set_quote_json.c \ + $ngx_addon_dir/src/ngx_http_set_unescape_uri.c \ + $ngx_addon_dir/src/ngx_http_set_misc_module.c \ + $ngx_addon_dir/src/ngx_http_set_escape_uri.c \ + $ngx_addon_dir/src/ngx_http_set_hash.c \ + $ngx_addon_dir/src/ngx_http_set_local_today.c \ + $ngx_addon_dir/src/ngx_http_set_hex.c \ + $ngx_addon_dir/src/ngx_http_set_base64.c \ + $ngx_addon_dir/src/ngx_http_set_base64url.c \ + $ngx_addon_dir/src/ngx_http_set_random.c \ + $ngx_addon_dir/src/ngx_http_set_secure_random.c \ + $ngx_addon_dir/src/ngx_http_set_rotate.c + " + +SET_MISC_DEPS=" \ + $ngx_addon_dir/src/ddebug.h \ + $ngx_addon_dir/src/ngx_http_set_default_value.h \ + $ngx_addon_dir/src/ngx_http_set_hashed_upstream.h \ + $ngx_addon_dir/src/ngx_http_set_quote_sql.h \ + $ngx_addon_dir/src/ngx_http_set_quote_json.h \ + $ngx_addon_dir/src/ngx_http_set_unescape_uri.h \ + $ngx_addon_dir/src/ngx_http_set_escape_uri.h \ + $ngx_addon_dir/src/ngx_http_set_hash.h \ + $ngx_addon_dir/src/ngx_http_set_local_today.h \ + $ngx_addon_dir/src/ngx_http_set_hex.h \ + $ngx_addon_dir/src/ngx_http_set_base64url.h \ + $ngx_addon_dir/src/ngx_http_set_base64.h \ + $ngx_addon_dir/src/ngx_http_set_random.h \ + $ngx_addon_dir/src/ngx_http_set_rotate.h \ + $ngx_addon_dir/src/ngx_http_set_secure_random.h \ + $ngx_addon_dir/src/ngx_http_set_misc_module.h \ + " + +if [ $USE_OPENSSL = YES -o $MAIL_SSL = YES ]; then + SET_MISC_DEPS="$SET_MISC_DEPS $ngx_addon_dir/src/ngx_http_set_hmac.h" + SET_MISC_SRCS="$SET_MISC_SRCS $ngx_addon_dir/src/ngx_http_set_hmac.c" +fi + +CFLAGS="$CFLAGS -DNDK_SET_VAR -DNDK_UPSTREAM_LIST" +USE_SHA1=YES +USE_MD5=YES + +if test -n "$ngx_module_link"; then + ngx_module_type=HTTP + ngx_module_name=$ngx_addon_name + ngx_module_incs= + ngx_module_deps="$SET_MISC_DEPS" + ngx_module_srcs="$SET_MISC_SRCS" + ngx_module_libs= + + . auto/module +else + HTTP_MODULES="$HTTP_MODULES $ngx_addon_name" + NGX_ADDON_SRCS="$NGX_ADDON_SRCS $SET_MISC_SRCS" + NGX_ADDON_DEPS="$NGX_ADDON_DEPS $SET_MISC_DEPS" +fi diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/changelog b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/changelog new file mode 100644 index 0000000..bb494f4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/changelog @@ -0,0 +1,53 @@ +libnginx-mod-http-set-misc (0.33-6) unstable; urgency=medium + + * Team upload. + * d/control: bump Standards-Version: 4.7.2, no changes + * d/watch: use more generic template + * d/copyright: bump debian/* copyright year + + -- Jan Mojžíš Sat, 12 Apr 2025 09:05:50 +0200 + +libnginx-mod-http-set-misc (0.33-5) unstable; urgency=medium + + * Team upload. + * Better usage of dh-sequence-nginx. + * d/control: remove Build-Depends nginx-abi-1.24.0-1 + * d/rules: remove override_dh_auto_test, override_dh_auto_test + * d/control: remove Depends libnginx-mod-http-ndk + * d/copyright-scan-patterns.yml add + + -- Jan Mojžíš Sun, 08 Oct 2023 17:10:26 +0200 + +libnginx-mod-http-set-misc (0.33-4) unstable; urgency=medium + + * Team upload. + * NEW ABI: rebuild with nginx-abi-1.24.0-1 + + -- Jan Mojžíš Wed, 28 Jun 2023 00:01:59 +0200 + +libnginx-mod-http-set-misc (0.33-3) unstable; urgency=medium + + * Team upload. + * d/t/set_if_empty renamed to d/t/setifempty, fixes lintian + warning illegal-runtime-test-name + * d/t/generic rework. The test now checks module after + installation/reload/restart. + * d/control: bump Standards-Version: 4.6.2, no changes + * d/copyright: reformat text to be compatible with 'cme update dpkg-copyright' + * d/fix.scanned.copyright: added, fixes upstream author name parsing + * NEW ABI: rebuild with nginx-abi-1.22.1-7 + + -- Jan Mojžíš Mon, 13 Feb 2023 12:56:37 +0100 + +libnginx-mod-http-set-misc (0.33-2) unstable; urgency=medium + + * Team upload. + * d/control: fixed dependency libnginx-mod-http-ndk-dev (>= 1:0.3.2-2) + + -- Jan Mojžíš Fri, 09 Dec 2022 14:08:01 +0100 + +libnginx-mod-http-set-misc (0.33-1) unstable; urgency=medium + + * Initial release. (Closes: #1025291) + + -- Jérémy Lal Fri, 02 Dec 2022 00:32:56 +0100 diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/control b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/control new file mode 100644 index 0000000..9223829 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/control @@ -0,0 +1,27 @@ +Source: libnginx-mod-http-set-misc +Section: httpd +Priority: optional +Maintainer: Debian Nginx Maintainers +Uploaders: Jérémy Lal , +Build-Depends: debhelper-compat (= 13), + dh-sequence-nginx, + libnginx-mod-http-ndk-dev (>= 1:0.3.2-2), +Standards-Version: 4.7.2 +Homepage: https://github.com/openresty/set-misc-nginx-module +Vcs-Git: https://salsa.debian.org/nginx-team/libnginx-mod-http-set-misc.git +Vcs-Browser: https://salsa.debian.org/nginx-team/libnginx-mod-http-set-misc +Rules-Requires-Root: no + +Package: libnginx-mod-http-set-misc +Architecture: any +Multi-Arch: foreign +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Recommends: nginx, +Description: Extended rewrite directives module for Nginx + This module provides more directives that can be used in + the Nginx rewrite phase, like the 'set' directive. + - URI escaping and unescaping + - JSON quoting + - digests encoding and decoding + - random number generator diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright new file mode 100644 index 0000000..f77abc0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright @@ -0,0 +1,49 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: memc-nginx-module +Upstream-Contact: Yichun "agentzh" Zhang (章亦春) +Source: https://github.com/openresty/set-misc-nginx-module + +Files: * +Copyright: 2009-2018, Yichun Zhang (章亦春) , OpenResty Inc. +License: BSD-2-clause + +Files: config +Copyright: 2009-2018, Yichun Zhang (章亦春) , OpenResty Inc. +License: BSD-2-clause + +Files: debian/* +Copyright: 2022, Jérémy Lal , + 2022-2025, Jan Mojzis +License: BSD-2-clause + +Files: src/* +Copyright: 2009-2018, Yichun Zhang (章亦春) , OpenResty Inc. +License: BSD-2-clause + +Files: t/* +Copyright: 2009-2018, Yichun Zhang (章亦春) , OpenResty Inc. +License: BSD-2-clause + +Files: util/* +Copyright: 2009-2018, Yichun Zhang (章亦春) , OpenResty Inc. +License: BSD-2-clause + +License: BSD-2-clause + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + . + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + . + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright-scan-patterns.yml b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright-scan-patterns.yml new file mode 100644 index 0000000..e195ac6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/copyright-scan-patterns.yml @@ -0,0 +1,4 @@ +--- +ignore: + pattern: + - debian/output diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/fix.scanned.copyright b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/fix.scanned.copyright new file mode 100644 index 0000000..b25e244 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/fix.scanned.copyright @@ -0,0 +1,2 @@ +# fixes upstream author name parsing +! copyright Files:~/.*/ Copyright=~"s/(Zhang)\s\(.*x\{6625\}\)/$1\ (章亦春)/" diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/gbp.conf b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/gbp.conf new file mode 100644 index 0000000..38c12c1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/gbp.conf @@ -0,0 +1,9 @@ +[DEFAULT] +debian-branch = main +upstream-branch = upstream +upstream-tag = upstream/%(version)s +pristine-tar = True +sign-tags = True + +[import-orig] +merge-mode = replace diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/rules b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/rules new file mode 100755 index 0000000..d8309f6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/source/format b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/control b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/control new file mode 100644 index 0000000..9ecf806 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/control @@ -0,0 +1,13 @@ +Tests: generic +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, + +Tests: setifempty +Restrictions: allow-stderr isolation-container needs-root +Depends: curl, + nginx, + nginx-core, + @, diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/generic b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/generic new file mode 100644 index 0000000..a14fc80 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/generic @@ -0,0 +1,73 @@ +#!/bin/sh +# version 20221215 + +# generic test that only verifies that nginx is running with the given +# libnginx-... module +# - after installation +# - after nginx reload +# - after nginx restart + +EX=0 +CURL_CMD="curl --max-time 60 --silent --fail -o /dev/null" + +#change directory to $AUTOPKGTEST_TMP +cd "${AUTOPKGTEST_TMP}" + +echo -n "curl after installation: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx reload ... " +if invoke-rc.d nginx reload; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + + +echo -n "curl after reload: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +echo -n "nginx restart ... " +if invoke-rc.d nginx restart; then + echo "OK" +else + EX=1 + echo "FAILED" +fi +sleep 5 + +echo -n "curl after restart: http status=" +if $CURL_CMD -w "response_code: %{http_code}, ... " http://127.0.0.1/; then + echo "OK" +else + EX=1 + echo "FAILED" +fi + +if [ ${EX} -ne 0 ]; then + echo "=== journalctl ===" + journalctl -n all -xu nginx.service || : + + echo "=== error.log ===" + if [ `wc -l /var/log/nginx/error.log | cut -d ' ' -f1` -gt 100 ]; then + head -n 50 /var/log/nginx/error.log + echo '...' + tail -n 50 /var/log/nginx/error.log + else + cat /var/log/nginx/error.log + fi +fi + +exit ${EX} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/setifempty b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/setifempty new file mode 100644 index 0000000..6aee6f3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/tests/setifempty @@ -0,0 +1,36 @@ +#!/bin/sh +set -e + +cat < "/etc/nginx/sites-enabled/default" +server { + listen 80 default_server; + + location /setifempty { + set_if_empty \$var aaa; + set_if_empty \$var bbb; + if (\$var = aaa ) { + return 200; + } + return 500; + } +} +EOF + +exp="response_code: 200" + +nginx -t +invoke-rc.d nginx restart || { journalctl -n all -xu nginx.service; exit 1; } + +out=`curl --fail -w "response_code: %{http_code}\n" http://127.0.0.1/setifempty` + +if [ x"${out}" != x"${exp}" ]; then + echo "output:" + echo "=====================" + echo "${out}" + echo "=====================" + echo "expected output:" + echo "=====================" + echo "${exp}" + echo "=====================" + exit 1 +fi diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/upstream/metadata b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/upstream/metadata new file mode 100644 index 0000000..fe767d2 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/upstream/metadata @@ -0,0 +1,4 @@ +--- +Bug-Database: https://github.com/openresty/set-misc-nginx-module/issues +Bug-Submit: https://github.com/openresty/set-misc-nginx-module/issues/new +Repository-Browse: https://github.com/openresty/set-misc-nginx-module diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/debian/watch b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/watch new file mode 100644 index 0000000..b6d7cc0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/debian/watch @@ -0,0 +1,6 @@ +version=4 +opts="\ +uversionmangle=s/(\d)[_\.\-\+]?((RC|rc|pre|dev|beta|alpha|a|b)\d*)$/$1~$2/,\ +" \ +https://github.com/openresty/set-misc-nginx-module/tags \ +(?:.*?/)?v?@ANY_VERSION@@ARCHIVE_EXT@ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ddebug.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ddebug.h new file mode 100644 index 0000000..aaa6fef --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ddebug.h @@ -0,0 +1,74 @@ +#ifndef DDEBUG_H +#define DDEBUG_H + +#include +#include + +#if defined(DDEBUG) && (DDEBUG) + +# if (NGX_HAVE_VARIADIC_MACROS) + +# define dd(...) fprintf(stderr, "set_misc *** "); \ + fprintf(stderr, __VA_ARGS__); \ + fprintf(stderr, " at %s line %d.\n", __FILE__, __LINE__) + +# else + +#include +#include + +#include + +static ngx_inline void +dd(const char *fmt, ...) { +} + +# endif + +#else + +# if (NGX_HAVE_VARIADIC_MACROS) + +# define dd(...) + +# else + +#include + +static ngx_inline void +dd(const char *fmt, ...) { +} + +# endif + +#endif + +#if defined(DDEBUG) && (DDEBUG) + +#define dd_check_read_event_handler(r) \ + dd("r->read_event_handler = %s", \ + r->read_event_handler == ngx_http_block_reading ? \ + "ngx_http_block_reading" : \ + r->read_event_handler == ngx_http_test_reading ? \ + "ngx_http_test_reading" : \ + r->read_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#define dd_check_write_event_handler(r) \ + dd("r->write_event_handler = %s", \ + r->write_event_handler == ngx_http_handler ? \ + "ngx_http_handler" : \ + r->write_event_handler == ngx_http_core_run_phases ? \ + "ngx_http_core_run_phases" : \ + r->write_event_handler == ngx_http_request_empty_handler ? \ + "ngx_http_request_empty_handler" : "UNKNOWN") + +#else + +#define dd_check_read_event_handler(r) +#define dd_check_write_event_handler(r) + +#endif + +#endif /* DDEBUG_H */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.c new file mode 100644 index 0000000..c56c7ba --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.c @@ -0,0 +1,263 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include + +#include "ngx_http_set_base32.h" +#include "ngx_http_set_misc_module.h" + + +#define base32_encoded_length(len) ((((len)+4)/5)*8) +#define base32_decoded_length(len) ((((len)+7)/8)*5) + + +static void encode_base32(size_t slen, u_char *src, size_t *dlen, u_char *dst, + ngx_flag_t padding, ngx_str_t *alphabet); +static int decode_base32(size_t slen, u_char *src, size_t *dlen, u_char *dst, + u_char *basis32); + + +ngx_int_t +ngx_http_set_misc_encode_base32(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + size_t len; + u_char *p; + u_char *src, *dst; + + ngx_http_set_misc_loc_conf_t *conf; + + conf = ngx_http_get_module_loc_conf(r, ngx_http_set_misc_module); + + len = base32_encoded_length(v->len); + + dd("estimated dst len: %d", (int) len); + + p = ngx_palloc(r->pool, len); + if (p == NULL) { + return NGX_ERROR; + } + + src = v->data; dst = p; + + encode_base32(v->len, src, &len, dst, conf->base32_padding, + &conf->base32_alphabet); + + res->data = p; + res->len = len; + + dd("res (len %d): %.*s", (int) res->len, (int) res->len, res->data); + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_misc_decode_base32(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + size_t len; + u_char *p; + u_char *src, *dst; + int ret; + + ngx_http_set_misc_loc_conf_t *conf; + + conf = ngx_http_get_module_loc_conf(r, ngx_http_set_misc_module); + + len = base32_decoded_length(v->len); + + dd("estimated dst len: %d", (int) len); + + p = ngx_palloc(r->pool, len); + if (p == NULL) { + return NGX_ERROR; + } + + src = v->data; dst = p; + + ret = decode_base32(v->len, src, &len, dst, conf->basis32); + + if (ret == 0 /* OK */) { + res->data = p; + res->len = len; + + return NGX_OK; + } + + /* failed to decode */ + + res->data = NULL; + res->len = 0; + + return NGX_OK; +} + + +/* See the implementation in src/core/ngx_string.c's + * ngx_(encode|decode)_base64() for details. */ + +static void +encode_base32(size_t slen, u_char *src, size_t *dlen, u_char *dst, + ngx_flag_t padding, ngx_str_t *alphabet) +{ + unsigned char *basis32 = alphabet->data; + + size_t len; + u_char *s; + u_char *d; + + len = slen; + s = src; + d = dst; + + while (len > 4) { + *d++ = basis32[s[0] >> 3]; + *d++ = basis32[((s[0] & 0x07) << 2) | (s[1] >> 6)]; + *d++ = basis32[(s[1] >> 1) & 0x1f]; + *d++ = basis32[((s[1] & 1) << 4) | (s[2] >> 4)]; + *d++ = basis32[((s[2] & 0x0f) << 1) | (s[3] >> 7)]; + *d++ = basis32[(s[3] >> 2) & 0x1f]; + *d++ = basis32[((s[3] & 0x03) << 3) | (s[4] >> 5)]; + *d++ = basis32[s[4] & 0x1f]; + + s += 5; + len -= 5; + } + + if (len) { + *d++ = basis32[s[0] >> 3]; + + if (len == 1) { + /* 1 byte left */ + *d++ = basis32[(s[0] & 0x07) << 2]; + + /* pad six '='s to the end */ + if (padding) { + *d++ = '='; + *d++ = '='; + *d++ = '='; + *d++ = '='; + *d++ = '='; + } + + } else { + *d++ = basis32[((s[0] & 0x07) << 2) | (s[1] >> 6)]; + *d++ = basis32[(s[1] >> 1) & 0x1f]; + + if (len == 2) { + /* 2 bytes left */ + *d++ = basis32[(s[1] & 1) << 4]; + + /* pad four '='s to the end */ + if (padding) { + *d++ = '='; + *d++ = '='; + *d++ = '='; + } + + } else { + *d++ = basis32[((s[1] & 1) << 4) | (s[2] >> 4)]; + + if (len == 3) { + /* 3 bytes left */ + *d++ = basis32[(s[2] & 0x0f) << 1]; + + if (padding) { + /* pad three '='s to the end */ + *d++ = '='; + *d++ = '='; + } + + } else { + /* 4 bytes left */ + *d++ = basis32[((s[2] & 0x0f) << 1) | (s[3] >> 7)]; + *d++ = basis32[(s[3] >> 2) & 0x1f]; + *d++ = basis32[(s[3] & 0x03) << 3]; + + /* pad one '=' to the end */ + } + } + } + + if (padding) { + *d++ = '='; + } + } + + *dlen = (size_t) (d - dst); +} + + +static int +decode_base32(size_t slen, u_char *src, size_t *dlen, u_char *dst, + u_char *basis32) +{ + size_t len, mod; + u_char *s = src; + u_char *d = dst; + + for (len = 0; len < slen; len++) { + if (s[len] == '=') { + break; + } + + if (basis32[s[len]] == 77) { + return -1; + } + } + + mod = len % 8; + + if (mod == 1 || mod == 3 || mod == 6) { + /* bad Base32 digest length */ + return -1; + } + + while (len > 7) { + *d++ = (basis32[s[0]] << 3) | ((basis32[s[1]] >> 2) & 0x07); + + *d++ = ((basis32[s[1]] & 0x03) << 6) | (basis32[s[2]] << 1) | + ((basis32[s[3]] >> 4) & 1); + + *d++ = ((basis32[s[3]] & 0x0f) << 4) | ((basis32[s[4]] >> 1) & 0x0f); + + *d++ = ((basis32[s[4]] & 1) << 7) | ((basis32[s[5]] & 0x1f) << 2) | + ((basis32[s[6]] >> 3) & 0x03); + *d++ = ((basis32[s[6]] & 0x07) << 5) | (basis32[s[7]] & 0x1f); + + s += 8; + len -= 8; + } + + if (len) { + /* 2 bytes left */ + *d++ = (basis32[s[0]] << 3) | ((basis32[s[1]] >> 2) & 0x07); + + if (len > 2) { + /* 4 bytes left */ + *d++ = ((basis32[s[1]] & 0x03) << 6) | ((basis32[s[2]] & 0x1f) << 1) + | ((basis32[s[3]] >> 4) & 1); + + if (len > 4) { + /* 5 bytes left */ + *d++ = ((basis32[s[3]] & 0x0f) << 4) | + ((basis32[s[4]] >> 1) & 0x0f); + + if (len > 5) { + /* 7 bytes left */ + *d++ = ((basis32[s[4]] & 1) << 7) | + ((basis32[s[5]] & 0x1f) << 2) | + ((basis32[s[6]] >> 3) & 0x03); + } + } + } + } + + *dlen = (size_t) (d - dst); + + return 0; +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.h new file mode 100644 index 0000000..68ca277 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base32.h @@ -0,0 +1,18 @@ +#ifndef NGX_HTTP_SET_BASE32 +#define NGX_HTTP_SET_BASE32 + + +#include +#include +#include + + +ngx_int_t ngx_http_set_misc_encode_base32(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_decode_base32(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + + +#endif /* NGX_HTTP_SET_BASE32 */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.c new file mode 100644 index 0000000..8666ad8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.c @@ -0,0 +1,48 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_base64.h" + + +ngx_int_t +ngx_http_set_misc_set_decode_base64(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + ngx_str_t src; + + src.len = v->len; + src.data = v->data; + + res->len = ngx_base64_decoded_length(v->len); + ndk_palloc_re(res->data, r->pool, res->len); + + if (ngx_decode_base64(res, &src) != NGX_OK) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_decode_base64: invalid value"); + return NGX_ERROR; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_misc_set_encode_base64(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + ngx_str_t src; + + src.len = v->len; + src.data = v->data; + + res->len = ngx_base64_encoded_length(v->len); + ndk_palloc_re(res->data, r->pool, res->len); + + ngx_encode_base64(res, &src); + + return NGX_OK; +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.h new file mode 100644 index 0000000..6594c77 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64.h @@ -0,0 +1,10 @@ +#include +#include +#include + +ngx_int_t ngx_http_set_misc_set_encode_base64(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_set_decode_base64(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.c new file mode 100644 index 0000000..f1426ad --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.c @@ -0,0 +1,50 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_base64url.h" + + +ngx_int_t +ngx_http_set_misc_set_decode_base64url(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + + ngx_str_t src; + + src.len = v->len; + src.data = v->data; + + res->len = ngx_base64_decoded_length(v->len); + ndk_palloc_re(res->data, r->pool, res->len); + + if (ngx_decode_base64url(res, &src) != NGX_OK) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_decode_base64url: invalid value"); + return NGX_ERROR; + } + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_misc_set_encode_base64url(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + + ngx_str_t src; + + src.len = v->len; + src.data = v->data; + + res->len = ngx_base64_encoded_length(v->len); + ndk_palloc_re(res->data, r->pool, res->len); + + ngx_encode_base64url(res, &src); + + return NGX_OK; +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.h new file mode 100644 index 0000000..6ccf63b --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_base64url.h @@ -0,0 +1,10 @@ +#include +#include +#include + +ngx_int_t ngx_http_set_misc_set_encode_base64url(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_set_decode_base64url(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.c new file mode 100644 index 0000000..f4c80a1 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.c @@ -0,0 +1,48 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_default_value.h" + + +ngx_int_t +ngx_http_set_misc_set_if_empty(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + ngx_http_variable_value_t *cur_v, *default_v; + + cur_v = &v[0]; + default_v = &v[1]; + + if (cur_v->not_found || cur_v->len == 0) { + res->data = default_v->data; + res->len = default_v->len; + + return NGX_OK; + } + + res->data = cur_v->data; + res->len = cur_v->len; + + return NGX_OK; +} + + +char * +ngx_http_set_if_empty(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value; + ndk_set_var_t filter; + + value = cf->args->elts; + + filter.type = NDK_SET_VAR_MULTI_VALUE; + filter.func = (void *) ngx_http_set_misc_set_if_empty; + filter.size = 2; + filter.data = NULL; + + return ndk_set_var_multi_value_core(cf, &value[1], &value[1], &filter); +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.h new file mode 100644 index 0000000..5bf5168 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_default_value.h @@ -0,0 +1,15 @@ +#include +#include +#include + +#ifndef NGX_HTTP_SET_DEFAULT_VALUE +#define NGX_HTTP_SET_DEFAULT_VALUE + + +char *ngx_http_set_if_empty(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); +ngx_int_t ngx_http_set_misc_set_if_empty(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + + +#endif /* NGX_HTTP_SET_DEFAULT_VALUE */ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.c new file mode 100644 index 0000000..a09f8da --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.c @@ -0,0 +1,210 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_escape_uri.h" +#include "ngx_string.h" + + +static uintptr_t ngx_escape_uri_patched(u_char *dst, u_char *src, size_t size, + ngx_uint_t type); + + +ngx_int_t +ngx_http_set_misc_escape_uri(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + size_t len; + uintptr_t escape; + u_char *src, *dst; + + if (v->len == 0) { + res->len = 0; + res->data = NULL; + return NGX_OK; + } + + src = v->data; + + dd("before escape:%.*s", v->len, v->data); + escape = 2 * ngx_escape_uri_patched(NULL, src, v->len, NGX_ESCAPE_URI); + /* len = v->len + 2 * ngx_escape_uri(NULL, src, v->len, NGX_ESCAPE_URI); */ + len = escape + v->len; + dd("escaped string len:%zu", len); + + dst = ngx_palloc(r->pool, len); + + if (dst == NULL) { + return NGX_ERROR; + } + + if (escape == 0) { + ngx_memcpy(dst, src, len); + dd("escape == 0"); + + } else { + ngx_escape_uri_patched(dst, src, v->len, NGX_ESCAPE_URI); + } + + res->data = dst; + res->len = len; + + dd("after eacape:%.*s", (int) res->len, res->data); + + return NGX_OK; +} + + +static uintptr_t +ngx_escape_uri_patched(u_char *dst, u_char *src, size_t size, ngx_uint_t type) +{ + ngx_uint_t n; + uint32_t *escape; + static u_char hex[] = "0123456789ABCDEF"; + + /* " ", "#", "%", "?", %00-%1F, %7F-%FF */ + + static uint32_t uri[] = { + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + + /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ + 0xfc00886d, /* 1111 1100 0000 0000 1000 1000 0110 1101 */ + + /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ + 0x78000000, /* 0111 1000 0000 0000 0000 0000 0000 0000 */ + + /* ~}| {zyx wvut srqp onml kjih gfed cba` */ + 0xa8000000, /* 1010 1000 0000 0000 0000 0000 0000 0000 */ + + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + }; + + /* " ", "#", "%", "+", "?", %00-%1F, %7F-%FF */ + + static uint32_t args[] = { + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + + /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ + 0x80000829, /* 1000 0000 0000 0000 0000 1000 0010 1001 */ + + /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + + /* ~}| {zyx wvut srqp onml kjih gfed cba` */ + 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ + + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + }; + + /* " ", "#", """, "%", "'", %00-%1F, %7F-%FF */ + + static uint32_t html[] = { + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + + /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ + 0x000000ad, /* 0000 0000 0000 0000 0000 0000 1010 1101 */ + + /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + + /* ~}| {zyx wvut srqp onml kjih gfed cba` */ + 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ + + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + }; + + /* " ", """, "%", "'", %00-%1F, %7F-%FF */ + + static uint32_t refresh[] = { + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + + /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ + 0x00000085, /* 0000 0000 0000 0000 0000 0000 1000 0101 */ + + /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + + /* ~}| {zyx wvut srqp onml kjih gfed cba` */ + 0x80000000, /* 1000 0000 0000 0000 0000 0000 0000 0000 */ + + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + }; + + /* " ", "%", %00-%1F */ + + static uint32_t memcached[] = { + 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */ + + /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */ + 0x00000021, /* 0000 0000 0000 0000 0000 0000 0010 0001 */ + + /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + + /* ~}| {zyx wvut srqp onml kjih gfed cba` */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */ + }; + + /* mail_auth is the same as memcached */ + + static uint32_t *map[] = + { uri, args, html, refresh, memcached, memcached }; + + + escape = map[type]; + + if (dst == NULL) { + + /* find the number of the characters to be escaped */ + + n = 0; + + while (size) { + if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + n++; + } + + src++; + size--; + } + + return (uintptr_t) n; + } + + while (size) { + if (escape[*src >> 5] & (1 << (*src & 0x1f))) { + *dst++ = '%'; + *dst++ = hex[*src >> 4]; + *dst++ = hex[*src & 0xf]; + src++; + + } else { + *dst++ = *src++; + } + + size--; + } + + return (uintptr_t) dst; +} + + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.h new file mode 100644 index 0000000..b8564bd --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_escape_uri.h @@ -0,0 +1,10 @@ +#ifndef NGX_HTTP_SET_ESCAPE_URI +#define NGX_HTTP_SET_ESCAPE_URI + + +ngx_int_t +ngx_http_set_misc_escape_uri(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v); + + +#endif /* NGX_HTTP_SET_ESCAPE_URI */ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.c new file mode 100644 index 0000000..59ad606 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.c @@ -0,0 +1,83 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_set_hash.h" + +#if NGX_HAVE_SHA1 +#include "ngx_sha1.h" + +#ifndef SHA_DIGEST_LENGTH +#define SHA_DIGEST_LENGTH 20 +#endif + +#endif + +#include "ngx_md5.h" + + +#ifndef MD5_DIGEST_LENGTH +#define MD5_DIGEST_LENGTH 16 +#endif + +enum { +#if NGX_HAVE_SHA1 + SHA_HEX_LENGTH = SHA_DIGEST_LENGTH * 2, +#endif + MD5_HEX_LENGTH = MD5_DIGEST_LENGTH * 2 +}; + + +#if NGX_HAVE_SHA1 +ngx_int_t +ngx_http_set_misc_set_sha1(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + u_char *p; + ngx_sha1_t sha; + u_char sha_buf[SHA_DIGEST_LENGTH]; + + p = ngx_palloc(r->pool, SHA_HEX_LENGTH); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_sha1_init(&sha); + ngx_sha1_update(&sha, v->data, v->len); + ngx_sha1_final(sha_buf, &sha); + + ngx_hex_dump(p, sha_buf, sizeof(sha_buf)); + + res->data = p; + res->len = SHA_HEX_LENGTH; + + return NGX_OK; +} +#endif + + +ngx_int_t +ngx_http_set_misc_set_md5(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + u_char *p; + ngx_md5_t md5; + u_char md5_buf[MD5_DIGEST_LENGTH]; + + p = ngx_palloc(r->pool, MD5_HEX_LENGTH); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_md5_init(&md5); + ngx_md5_update(&md5, v->data, v->len); + ngx_md5_final(md5_buf, &md5); + + ngx_hex_dump(p, md5_buf, sizeof(md5_buf)); + + res->data = p; + res->len = MD5_HEX_LENGTH; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.h new file mode 100644 index 0000000..db3a558 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hash.h @@ -0,0 +1,15 @@ +#ifndef NGX_HTTP_SET_HASH_H +#define NGX_HTTP_SET_HASH_H + + +#include "ngx_http_set_misc_module.h" + + +ngx_int_t ngx_http_set_misc_set_sha1(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + + +ngx_int_t ngx_http_set_misc_set_md5(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +#endif /* NGX_HTTP_SET_HASH_H */ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.c new file mode 100644 index 0000000..391dd35 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.c @@ -0,0 +1,141 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include "ngx_http_set_hashed_upstream.h" + + +ngx_uint_t +ngx_http_set_misc_apply_distribution(ngx_log_t *log, ngx_uint_t hash, + ndk_upstream_list_t *ul, ngx_http_set_misc_distribution_t type) +{ + switch (type) { + case ngx_http_set_misc_distribution_modula: + return (uint32_t) hash % (uint32_t) ul->nelts; + + default: + ngx_log_error(NGX_LOG_ERR, log, 0, "apply_distribution: " + "unknown distribution: %d", type); + + return 0; + } + + /* impossible to reach here */ +} + + +ngx_int_t +ngx_http_set_misc_set_hashed_upstream(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v, void *data) +{ + ngx_str_t **u; + ndk_upstream_list_t *ul = data; + ngx_str_t ulname; + ngx_uint_t hash, index; + ngx_http_variable_value_t *key; + + if (ul == NULL) { + ulname.data = v->data; + ulname.len = v->len; + + dd("ulname: %.*s", (int) ulname.len, ulname.data); + + ul = ndk_get_upstream_list(ndk_http_get_main_conf(r), + ulname.data, ulname.len); + + if (ul == NULL) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_hashed_upstream: upstream list \"%V\" " + "not defined yet", &ulname); + return NGX_ERROR; + } + + key = v + 1; + + } else { + key = v; + } + + if (ul->nelts == 0) { + res->data = NULL; + res->len = 0; + + return NGX_OK; + } + + u = ul->elts; + + dd("upstream list: %d upstreams found", (int) ul->nelts); + + if (ul->nelts == 1) { + dd("only one upstream found in the list"); + + res->data = u[0]->data; + res->len = u[0]->len; + + return NGX_OK; + } + + dd("key: \"%.*s\"", key->len, key->data); + + hash = ngx_hash_key_lc(key->data, key->len); + + index = ngx_http_set_misc_apply_distribution(r->connection->log, hash, ul, + ngx_http_set_misc_distribution_modula); + + res->data = u[index]->data; + res->len = u[index]->len; + + return NGX_OK; +} + + +char * +ngx_http_set_hashed_upstream(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value; + ndk_set_var_t filter; + ngx_uint_t n; + ngx_str_t *var; + ngx_str_t *ulname; + ndk_upstream_list_t *ul; + ngx_str_t *v; + + value = cf->args->elts; + + var = &value[1]; + ulname = &value[2]; + + n = ngx_http_script_variables_count(ulname); + + filter.func = (void *) ngx_http_set_misc_set_hashed_upstream; + + if (n) { + /* upstream list name contains variables */ + v = &value[2]; + filter.size = 2; + filter.data = NULL; + filter.type = NDK_SET_VAR_MULTI_VALUE_DATA; + + return ndk_set_var_multi_value_core(cf, var, v, &filter); + } + + ul = ndk_get_upstream_list(ndk_http_conf_get_main_conf(cf), + ulname->data, ulname->len); + if (ul == NULL) { + ngx_log_error(NGX_LOG_ERR, cf->log, 0, + "set_hashed_upstream: upstream list \"%V\" " + "not defined yet", ulname); + return NGX_CONF_ERROR; + } + + v = &value[3]; + + filter.size = 1; + filter.data = ul; + filter.type = NDK_SET_VAR_VALUE_DATA; + + return ndk_set_var_value_core(cf, var, v, &filter); +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.h new file mode 100644 index 0000000..8b7caa7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hashed_upstream.h @@ -0,0 +1,27 @@ +#ifndef NGX_HTTP_SET_HASHED_UPSTREAM +#define NGX_HTTP_SET_HASHED_UPSTREAM + + +#include +#include +#include +#include + + +typedef enum { + ngx_http_set_misc_distribution_modula, + ngx_http_set_misc_distribution_random /* XXX not used */ +} ngx_http_set_misc_distribution_t; + + +ngx_uint_t ngx_http_set_misc_apply_distribution(ngx_log_t *log, ngx_uint_t hash, + ndk_upstream_list_t *ul, ngx_http_set_misc_distribution_t type); + +char *ngx_http_set_hashed_upstream(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); + +ngx_int_t ngx_http_set_misc_set_hashed_upstream(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v, void *data); + + +#endif /* NGX_HTTP_SET_HASHED_UPSTREAM */ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.c new file mode 100644 index 0000000..6900650 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.c @@ -0,0 +1,62 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_hex.h" + + +ngx_int_t +ngx_http_set_misc_set_decode_hex(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + u_char *p; + ngx_int_t n; + ngx_uint_t i; + size_t len; + + if (v->len % 2 != 0) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_decode_hex: invalid value"); + return NGX_ERROR; + } + + p = v->data; + len = v->len >> 1; + + res->data = ngx_palloc(r->pool, len); + if (res->data == NULL) { + return NGX_ERROR; + } + + for (i = 0; i < len; i++) { + n = ngx_hextoi(p, 2); + if (n == NGX_ERROR || n > 255) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_decode_hex: invalid value"); + return NGX_ERROR; + } + + p += 2; + res->data[i] = (u_char) n; + } + + res->len = len; + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_misc_set_encode_hex(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + res->len = v->len << 1; + res->data = ngx_palloc(r->pool, res->len); + if (res->data == NULL) { + return NGX_ERROR; + } + + ngx_hex_dump(res->data, v->data, v->len); + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.h new file mode 100644 index 0000000..e8b77e0 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hex.h @@ -0,0 +1,9 @@ +#include +#include +#include + +ngx_int_t ngx_http_set_misc_set_decode_hex(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_set_encode_hex(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.c new file mode 100644 index 0000000..139c0c7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.c @@ -0,0 +1,62 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include + +#include "ngx_http_set_hmac.h" +#include +#include + + +/* this function's implementation is partly borrowed from + * https://github.com/anomalizer/ngx_aws_auth */ +static ngx_int_t +ngx_http_set_misc_set_hmac(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v, const EVP_MD *evp_md) +{ + ngx_http_variable_value_t *secret, *string_to_sign; + unsigned int md_len = 0; + unsigned char md[EVP_MAX_MD_SIZE]; + + secret = v; + string_to_sign = v + 1; + + dd("secret=%.*s, string_to_sign=%.*s", (int) secret->len, secret->data, + (int) string_to_sign->len, string_to_sign->data); + + HMAC(evp_md, secret->data, secret->len, string_to_sign->data, + string_to_sign->len, md, &md_len); + + /* defensive test if there is something wrong with openssl */ + if (md_len == 0 || md_len > EVP_MAX_MD_SIZE) { + res->len = 0; + return NGX_ERROR; + } + + res->len = md_len; + ndk_palloc_re(res->data, r->pool, md_len); + + ngx_memcpy(res->data, + &md, + md_len); + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_misc_set_hmac_sha1(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + return ngx_http_set_misc_set_hmac(r, res, v, EVP_sha1()); +} + + +ngx_int_t +ngx_http_set_misc_set_hmac_sha256(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + return ngx_http_set_misc_set_hmac(r, res, v, EVP_sha256()); +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.h new file mode 100644 index 0000000..fe02ea4 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_hmac.h @@ -0,0 +1,9 @@ +#include +#include +#include + +ngx_int_t ngx_http_set_misc_set_hmac_sha1(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_set_hmac_sha256(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.c new file mode 100644 index 0000000..fa1c703 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.c @@ -0,0 +1,110 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include + + +#ifndef NGX_HTTP_SET_MISC_FMT_DATE_LEN +#define NGX_HTTP_SET_MISC_FMT_DATE_LEN 256 +#endif + + +ngx_int_t +ngx_http_set_local_today(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + time_t now; + ngx_tm_t tm; + u_char *p; + + /*t = ngx_timeofday();*/ + + now = ngx_time(); + + ngx_gmtime(now + ngx_cached_time->gmtoff * 60, &tm); + + dd("tm.ngx_tm_hour:%d", tm.ngx_tm_hour); + + p = ngx_palloc(r->pool, sizeof("yyyy-mm-dd") - 1); + if (p == NULL) { + return NGX_ERROR; + } + + ngx_sprintf(p, "%04d-%02d-%02d", tm.ngx_tm_year, tm.ngx_tm_mon, + tm.ngx_tm_mday); + + res->data = p; + res->len = sizeof("yyyy-mm-dd") - 1; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_formatted_gmt_time(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + time_t now; + u_char *p; + struct tm tm; + + if (v->not_found || v->len == 0) { + res->data = NULL; + res->len = 0; + return NGX_OK; + } + + now = ngx_time(); + ngx_libc_gmtime(now, &tm); + + p = ngx_palloc(r->pool, NGX_HTTP_SET_MISC_FMT_DATE_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + res->len = strftime((char *) p, NGX_HTTP_SET_MISC_FMT_DATE_LEN, + (char *) v->data, &tm); + if (res->len == 0) { + return NGX_ERROR; + } + + res->data = p; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_formatted_local_time(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + time_t now; + u_char *p; + struct tm tm; + + if (v->not_found || v->len == 0) { + res->data = NULL; + res->len = 0; + return NGX_OK; + } + + now = ngx_time(); + ngx_libc_localtime(now, &tm); + + p = ngx_palloc(r->pool, NGX_HTTP_SET_MISC_FMT_DATE_LEN); + if (p == NULL) { + return NGX_ERROR; + } + + res->len = strftime((char *) p, NGX_HTTP_SET_MISC_FMT_DATE_LEN, + (char *) v->data, &tm); + if (res->len == 0) { + return NGX_ERROR; + } + + res->data = p; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.h new file mode 100644 index 0000000..993431e --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_local_today.h @@ -0,0 +1,13 @@ +#include +#include +#include + + +ngx_int_t ngx_http_set_local_today(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_formatted_gmt_time(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_formatted_local_time(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.c new file mode 100644 index 0000000..3b12b0e --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.c @@ -0,0 +1,586 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include "ngx_http_set_misc_module.h" +#include +#include "ngx_http_set_base32.h" +#include "ngx_http_set_default_value.h" +#include "ngx_http_set_hashed_upstream.h" +#include "ngx_http_set_unescape_uri.h" +#include "ngx_http_set_quote_sql.h" +#include "ngx_http_set_quote_json.h" +#include "ngx_http_set_escape_uri.h" +#include "ngx_http_set_local_today.h" +#include "ngx_http_set_hash.h" +#include "ngx_http_set_hex.h" +#include "ngx_http_set_base64.h" +#include "ngx_http_set_base64url.h" +#if NGX_OPENSSL +#include "ngx_http_set_hmac.h" +#endif +#include "ngx_http_set_random.h" +#include "ngx_http_set_secure_random.h" +#include "ngx_http_set_rotate.h" + + +#define NGX_UNESCAPE_URI_COMPONENT 0 +#define BASE32_ALPHABET_LEN 32 + + +static void *ngx_http_set_misc_create_loc_conf(ngx_conf_t *cf); +static char *ngx_http_set_misc_merge_loc_conf(ngx_conf_t *cf, void *parent, + void *child); +static char *ngx_http_set_misc_base32_alphabet(ngx_conf_t *cf, + ngx_command_t *cmd, void *conf); + + +static ngx_conf_deprecated_t ngx_conf_deprecated_set_misc_base32_padding = { + ngx_conf_deprecated, "set_misc_base32_padding", "set_base32_padding" +}; + + +static ndk_set_var_t ngx_http_set_misc_set_encode_base64_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_encode_base64, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_decode_base64_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_decode_base64, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_encode_base64url_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_encode_base64url, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_decode_base64url_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_decode_base64url, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_decode_hex_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_decode_hex, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_encode_hex_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_encode_hex, + 1, + NULL +}; + + +#if NGX_OPENSSL +static ndk_set_var_t ngx_http_set_misc_set_hmac_sha1_filter = { + NDK_SET_VAR_MULTI_VALUE, + (void *) ngx_http_set_misc_set_hmac_sha1, + 2, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_hmac_sha256_filter = { + NDK_SET_VAR_MULTI_VALUE, + (void *) ngx_http_set_misc_set_hmac_sha256, + 2, + NULL +}; +#endif + + +#ifndef NGX_HTTP_SET_HASH +static ndk_set_var_t ngx_http_set_misc_set_md5_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_md5, + 1, + NULL +}; + + +#if NGX_HAVE_SHA1 +static ndk_set_var_t ngx_http_set_misc_set_sha1_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_sha1, + 1, + NULL +}; +#endif +#endif + + +static ndk_set_var_t ngx_http_set_misc_unescape_uri_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_unescape_uri, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_escape_uri_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_escape_uri, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_decode_base32_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_decode_base32, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_quote_sql_str_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_quote_sql_str, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_quote_pgsql_str_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_quote_pgsql_str, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_quote_json_str_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_quote_json_str, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_encode_base32_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_encode_base32, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_local_today_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_local_today, + 0, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_formatted_gmt_time_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_formatted_gmt_time, + 2, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_formatted_local_time_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_formatted_local_time, + 2, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_random_filter = { + NDK_SET_VAR_MULTI_VALUE, + (void *) ngx_http_set_misc_set_random, + 2, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_secure_random_alphanum_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_secure_random_alphanum, + 1, + NULL +}; + + +static ndk_set_var_t ngx_http_set_misc_set_secure_random_lcalpha_filter = { + NDK_SET_VAR_VALUE, + (void *) ngx_http_set_misc_set_secure_random_lcalpha, + 1, + NULL +}; + + +static ngx_command_t ngx_http_set_misc_commands[] = { + { ngx_string ("set_encode_base64"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_encode_base64_filter + }, + { ngx_string ("set_decode_base64"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_decode_base64_filter + }, + { ngx_string ("set_encode_base64url"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_encode_base64url_filter + }, + { ngx_string ("set_decode_base64url"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_decode_base64url_filter + }, + { ngx_string ("set_decode_hex"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_decode_hex_filter + }, + { ngx_string ("set_encode_hex"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_encode_hex_filter + }, +#if NGX_OPENSSL + { ngx_string ("set_hmac_sha1"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3, + ndk_set_var_multi_value, + 0, + 0, + &ngx_http_set_misc_set_hmac_sha1_filter + }, + { ngx_string ("set_hmac_sha256"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3, + ndk_set_var_multi_value, + 0, + 0, + &ngx_http_set_misc_set_hmac_sha256_filter + }, +#endif +#ifndef NGX_HTTP_SET_HASH + { ngx_string ("set_md5"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_md5_filter + }, +#if NGX_HAVE_SHA1 + { + ngx_string ("set_sha1"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_sha1_filter + }, +#endif +#endif + { + ngx_string ("set_unescape_uri"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_unescape_uri_filter + }, + { + ngx_string ("set_escape_uri"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_escape_uri_filter + }, + { + ngx_string ("set_quote_sql_str"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_quote_sql_str_filter + }, + { + ngx_string ("set_quote_pgsql_str"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_quote_pgsql_str_filter + }, + { + ngx_string ("set_quote_json_str"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_quote_json_str_filter + }, + { + ngx_string ("set_if_empty"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2, + ngx_http_set_if_empty, + 0, + 0, + NULL + }, + { + ngx_string("set_hashed_upstream"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3, + ngx_http_set_hashed_upstream, + 0, + 0, + NULL + }, + { + /* this is now deprecated; use set_base32_padding instead */ + ngx_string("set_misc_base32_padding"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_set_misc_loc_conf_t, base32_padding), + &ngx_conf_deprecated_set_misc_base32_padding, + }, + { + ngx_string("set_base32_padding"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_FLAG, + ngx_conf_set_flag_slot, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_set_misc_loc_conf_t, base32_padding), + NULL + }, + { + ngx_string("set_base32_alphabet"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, + ngx_http_set_misc_base32_alphabet, + NGX_HTTP_LOC_CONF_OFFSET, + offsetof(ngx_http_set_misc_loc_conf_t, base32_alphabet), + NULL + }, + { + ngx_string("set_encode_base32"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_encode_base32_filter + }, + { + ngx_string("set_decode_base32"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_decode_base32_filter + }, + { + ngx_string("set_local_today"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE1, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_local_today_filter + }, + { + ngx_string("set_formatted_gmt_time"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_formatted_gmt_time_filter + }, + { + ngx_string("set_formatted_local_time"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE2, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_formatted_local_time_filter + }, + { ngx_string ("set_random"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3, + ndk_set_var_multi_value, + 0, + 0, + &ngx_http_set_misc_set_random_filter + }, + { ngx_string ("set_secure_random_alphanum"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_secure_random_alphanum_filter + }, + { ngx_string ("set_secure_random_lcalpha"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE12, + ndk_set_var_value, + 0, + 0, + &ngx_http_set_misc_set_secure_random_lcalpha_filter + }, + { ngx_string ("set_rotate"), + NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_SIF_CONF + |NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF|NGX_CONF_TAKE3, + ngx_http_set_rotate, + 0, + 0, + NULL + }, + + ngx_null_command +}; + + +static ngx_http_module_t ngx_http_set_misc_module_ctx = { + NULL, /* preconfiguration */ + NULL, /* postconfiguration */ + + NULL, /* create main configuration */ + NULL, /* init main configuration */ + + NULL, /* create server configuration */ + NULL, /* merge server configuration */ + + ngx_http_set_misc_create_loc_conf, /* create location configuration */ + ngx_http_set_misc_merge_loc_conf /* merge location configuration */ +}; + + +ngx_module_t ngx_http_set_misc_module = { + NGX_MODULE_V1, + &ngx_http_set_misc_module_ctx, /* module context */ + ngx_http_set_misc_commands, /* module directives */ + NGX_HTTP_MODULE, /* module type */ + NULL, /* init master */ + NULL, /* init module */ + NULL, /* init process */ + NULL, /* init thread */ + NULL, /* exit thread */ + NULL, /* exit process */ + NULL, /* exit master */ + NGX_MODULE_V1_PADDING +}; + + +void * +ngx_http_set_misc_create_loc_conf(ngx_conf_t *cf) +{ + ngx_http_set_misc_loc_conf_t *conf; + + conf = ngx_palloc(cf->pool, sizeof(ngx_http_set_misc_loc_conf_t)); + if (conf == NULL) { + return NULL; + } + + conf->base32_padding = NGX_CONF_UNSET; + conf->base32_alphabet.data = NULL; + conf->base32_alphabet.len = 0; + conf->current = NGX_CONF_UNSET; + + return conf; +} + + +char * +ngx_http_set_misc_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) +{ + ngx_uint_t i; + + ngx_http_set_misc_loc_conf_t *prev = parent; + ngx_http_set_misc_loc_conf_t *conf = child; + + ngx_conf_merge_value(conf->base32_padding, prev->base32_padding, 1); + + ngx_conf_merge_str_value(conf->base32_alphabet, prev->base32_alphabet, + "0123456789abcdefghijklmnopqrstuv"); + + ngx_conf_merge_value(conf->current, prev->current, NGX_CONF_UNSET); + + for (i = 0; i < BASE32_ALPHABET_LEN; i++) { + conf->basis32[conf->base32_alphabet.data[i]] = (u_char) i; + } + + return NGX_CONF_OK; +} + + +static char * +ngx_http_set_misc_base32_alphabet(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf) +{ + ngx_str_t *value; + + value = cf->args->elts; + + if (value[1].len != BASE32_ALPHABET_LEN) { + ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, + "\"set_base32_alphabet\" directive takes an " + "alphabet of %uz bytes but %d expected", + value[1].len, BASE32_ALPHABET_LEN); + return NGX_CONF_ERROR; + } + + return ngx_conf_set_str_slot(cf, cmd, conf); +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.h new file mode 100644 index 0000000..49b3c9e --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_misc_module.h @@ -0,0 +1,30 @@ +#ifndef NGX_HTTP_SET_MISC_MODULE_H +#define NGX_HTTP_SET_MISC_MODULE_H + + +#include +#include +#include +#include + + +#ifndef NGX_HAVE_SHA1 +# if (nginx_version >= 1011002) +# define NGX_HAVE_SHA1 1 +# endif +#endif + + +typedef struct { + ngx_flag_t base32_padding; + ngx_str_t base32_alphabet; + u_char basis32[256]; + ngx_int_t current; /* for set_rotate */ +} ngx_http_set_misc_loc_conf_t; + + +extern ngx_module_t ngx_http_set_misc_module; + + +#endif /* NGX_HTTP_SET_MISC_MODULE_H */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.c new file mode 100644 index 0000000..4bed13c --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.c @@ -0,0 +1,165 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_quote_json.h" + +ngx_int_t +ngx_http_set_misc_quote_json_str(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + size_t len; + u_char *p; + size_t escape; + + if (v->not_found || v->len == 0) { + res->data = (u_char *) "null"; + res->len = sizeof("null") - 1; + return NGX_OK; + } + + escape = ngx_http_set_misc_escape_json_str(NULL, v->data, v->len); + + len = sizeof("''") - 1 + + v->len + + escape; + + p = ngx_palloc(r->pool, len); + if (p == NULL) { + return NGX_ERROR; + } + + res->data = p; + res->len = len; + + *p++ = '\"'; + + if (escape == 0) { + p = ngx_copy(p, v->data, v->len); + + } else { + p = (u_char *) ngx_http_set_misc_escape_json_str(p, v->data, v->len); + } + + *p++ = '\"'; + + if (p != res->data + res->len) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_quote_sql_str: buffer error"); + return NGX_ERROR; + } + + return NGX_OK; +} + + +uintptr_t +ngx_http_set_misc_escape_json_str(u_char *dst, u_char *src, size_t size) +{ + ngx_uint_t n; + + static u_char hex[] = "0123456789abcdef"; + + if (dst == NULL) { + /* find the number of characters to be escaped */ + + n = 0; + + while (size) { + /* UTF-8 char has high bit of 1 */ + if ((*src & 0x80) == 0) { + switch (*src) { + case '\r': + case '\n': + case '\\': + case '"': + case '\f': + case '\b': + case '\t': + n++; + break; + default: + if (*src < 32) { + n += sizeof("\\u00xx") - 2; + } + + break; + } + } + + src++; + size--; + } + + return (uintptr_t) n; + } + + while (size) { + if ((*src & 0x80) == 0) { + switch (*src) { + case '\r': + *dst++ = '\\'; + *dst++ = 'r'; + break; + + case '\n': + *dst++ = '\\'; + *dst++ = 'n'; + break; + + case '\\': + *dst++ = '\\'; + *dst++ = '\\'; + break; + + case '"': + *dst++ = '\\'; + *dst++ = '"'; + break; + + case '\f': + *dst++ = '\\'; + *dst++ = 'f'; + break; + + case '\b': + *dst++ = '\\'; + *dst++ = 'b'; + break; + + case '\t': + *dst++ = '\\'; + *dst++ = 't'; + break; + + default: + if (*src < 32) { /* control chars */ + *dst++ = '\\'; + *dst++ = 'u'; + *dst++ = '0'; + *dst++ = '0'; + *dst++ = hex[*src >> 4]; + *dst++ = hex[*src & 0x0f]; + + } else { + *dst++ = *src; + } + + break; + } /* switch */ + + src++; + + } else { + *dst++ = *src++; + } + + size--; + } + + return (uintptr_t) dst; +} + + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.h new file mode 100644 index 0000000..1bf55e2 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_json.h @@ -0,0 +1,16 @@ +#ifndef NGX_HTTP_SET_QUOTE_JSON_H +#define NGX_HTTP_SET_QUOTE_JSON_H + + +#include +#include +#include + + +ngx_int_t ngx_http_set_misc_quote_json_str(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); +uintptr_t ngx_http_set_misc_escape_json_str(u_char *dst, u_char *src, + size_t size); + + +#endif /* NGX_HTTP_SET_QUOTE_JSON_H */ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.c new file mode 100644 index 0000000..8d78348 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.c @@ -0,0 +1,382 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_quote_sql.h" + + +static ngx_int_t ngx_http_pg_utf_escape(ngx_http_request_t *r, ngx_str_t *res); +static ngx_int_t ngx_http_pg_utf_islegal(const unsigned char *s, ngx_int_t len); +static ngx_int_t ngx_http_pg_utf_mblen(const unsigned char *s); + + +ngx_int_t +ngx_http_set_misc_quote_pgsql_str(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + u_char *pstr; + ngx_int_t length; + + if (v->not_found || v->len ==0) { + res->data = (u_char *) "''"; + res->len = sizeof("''") - 1; + return NGX_OK; + } + + ngx_http_set_misc_quote_sql_str(r, res, v); + length = res->len; + + pstr = ngx_palloc(r->pool, length + 1); + if (pstr == NULL) { + return NGX_ERROR; + } + + *pstr = 'E'; + memcpy(pstr + 1, res->data, length); + res->data = pstr; + res->len = length + 1; + + if (ngx_http_pg_utf_islegal(res->data, res->len)) { + return NGX_OK; + } + + if (ngx_http_pg_utf_escape(r, res) != NGX_OK) { + return NGX_ERROR; + } + + return NGX_OK; +} + + +static ngx_int_t +ngx_http_pg_utf_mblen(const unsigned char *s) +{ + int len; + + if ((*s & 0x80) == 0) + len = 1; + else if ((*s & 0xe0) == 0xc0) + len = 2; + else if ((*s & 0xf0) == 0xe0) + len = 3; + else if ((*s & 0xf8) == 0xf0) + len = 4; +#ifdef NOT_USED + else if ((*s & 0xfc) == 0xf8) + len = 5; + else if ((*s & 0xfe) == 0xfc) + len = 6; +#endif + else + len = 1; + return len; +} + + +static ngx_int_t +ngx_http_pg_utf_islegal(const unsigned char *s, ngx_int_t len) +{ + ngx_int_t mblen; + ngx_int_t slen; + u_char a; + + slen = len; + + while (slen > 0) { + mblen = ngx_http_pg_utf_mblen(s); + if (slen < mblen) { + return 0; + } + + switch (mblen) { + + case 4: + a = *(s + 3); + if (a < 0x80 || a > 0xBF) { + return 0; + } + + break; + + case 3: + a = *(s + 2); + if (a < 0x80 || a > 0xBF) { + return 0; + } + + break; + + case 2: + a = *(s + 1); + + switch (*s) { + + case 0xE0: + if (a < 0xA0 || a > 0xBF) { + return 0; + } + + break; + + case 0xED: + if (a < 0x80 || a > 0x9F) { + return 0; + } + + break; + + case 0xF0: + if (a < 0x90 || a > 0xBF) { + return 0; + } + + break; + + case 0xF4: + if (a < 0x80 || a > 0x8F) { + return 0; + } + + break; + + default: + if (a < 0x80 || a > 0xBF) { + return 0; + } + + break; + } + + break; + + case 1: + a = *s; + if (a >= 0x80 && a < 0xC2) { + return 0; + } + + if (a > 0xF4) { + return 0; + } + + break; + + default: + return 0; + } + + s += mblen; + slen -= mblen; + } + + return 1; +} + + +static ngx_int_t +ngx_http_pg_utf_escape(ngx_http_request_t *r, ngx_str_t *res) +{ + ngx_str_t *result; + ngx_int_t l, count; + u_char *d, *p, *p1; + + l = res->len; + d = res->data; + result = res; + count = 0; + + while (l-- > 0) { + if (*d & 0x80) { + count += 4; + } + + d++; + count++; + } + + d = res->data; + l = res->len; + + p = ngx_palloc(r->pool, count); + if (p == NULL) { + return NGX_ERROR; + } + + p1 = p; + while (l-- > 0) { + if ((*d & 0x80)) { + *p++ = '\\'; + *p++ = '\\'; + *p++ = (*d >> 6) + '0'; + *p++ = ((*d >> 3) & 07) + '0'; + *p++ = (*d & 07) + '0'; + + } else { + *p++ = *d; + } + + d++; + } + + result->len = count; + result->data = p1; + + return NGX_OK; +} + + +ngx_int_t +ngx_http_set_misc_quote_sql_str(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + size_t len; + u_char *p; + size_t escape; + + if (v->not_found || v->len == 0) { + res->data = (u_char *) "''"; + res->len = sizeof("''") - 1; + return NGX_OK; + } + + escape = ngx_http_set_misc_escape_sql_str(NULL, v->data, v->len); + + len = sizeof("''") - 1 + v->len + escape; + + p = ngx_palloc(r->pool, len); + if (p == NULL) { + return NGX_ERROR; + } + + res->data = p; + res->len = len; + + *p++ = '\''; + + if (escape == 0) { + p = ngx_copy(p, v->data, v->len); + + } else { + p = (u_char *) ngx_http_set_misc_escape_sql_str(p, v->data, v->len); + } + + *p++ = '\''; + + if (p != res->data + res->len) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_quote_sql_str: buffer error"); + return NGX_ERROR; + } + + return NGX_OK; +} + + +uintptr_t +ngx_http_set_misc_escape_sql_str(u_char *dst, u_char *src, size_t size) +{ + ngx_uint_t n; + + if (dst == NULL) { + /* find the number of chars to be escaped */ + n = 0; + while (size) { + /* the highest bit of all the UTF-8 chars + * is always 1 */ + if ((*src & 0x80) == 0) { + switch (*src) { + case '\0': + case '\b': + case '\n': + case '\r': + case '\t': + case '\\': + case '\'': + case '"': + case '$': + case 26: /* \Z */ + n++; + break; + default: + break; + } + } + + src++; + size--; + } + + return (uintptr_t) n; + } + + while (size) { + if ((*src & 0x80) == 0) { + switch (*src) { + case '\0': + *dst++ = '\\'; + *dst++ = '0'; + break; + + case '\b': + *dst++ = '\\'; + *dst++ = 'b'; + break; + + case '\n': + *dst++ = '\\'; + *dst++ = 'n'; + break; + + case '\r': + *dst++ = '\\'; + *dst++ = 'r'; + break; + + case '\t': + *dst++ = '\\'; + *dst++ = 't'; + break; + + case '\\': + *dst++ = '\\'; + *dst++ = '\\'; + break; + + case '\'': + *dst++ = '\\'; + *dst++ = '\''; + break; + + case '"': + *dst++ = '\\'; + *dst++ = '"'; + break; + + case '$': + *dst++ = '\\'; + *dst++ = '$'; + break; + + case 26: + *dst++ = '\\'; + *dst++ = 'Z'; + break; + + default: + *dst++ = *src; + break; + } + + } else { + *dst++ = *src; + } + + src++; + size--; + } /* while (size) */ + + return (uintptr_t) dst; +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.h new file mode 100644 index 0000000..c631dd7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_quote_sql.h @@ -0,0 +1,21 @@ +#ifndef NGX_SET_QUOTE_SQL_H +#define NGX_SET_QUOTE_SQL_H + + +#include +#include +#include + + +uintptr_t ngx_http_set_misc_escape_sql_str(u_char *dst, u_char *src, + size_t size); + +ngx_int_t ngx_http_set_misc_quote_sql_str(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_quote_pgsql_str(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + + +#endif /* NGX_SET_QUOTE_SQL_H */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.c new file mode 100644 index 0000000..c223633 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.c @@ -0,0 +1,57 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include +#include "ngx_http_set_random.h" +#include + + +ngx_int_t +ngx_http_set_misc_set_random(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + ngx_http_variable_value_t *rand_from, *rand_to; + ngx_int_t int_from, int_to, tmp, random; + + rand_from = v; + rand_to = v + 1; + + int_from = ngx_atoi(rand_from->data, rand_from->len); + if (int_from == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_random: bad \"from\" argument: %v", rand_from); + return NGX_ERROR; + } + + int_to = ngx_atoi(rand_to->data, rand_to->len); + if (int_to == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_random: bad \"to\" argument: %v", rand_to); + return NGX_ERROR; + } + + if (int_from > int_to) { + tmp = int_from; + int_from = int_to; + int_to = tmp; + } + + random = rand() % (int_to - int_from + 1) + int_from; + + res->data = ngx_palloc(r->pool, NGX_INT_T_LEN); + if (res->data == NULL) { + return NGX_ERROR; + } + + res->len = ngx_sprintf(res->data, "%i", random) - res->data; + + /* Set all required params */ + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.h new file mode 100644 index 0000000..88cffdc --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_random.h @@ -0,0 +1,12 @@ +#ifndef NGX_SET_RANDOM_H +#define NGX_SET_RANDOM_H + +#include +#include +#include + +ngx_int_t ngx_http_set_misc_set_random(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +#endif /* NGX_SET_RANDOM_H */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.c new file mode 100644 index 0000000..b83dee7 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.c @@ -0,0 +1,113 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_rotate.h" +#include "ngx_http_set_misc_module.h" +#include + + +ngx_int_t +ngx_http_set_misc_set_rotate(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + ngx_http_variable_value_t *rotate_from, *rotate_to, *rotate_num; + ngx_int_t int_from, int_to, tmp, int_current; + + ngx_http_set_misc_loc_conf_t *conf; + + rotate_num = &v[0]; + rotate_from = &v[1]; + rotate_to = &v[2]; + + int_from = ngx_atoi(rotate_from->data, rotate_from->len); + if (int_from == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_rotate: bad \"from\" argument value: \"%v\"", + rotate_from); + return NGX_ERROR; + } + + int_to = ngx_atoi(rotate_to->data, rotate_to->len); + if (int_to == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_rotate: bad \"to\" argument value: \"%v\"", + rotate_to); + return NGX_ERROR; + } + + if (int_from > int_to) { + tmp = int_from; + int_from = int_to; + int_to = tmp; + } + + conf = ngx_http_get_module_loc_conf(r, ngx_http_set_misc_module); + + dd("current value not found: %d", (int) rotate_num->not_found); + + if (rotate_num->len == 0) { + if (conf->current != NGX_CONF_UNSET) { + int_current = conf->current; + + } else { + int_current = int_from - 1; + } + + } else { + + int_current = ngx_atoi(rotate_num->data, rotate_num->len); + if (int_current == NGX_ERROR) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_rotate: bad current value: \"%v\"", rotate_num); + + if (conf->current != NGX_CONF_UNSET) { + int_current = conf->current; + + } else { + int_current = int_from - 1; + } + } + } + + int_current++; + + if (int_current > int_to || int_current < int_from) { + int_current = int_from; + } + + conf->current = int_current; + + res->data = ngx_palloc(r->pool, NGX_INT_T_LEN); + if (res->data == NULL) { + return NGX_ERROR; + } + + res->len = ngx_sprintf(res->data, "%i", int_current) - res->data; + + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} + + +char * +ngx_http_set_rotate(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) +{ + ngx_str_t *value; + ndk_set_var_t filter; + + value = cf->args->elts; + + filter.type = NDK_SET_VAR_MULTI_VALUE; + filter.func = (void *) ngx_http_set_misc_set_rotate; + filter.size = 3; + filter.data = NULL; + + return ndk_set_var_multi_value_core(cf, &value[1], &value[1], &filter); +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.h new file mode 100644 index 0000000..429204c --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_rotate.h @@ -0,0 +1,18 @@ +#ifndef NGX_HTTP_SET_MISC_ROTATE_H +#define NGX_HTTP_SET_MISC_ROTATE_H + + +#include +#include +#include + + +char *ngx_http_set_rotate(ngx_conf_t *cf, ngx_command_t *cmd, + void *conf); + +ngx_int_t ngx_http_set_misc_set_rotate(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + + +#endif /* NGX_HTTP_SET_MISC_ROTATE_H */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.c new file mode 100644 index 0000000..a07efe8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.c @@ -0,0 +1,104 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + + +#include +#include "ngx_http_set_secure_random.h" +#include + + +enum { + MAX_RANDOM_STRING = 64, + ALPHANUM = 1, + LCALPHA = 2 +}; + + +static ngx_int_t +ngx_http_set_misc_set_secure_random_common(int alphabet_type, + ngx_http_request_t *r, ngx_str_t *res, ngx_http_variable_value_t *v); + + +ngx_int_t +ngx_http_set_misc_set_secure_random_alphanum(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v) +{ + return ngx_http_set_misc_set_secure_random_common(ALPHANUM, r, res, v); +} + + +ngx_int_t +ngx_http_set_misc_set_secure_random_lcalpha(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v) +{ + return ngx_http_set_misc_set_secure_random_common(LCALPHA, r, res, v); +} + + +static ngx_int_t +ngx_http_set_misc_set_secure_random_common(int alphabet_type, + ngx_http_request_t *r, ngx_str_t *res, ngx_http_variable_value_t *v) +{ + static u_char alphabet[] = "abcdefghijklmnopqrstuvwxyz" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; + + u_char entropy[MAX_RANDOM_STRING]; + u_char output[MAX_RANDOM_STRING]; + ngx_int_t length, i; + ngx_fd_t fd; + ssize_t n; + + length = ngx_atoi(v->data, v->len); + + if (length == NGX_ERROR || length < 1 || length > MAX_RANDOM_STRING) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_random: bad \"length\" argument: %v", v); + return NGX_ERROR; + } + + fd = ngx_open_file((u_char *) "/dev/urandom", NGX_FILE_RDONLY, + NGX_FILE_OPEN, 0); + if (fd == NGX_INVALID_FILE) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_secure_random: could not open /dev/urandom"); + return NGX_ERROR; + } + + n = ngx_read_fd(fd, entropy, length); + if (n != length) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_secure_random: could not read all %i byte(s) from " + "/dev/urandom", length); + ngx_close_file(fd); + return NGX_ERROR; + } + + ngx_close_file(fd); + + for (i = 0; i < length; i++) { + if (alphabet_type == LCALPHA) { + output[i] = entropy[i] % 26 + 'a'; + + } else { + output[i] = alphabet[ entropy[i] % (sizeof alphabet - 1) ]; + } + } + + res->data = ngx_palloc(r->pool, length); + if (res->data == NULL) { + return NGX_ERROR; + } + + ngx_memcpy(res->data, output, length); + + res->len = length; + + /* set all required params */ + v->valid = 1; + v->no_cacheable = 0; + v->not_found = 0; + + return NGX_OK; +} diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.h new file mode 100644 index 0000000..d65129e --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_secure_random.h @@ -0,0 +1,15 @@ +#ifndef NGX_SET_SECURE_RANDOM_H +#define NGX_SET_SECURE_RANDOM_H + +#include +#include +#include + +ngx_int_t ngx_http_set_misc_set_secure_random_alphanum(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +ngx_int_t ngx_http_set_misc_set_secure_random_lcalpha(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + +#endif /* NGX_SET_SECURE_RANDOM_H */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.c b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.c new file mode 100644 index 0000000..3ae1d0a --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.c @@ -0,0 +1,184 @@ +#ifndef DDEBUG +#define DDEBUG 0 +#endif +#include "ddebug.h" + +#include +#include "ngx_http_set_unescape_uri.h" + +#define NGX_UNESCAPE_URI_COMPONENT 0 + + +static void ngx_unescape_uri_patched(u_char **dst, u_char **src, size_t size, + ngx_uint_t type); + + +ngx_int_t +ngx_http_set_misc_unescape_uri(ngx_http_request_t *r, ngx_str_t *res, + ngx_http_variable_value_t *v) +{ + size_t len; + u_char *p; + u_char *src, *dst; + + /* the unescaped string can only be smaller */ + len = v->len; + + p = ngx_palloc(r->pool, len); + if (p == NULL) { + return NGX_ERROR; + } + + src = v->data; dst = p; + + ngx_unescape_uri_patched(&dst, &src, v->len, NGX_UNESCAPE_URI_COMPONENT); + + if (src != v->data + v->len) { + ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, + "set_unescape_uri: input data not consumed completely"); + return NGX_ERROR; + } + + res->data = p; + res->len = dst - p; + + return NGX_OK; +} + + +/* XXX we also decode '+' to ' ' */ +static void +ngx_unescape_uri_patched(u_char **dst, u_char **src, size_t size, + ngx_uint_t type) +{ + u_char *d, *s, ch, c, decoded; + enum { + sw_usual = 0, + sw_quoted, + sw_quoted_second + } state; + + d = *dst; + s = *src; + + state = 0; + decoded = 0; + + while (size--) { + + ch = *s++; + + switch (state) { + case sw_usual: + if (ch == '?' + && (type & (NGX_UNESCAPE_URI|NGX_UNESCAPE_REDIRECT))) + { + *d++ = ch; + goto done; + } + + if (ch == '%') { + state = sw_quoted; + break; + } + + if (ch == '+') { + *d++ = ' '; + break; + } + + *d++ = ch; + break; + + case sw_quoted: + + if (ch >= '0' && ch <= '9') { + decoded = (u_char) (ch - '0'); + state = sw_quoted_second; + break; + } + + c = (u_char) (ch | 0x20); + if (c >= 'a' && c <= 'f') { + decoded = (u_char) (c - 'a' + 10); + state = sw_quoted_second; + break; + } + + /* the invalid quoted character */ + + state = sw_usual; + + *d++ = ch; + + break; + + case sw_quoted_second: + + state = sw_usual; + + if (ch >= '0' && ch <= '9') { + ch = (u_char) ((decoded << 4) + ch - '0'); + + if (type & NGX_UNESCAPE_REDIRECT) { + if (ch > '%' && ch < 0x7f) { + *d++ = ch; + break; + } + + *d++ = '%'; *d++ = *(s - 2); *d++ = *(s - 1); + + break; + } + + *d++ = ch; + + break; + } + + c = (u_char) (ch | 0x20); + if (c >= 'a' && c <= 'f') { + ch = (u_char) ((decoded << 4) + c - 'a' + 10); + + if (type & NGX_UNESCAPE_URI) { + if (ch == '?') { + *d++ = ch; + goto done; + } + + *d++ = ch; + break; + } + + if (type & NGX_UNESCAPE_REDIRECT) { + if (ch == '?') { + *d++ = ch; + goto done; + } + + if (ch > '%' && ch < 0x7f) { + *d++ = ch; + break; + } + + *d++ = '%'; *d++ = *(s - 2); *d++ = *(s - 1); + break; + } + + *d++ = ch; + + break; + } + + /* the invalid quoted character */ + + break; + } + } + +done: + + *dst = d; + *src = s; +} + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.h b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.h new file mode 100644 index 0000000..59e9a93 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/src/ngx_http_set_unescape_uri.h @@ -0,0 +1,16 @@ + +#ifndef NGX_HTTP_SET_UNESCAPE_URI +#define NGX_HTTP_SET_UNESCAPE_URI + + +#include +#include +#include + + +ngx_int_t ngx_http_set_misc_unescape_uri(ngx_http_request_t *r, + ngx_str_t *res, ngx_http_variable_value_t *v); + + +#endif /* NGX_HTTP_SET_UNESCAPE_URI */ + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/base32.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base32.t new file mode 100644 index 0000000..2efa731 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base32.t @@ -0,0 +1,556 @@ +# vi:filetype= + +use Test::Nginx::Socket; + +repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: base32 (5 bytes) +--- config + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +c5h66p35 +abcde + + + +=== TEST 2: base32 (1 byte) +--- config + location /bar { + set $a '!'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +44====== +! + + + +=== TEST 3: base32 (1 byte) - not in-place editing +--- config + location /bar { + set $a '!'; + set_encode_base32 $a $a; + set_decode_base32 $b $a; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +44====== +! + + + +=== TEST 4: base32 (hello world) +--- config + location /bar { + set $a '"hello, world!\nhiya"'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m6888ad1knio92 +"hello, world! +hiya" + + + +=== TEST 5: base32 (0 bytes left) +--- config + set_base32_padding on; + location /bar { + set $a '"hello, world!"'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892 + + + +=== TEST 6: base32 (6 bytes padded) +--- config + set_base32_padding on; + location /bar { + set $a '"hello, world!"a'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c4====== + + + +=== TEST 7: base32 (4 bytes left) +--- config + set_base32_padding on; + location /bar { + set $a '"hello, world!"ab'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c5h0==== + + + +=== TEST 8: base32 (3 bytes left) +--- config + set_base32_padding on; + location /bar { + set $a '"hello, world!"abc'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c5h66=== + + + +=== TEST 9: base32 (1 bytes left) +--- config + set_base32_padding on; + location /bar { + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c5h66p0= + + + +=== TEST 10: base32 standard alphabet (5 bytes) +--- config + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +MFRGGZDF +abcde + + + +=== TEST 11: base32 standard alphabet (1 byte) +--- config + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '!'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +EE====== +! + + + +=== TEST 12: base32 standard alphabet (1 byte) - not in-place editing +--- config + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '!'; + set_encode_base32 $a $a; + set_decode_base32 $b $a; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +EE====== +! + + + +=== TEST 13: base32 standard alphabet (hello world) +--- config + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!\nhiya"'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIIKNBUXSYJC +"hello, world! +hiya" + + + +=== TEST 14: base32 standard alphabet (0 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJC + + + +=== TEST 15: base32 standard alphabet (6 bytes padded) +--- config + set_base32_padding on; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"a'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCME====== + + + +=== TEST 16: base32 standard alphabet (4 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"ab'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCMFRA==== + + + +=== TEST 17: base32 standard alphabet (3 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"abc'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCMFRGG=== + + + +=== TEST 18: base32 standard alphabet (1 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCMFRGGZA= + + + +=== TEST 19: base32 custom alphabet (5 bytes) +--- config + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +qjvkk3hj +abcde + + + +=== TEST 20: base32 custom alphabet (1 byte) +--- config + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '!'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +ii====== +! + + + +=== TEST 21: base32 custom alphabet (1 byte) - not in-place editing +--- config + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '!'; + set_encode_base32 $a $a; + set_decode_base32 $b $a; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +ii====== +! + + + +=== TEST 22: base32 custom alphabet (hello world) +--- config + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '"hello, world!\nhiya"'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmmorfy1w2ng +"hello, world! +hiya" + + + +=== TEST 23: base32 custom alphabet (0 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '"hello, world!"'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmng + + + +=== TEST 24: base32 custom alphabet (6 bytes padded) +--- config + set_base32_padding on; + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '"hello, world!"a'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqi====== + + + +=== TEST 25: base32 custom alphabet (4 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '"hello, world!"ab'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqjve==== + + + +=== TEST 26: base32 custom alphabet (3 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '"hello, world!"abc'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqjvkk=== + + + +=== TEST 27: base32 custom alphabet (1 bytes left) +--- config + set_base32_padding on; + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + location /bar { + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqjvkk3e= + + + +=== TEST 28: use set_base32_alphabet in location +--- config + set_base32_padding on; + location /bar { + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789"; + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqjvkk3e= + + + +=== TEST 29: one byte less in set_base32_alphabet +--- config + set_base32_padding on; + location /bar { + set_base32_alphabet "efghijklmnopqrstuvwxyz012345678"; + set $a '"hello, world!"abcd?\/.;'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqjvkk3e= +--- must_die +--- error_log eval +qr/\[emerg\] .*? "set_base32_alphabet" directive takes an alphabet of 31 bytes but 32 expected/ + + + +=== TEST 30: one byte more in set_base32_alphabet +--- config + set_base32_padding on; + location /bar { + set_base32_alphabet "efghijklmnopqrstuvwxyz0123456789A"; + set $a '"hello, world!"abcd?\/.;'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +inyko5hqr60ge75tsn0kmmngqjvkk3e= +--- must_die +--- error_log eval +qr/\[emerg\] .*? "set_base32_alphabet" directive takes an alphabet of 33 bytes but 32 expected/ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/base32_no_padding.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base32_no_padding.t new file mode 100644 index 0000000..9330cbf --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base32_no_padding.t @@ -0,0 +1,531 @@ +# vi:filetype= + +use Test::Nginx::Socket; + +repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: base32 (5 bytes) +--- config + set_base32_padding off; + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +c5h66p35 +abcde + + + +=== TEST 2: base32 (1 byte) +--- config + set_base32_padding off; + location /bar { + set $a '!'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +44 +! + + + +=== TEST 3: base32 (1 byte) - not in-place editing +--- config + location /bar { + set_base32_padding off; + set $a '!'; + set_encode_base32 $a $a; + set_decode_base32 $b $a; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +44 +! + + + +=== TEST 4: base32 (hello world) +--- config + set_base32_padding off; + location /bar { + set $a '"hello, world!\nhiya"'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m6888ad1knio92 +"hello, world! +hiya" + + + +=== TEST 5: base32 (0 bytes left) +--- config + set_base32_padding off; + location /bar { + set $a '"hello, world!"'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892 + + + +=== TEST 6: base32 (6 bytes padded) +--- config + set_base32_padding off; + location /bar { + set $a '"hello, world!"a'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c4 + + + +=== TEST 7: base32 (4 bytes left) +--- config + set_base32_padding off; + location /bar { + set $a '"hello, world!"ab'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c5h0 + + + +=== TEST 8: base32 (3 bytes left) +--- config + set_base32_padding off; + location /bar { + set $a '"hello, world!"abc'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c5h66 + + + +=== TEST 9: base32 (1 bytes left) +--- config + set_base32_padding off; + location /bar { + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +49k6ar3cdsm20trfe9m68892c5h66p0 + + + +=== TEST 10: base32 standard alphabet (5 bytes) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +MFRGGZDF +abcde + + + +=== TEST 11: base32 standard alphabet (1 byte) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '!'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +EE +! + + + +=== TEST 12: base32 standard alphabet (1 byte) - not in-place editing +--- config + location /bar { + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + set $a '!'; + set_encode_base32 $a $a; + set_decode_base32 $b $a; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +EE +! + + + +=== TEST 13: base32 standard alphabet (hello world) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!\nhiya"'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIIKNBUXSYJC +"hello, world! +hiya" + + + +=== TEST 14: base32 standard alphabet (0 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJC + + + +=== TEST 15: base32 standard alphabet (6 bytes padded) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"a'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCME + + + +=== TEST 16: base32 standard alphabet (4 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"ab'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCMFRA + + + +=== TEST 17: base32 standard alphabet (3 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"abc'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCMFRGG + + + +=== TEST 18: base32 standard alphabet (1 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"; + location /bar { + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +EJUGK3DMN4WCA53POJWGIIJCMFRGGZA + + + +=== TEST 19: base32 custom alphabet (5 bytes) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +ohtii2fh +abcde + + + +=== TEST 20: base32 custom alphabet (1 byte) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '!'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +gg +! + + + +=== TEST 21: base32 custom alphabet (1 byte) - not in-place editing +--- config + location /bar { + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + set $a '!'; + set_encode_base32 $a $a; + set_decode_base32 $b $a; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +gg +! + + + +=== TEST 22: base32 custom alphabet (hello world) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '"hello, world!\nhiya"'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +glwim4fop5yec64rqlyikkkmpdwzu1le +"hello, world! +hiya" + + + +=== TEST 23: base32 custom alphabet (0 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '"hello, world!"'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +glwim4fop5yec64rqlyikkle + + + +=== TEST 24: base32 custom alphabet (6 bytes padded) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '"hello, world!"a'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +glwim4fop5yec64rqlyikkleog + + + +=== TEST 25: base32 custom alphabet (4 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '"hello, world!"ab'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +glwim4fop5yec64rqlyikkleohtc + + + +=== TEST 26: base32 custom alphabet (3 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '"hello, world!"abc'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +glwim4fop5yec64rqlyikkleohtii + + + +=== TEST 27: base32 custom alphabet (1 bytes left) +--- config + set_base32_padding off; + set_base32_alphabet "cdefghijklmnopqrstuvwxyz12345678"; + location /bar { + set $a '"hello, world!"abcd'; + set_encode_base32 $a; + + echo $a; + } +--- request + GET /bar +--- response_body +glwim4fop5yec64rqlyikkleohtii2c + + + +=== TEST 28: deprecated set_misc_base32_padding +--- config + set_misc_base32_padding off; + location /bar { + set $a 'abcde'; + set_encode_base32 $a; + set $b $a; + set_decode_base32 $b; + + echo $a; + echo $b; + } +--- request + GET /bar +--- response_body +c5h66p35 +abcde diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/base64.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base64.t new file mode 100644 index 0000000..5dd5af8 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base64.t @@ -0,0 +1,40 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: base64 encode +--- config + location /bar { + set_encode_base64 $out "abcde"; + echo $out; + } +--- request + GET /bar +--- response_body +YWJjZGU= + + + +=== TEST 2: base64 decode +--- config + location /bar { + set_decode_base64 $out "YWJjZGU="; + echo $out; + } +--- request + GET /bar +--- response_body +abcde diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/base64url.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base64url.t new file mode 100644 index 0000000..fc71d59 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/base64url.t @@ -0,0 +1,40 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: base64url encode +--- config + location /bar { + set_encode_base64url $out "?b> repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: set if empty +--- config + location /foo { + set $a 32; + set_if_empty $a 56; + echo $a; + + set_if_empty $b 72; + echo $b; + } +--- request +GET /foo +--- response_body +32 +72 + + + +=== TEST 2: set if empty +--- config + location /foo { + set $bar $arg_bar; + set_if_empty $bar 15; + echo $bar; + + set $bah $arg_bah; + set_if_empty $bah 25; + echo $bah; + } +--- request +GET /foo?bar=71 +--- response_body +71 +25 + + + +=== TEST 3: set if empty +--- config + location /foo { + set $bar $arg_bar; + set_if_empty $bar 15; + echo $bar; + + set $bah $arg_bah; + set_if_empty $bah 25; + echo $bah; + } +--- request +GET /foo?bar= +--- response_body +15 +25 + + + +=== TEST 4: set if empty (using arg_xxx directly) +buggy? +--- config + location /foo { + set_if_empty $arg_bar 15; + echo $arg_bar; + + set_if_empty $arg_bah 25; + echo $arg_bah; + } +--- request +GET /foo?bar=71 +--- response_body +71 +25 diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/escape-uri.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/escape-uri.t new file mode 100644 index 0000000..7cbd067 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/escape-uri.t @@ -0,0 +1,139 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); +#no_diff(); + +run_tests(); + +__DATA__ + +=== TEST 1: set escape uri +--- config + location /foo { + set $foo "hello world"; + set_escape_uri $foo $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +hello%20world + + + +=== TEST 2: set escape uri(in-place) +--- config + location /foo { + set $foo "hello world"; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +hello%20world + + + +=== TEST 3: blank string +--- config + location /foo { + set $foo ""; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body eval +"\n" + + + +=== TEST 4: blank string(in place) +--- config + location /foo { + set $foo ""; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body eval +"\n" + + + +=== TEST 5: eacape chinese character +--- config + location /foo { + set $foo "你好"; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +%E4%BD%A0%E5%A5%BD + + + +=== TEST 6: escape long string +--- config + location /foo { + set $foo "法规及饿哦物权法家哦低价非结果哦我二期界 附件饿哦武器 积分饿哦为契机佛i 该软件哦气氛 份额叫我起 国无二君哦气氛为界非ieowq结果哦而完全附件 份额叫我iqfjeowiqgjeriowqfjpdjfosadijfoiasdjf 附件饿哦武器界 份额叫我起界份额叫我起哦ifjefejwioq附件饿哦武器界非风格及去哦根据份额叫我起哦界份额为契机哦乳房阿基完全哦igqtewqo个人就去哦ieorjwrewqoi日哦额外起今天诶哦我亲热为特务前日哦我而哥特完全哦iijrtewmkdf 服务鄂潜江哦irewq"; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +%E6%B3%95%E8%A7%84%E5%8F%8A%E9%A5%BF%E5%93%A6%E7%89%A9%E6%9D%83%E6%B3%95%E5%AE%B6%E5%93%A6%E4%BD%8E%E4%BB%B7%E9%9D%9E%E7%BB%93%E6%9E%9C%E5%93%A6%E6%88%91%E4%BA%8C%E6%9C%9F%E7%95%8C%20%20%E9%99%84%E4%BB%B6%E9%A5%BF%E5%93%A6%E6%AD%A6%E5%99%A8%20%20%E7%A7%AF%E5%88%86%E9%A5%BF%E5%93%A6%E4%B8%BA%E5%A5%91%E6%9C%BA%E4%BD%9Bi%20%E8%AF%A5%E8%BD%AF%E4%BB%B6%E5%93%A6%E6%B0%94%E6%B0%9B%20%20%E4%BB%BD%E9%A2%9D%E5%8F%AB%E6%88%91%E8%B5%B7%20%E5%9B%BD%E6%97%A0%E4%BA%8C%E5%90%9B%E5%93%A6%E6%B0%94%E6%B0%9B%E4%B8%BA%E7%95%8C%E9%9D%9Eieowq%E7%BB%93%E6%9E%9C%E5%93%A6%E8%80%8C%E5%AE%8C%E5%85%A8%E9%99%84%E4%BB%B6%20%20%E4%BB%BD%E9%A2%9D%E5%8F%AB%E6%88%91iqfjeowiqgjeriowqfjpdjfosadijfoiasdjf%20%E9%99%84%E4%BB%B6%E9%A5%BF%E5%93%A6%E6%AD%A6%E5%99%A8%E7%95%8C%20%E4%BB%BD%E9%A2%9D%E5%8F%AB%E6%88%91%E8%B5%B7%E7%95%8C%E4%BB%BD%E9%A2%9D%E5%8F%AB%E6%88%91%E8%B5%B7%E5%93%A6ifjefejwioq%E9%99%84%E4%BB%B6%E9%A5%BF%E5%93%A6%E6%AD%A6%E5%99%A8%E7%95%8C%E9%9D%9E%E9%A3%8E%E6%A0%BC%E5%8F%8A%E5%8E%BB%E5%93%A6%E6%A0%B9%E6%8D%AE%E4%BB%BD%E9%A2%9D%E5%8F%AB%E6%88%91%E8%B5%B7%E5%93%A6%E7%95%8C%E4%BB%BD%E9%A2%9D%E4%B8%BA%E5%A5%91%E6%9C%BA%E5%93%A6%E4%B9%B3%E6%88%BF%E9%98%BF%E5%9F%BA%E5%AE%8C%E5%85%A8%E5%93%A6igqtewqo%E4%B8%AA%E4%BA%BA%E5%B0%B1%E5%8E%BB%E5%93%A6ieorjwrewqoi%E6%97%A5%E5%93%A6%E9%A2%9D%E5%A4%96%E8%B5%B7%E4%BB%8A%E5%A4%A9%E8%AF%B6%E5%93%A6%E6%88%91%E4%BA%B2%E7%83%AD%E4%B8%BA%E7%89%B9%E5%8A%A1%E5%89%8D%E6%97%A5%E5%93%A6%E6%88%91%E8%80%8C%E5%93%A5%E7%89%B9%E5%AE%8C%E5%85%A8%E5%93%A6iijrtewmkdf%20%E6%9C%8D%E5%8A%A1%E9%84%82%E6%BD%9C%E6%B1%9F%E5%93%A6irewq + + + +=== TEST 7: no need to escape +--- config + location /foo { + set $foo 'welcometotheworldofnginx'; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +welcometotheworldofnginx + + + +=== TEST 8: fixed ngx_escape_uri issues: + and / should also be escaped +--- config + location /foo { + set $foo '+/='; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +%2B%2F%3D + + + +=== TEST 9: fixed ngx_escape_uri issues: / {} : & [] and more +--- config + location /foo { + set $foo '"a/b={}:<>;&[]\\^'; + set_escape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +%22a%2Fb%3D%7B%7D%3A%3C%3E%3B%26%5B%5D%5C%5E diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/formatted-time.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/formatted-time.t new file mode 100644 index 0000000..9b0fc73 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/formatted-time.t @@ -0,0 +1,84 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; +use POSIX qw(strftime); + +my $fmt="%a %b %e %H:%M:%S %Y"; + +our $str_local = (strftime $fmt, localtime time()).'|'.(strftime $fmt, localtime time()+1).'|'.(strftime $fmt, localtime time()+2); + +our $str_gmt = (strftime $fmt, gmtime time()).'|'.(strftime $fmt, gmtime time()+1).'|'.(strftime $fmt, gmtime time()+2); + +repeat_each(2); + +plan tests => repeat_each() * 2 * blocks(); + +log_level('warn'); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: local time format +--- config + location /foo { + set_formatted_local_time $today "%a %b %e %H:%M:%S %Y"; + echo $today; + } +--- request +GET /foo +--- response_body_like eval: $main::str_local + + + +=== TEST 2: GMT time format +--- config + location /bar { + set_formatted_gmt_time $today "%a %b %e %H:%M:%S %Y"; + echo $today; + } +--- request +GET /bar +--- response_body_like eval: $main::str_gmt + + + +=== TEST 3: set_formatted_gmt_time (empty formatter) +--- config + location /bar { + set_formatted_gmt_time $today ""; + echo "[$today]"; + } +--- request +GET /bar +--- response_body +[] + + + +=== TEST 4: set_formatted_local_time (empty formatter) +--- config + location /bar { + set_formatted_local_time $today ""; + echo "[$today]"; + } +--- request +GET /bar +--- response_body +[] + + + +=== TEST 5: set_formatted_local_time (constant formatter) +--- config + location /bar { + set_formatted_local_time $today "hello world"; + echo "[$today]"; + } +--- request +GET /bar +--- response_body +[hello world] diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/hash.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hash.t new file mode 100644 index 0000000..a9c884b --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hash.t @@ -0,0 +1,94 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: sha1 hello (copy) +--- config + location /sha1 { + set_sha1 $a hello; + echo $a; + } +--- request +GET /sha1 +--- response_body +aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d + + + +=== TEST 2: sha1 hello (in-place) +--- config + location /sha1 { + set $a hello; + set_sha1 $a; + echo $a; + } +--- request +GET /sha1 +--- response_body +aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d + + + +=== TEST 3: sha1 (empty) +--- config + location /sha1 { + set_sha1 $a ""; + echo $a; + } +--- request +GET /sha1 +--- response_body +da39a3ee5e6b4b0d3255bfef95601890afd80709 + + + +=== TEST 4: md5 hello (copy) +--- config + location /md5 { + set_md5 $a hello; + echo $a; + } +--- request +GET /md5 +--- response_body +5d41402abc4b2a76b9719d911017c592 + + + +=== TEST 5: md5 hello (in-place) +--- config + location /md5 { + set $a hello; + set_md5 $a; + echo $a; + } +--- request +GET /md5 +--- response_body +5d41402abc4b2a76b9719d911017c592 + + + +=== TEST 6: md5 (empty) +--- config + location /md5 { + set_md5 $a ""; + echo $a; + } +--- request +GET /md5 +--- response_body +d41d8cd98f00b204e9800998ecf8427e diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/hashed-upstream.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hashed-upstream.t new file mode 100644 index 0000000..fdebd15 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hashed-upstream.t @@ -0,0 +1,70 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +#master_on(); +#log_level("warn"); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: set hashed upstream +buggy? +--- config + upstream_list universe moon sun earth; + location /foo { + set_hashed_upstream $backend universe $arg_id; + echo $backend; + } + location /main { + echo_location_async /foo; + echo_location_async /foo?id=hello; + echo_location_async /foo?id=world; + echo_location_async /foo?id=larry; + echo_location_async /foo?id=audreyt; + } +--- request +GET /main +--- response_body +moon +sun +moon +earth +earth + + + +=== TEST 2: set hashed upstream (use var for upstream_list name) +buggy? +--- config + upstream_list universe moon sun earth; + location /foo { + set $list_name universe; + set_hashed_upstream $backend $list_name $arg_id; + echo $backend; + } + location /main { + echo_location_async /foo; + echo_location_async /foo?id=hello; + echo_location_async /foo?id=world; + echo_location_async /foo?id=larry; + echo_location_async /foo?id=audreyt; + } +--- request +GET /main +--- response_body +moon +sun +moon +earth +earth diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/hex.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hex.t new file mode 100644 index 0000000..ae28105 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hex.t @@ -0,0 +1,57 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: hex encode +--- config + location /bar { + set_encode_hex $out "abcde"; + echo $out; + } +--- request + GET /bar +--- response_body +6162636465 + + + +=== TEST 2: hex decode +--- config + location /bar { + set_decode_hex $out "6162636465"; + echo $out; + } +--- request + GET /bar +--- response_body +abcde + + + +=== TEST 3: hex encode (chinese) +--- config + location /bar { + set $raw "章亦春"; + set_encode_hex $digest $raw; + set_decode_hex $hex $digest; + echo $digest; + echo $hex; + } +--- request + GET /bar +--- response_body +e7aba0e4baa6e698a5 +章亦春 diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/hmac.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hmac.t new file mode 100644 index 0000000..5353eca --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/hmac.t @@ -0,0 +1,78 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: hmac_sha1 +--- config + location /bar { + set $secret 'thisisverysecretstuff'; + set $string_to_sign 'some string we want to sign'; + set_hmac_sha1 $signature $secret $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } +--- request + GET /bar +--- response_body +R/pvxzHC4NLtj7S+kXFg/NePTmk= + + + +=== TEST 2: hmac_sha1 empty vars +--- config + location /bar { + set $secret ''; + set $string_to_sign ''; + set_hmac_sha1 $signature $secret $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } +--- request + GET /bar +--- response_body ++9sdGxiqbAgyS31ktx+3Y3BpDh0= + + + +=== TEST 3: hmac_sha256 +--- config + location /bar { + set $secret 'thisisverysecretstuff'; + set $string_to_sign 'some string we want to sign'; + set_hmac_sha256 $signature $secret $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } +--- request + GET /bar +--- response_body +4pU3GRQrKKIoeLb9CqYsavHE2l6Hx+KMmRmesU+Cfrs= + + + +=== TEST 4: hmac_sha256 empty vars +--- config + location /bar { + set $secret ''; + set $string_to_sign ''; + set_hmac_sha256 $signature $secret $string_to_sign; + set_encode_base64 $signature $signature; + echo $signature; + } +--- request + GET /bar +--- response_body +thNnmggU2ex3L5XXeMNfxf8Wl8STcVZTxscSFEKSxa0= diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/local-today.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/local-today.t new file mode 100644 index 0000000..7de0968 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/local-today.t @@ -0,0 +1,29 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +my ($sec, $min, $hour, $mday, $mon, $year) = localtime; + +our $str = sprintf("%04d-%02d-%02d\n", $year + 1900, $mon + 1, $mday); +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +#no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /foo { + set_local_today $today; + echo $today; + } +--- request +GET /foo +--- response_body eval: $main::str diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-json.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-json.t new file mode 100644 index 0000000..8e15def --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-json.t @@ -0,0 +1,69 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: set quote json value +--- config + location /foo { + set $foo "hello\n\r'\"\\"; + set_quote_json_str $foo $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +"hello\n\r'\"\\" + + + +=== TEST 2: set quote json value (in place) +--- config + location /foo { + set $foo "hello\n\r'\"\\"; + set_quote_json_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +"hello\n\r'\"\\" + + + +=== TEST 3: set quote empty json value +--- config + location /foo { + set $foo ""; + set_quote_json_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +null + + + +=== TEST 4: set quote null json value +--- config + location /foo { + set_quote_json_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +null diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-sql.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-sql.t new file mode 100644 index 0000000..bd81a87 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/quote-sql.t @@ -0,0 +1,195 @@ +# vi:filetype= + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: set quote sql value +--- config + location /foo { + set $foo "hello\n\r'\"\\"; + set_quote_sql_str $foo $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +'hello\n\r\'\"\\' + + + +=== TEST 2: set quote sql value (in place) +--- config + location /foo { + set $foo "hello\n\r'\"\\"; + set_quote_sql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +'hello\n\r\'\"\\' + + + +=== TEST 3: set quote empty sql value +--- config + location /foo { + set $foo ""; + set_quote_sql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +'' + + + +=== TEST 4: set quote null sql value +--- config + location /foo { + set_quote_sql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +'' + + + +=== TEST 5: set quote null pgsql value +--- config + location /foo { + set_quote_pgsql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +'' + + + +=== TEST 6: set quote pgsql value +--- config + location /foo { + set $foo "hello\n\r'\"\\"; + set_quote_pgsql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +E'hello\n\r\'\"\\' + + + +=== TEST 7: set quote pgsql valid utf8 value +--- config + location /foo { + set $foo "你好"; + set_quote_pgsql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +E'你好' + + + +=== TEST 8: set quote pgsql invalid utf8 value +--- config + location /foo { + set $foo "你好"; + set_iconv $foo $foo from=utf-8 to=gbk; + set_quote_pgsql_str $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +E'\\304\\343\\272\\303' + + + +=== TEST 9: \0 for mysql +--- config + location /foo { + set_unescape_uri $foo $arg_a; + set_quote_sql_str $foo $foo; + echo $foo; + } +--- request +GET /foo?a=a%00b%00 +--- response_body +'a\0b\0' + + + +=== TEST 10: \b for mysql +--- config + location /foo { + set_unescape_uri $foo $arg_a; + set_quote_sql_str $foo $foo; + echo $foo; + } +--- request +GET /foo?a=a%08b%08 +--- response_body +'a\bb\b' + + + +=== TEST 11: \t for mysql +--- config + location /foo { + set_unescape_uri $foo $arg_a; + set_quote_sql_str $foo $foo; + echo $foo; + } +--- request +GET /foo?a=a%09b%09 +--- response_body +'a\tb\t' + + + +=== TEST 12: \Z for mysql +--- config + location /foo { + set_unescape_uri $foo $arg_a; + set_quote_sql_str $foo $foo; + echo $foo; + } +--- request +GET /foo?a=a%1ab%1a +--- response_body +'a\Zb\Z' + + + +=== TEST 13: set quote sql value +--- config + location /foo { + set_unescape_uri $foo $arg_a; + set_quote_sql_str $foo $foo; + echo $foo; + } +--- request +GET /foo?a=$$ +--- response_body +'\$\$' diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/rand.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/rand.t new file mode 100644 index 0000000..7f042bb --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/rand.t @@ -0,0 +1,168 @@ +# vi:filetype=perl + +use Test::Nginx::Socket; + +repeat_each(100); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /rand { + set $from 5; + set $to 7; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: [5-7] + + + +=== TEST 2: sanity (two digits) +--- config + location /rand { + set $from 35; + set $to 37; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 3[5-7] + + + +=== TEST 3: sanity (two digits, from > to) +--- config + location /rand { + set $from 37; + set $to 35; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 3[5-7] + + + +=== TEST 4: sanity (two digits, from == to) +--- config + location /rand { + set $from 117; + set $to 117; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body +117 + + + +=== TEST 5: negative number not allowed in from arg +--- config + location /rand { + set $from -2; + set $to 4; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 6: negative number not allowed in to arg +--- config + location /rand { + set $from 2; + set $to -4; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 7: empty string not allowed in from arg +--- config + location /rand { + set $from ''; + set $to 4; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 8: empty string not allowed in to arg +--- config + location /rand { + set $from 2; + set $to ''; + set_random $res $from $to; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 9: wrong number of arguments +--- config + location /rand { + set $from 2; + set_random $res $from; + + echo $res; + } +--- request + GET /rand +--- response_body_like: 500 Internal Server Error +--- error_code: 500 +--- SKIP + + + +=== TEST 10: zero is fine +--- config + location /rand { + set_random $res 0 0; + + echo $res; + } +--- request + GET /rand +--- response_body +0 diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/rotate.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/rotate.t new file mode 100644 index 0000000..2982a71 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/rotate.t @@ -0,0 +1,270 @@ +# vi:filetype= + +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * (3 * blocks()); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: sanity +--- config + location /bar { + set $a 1; + set_rotate $a 1 3; + + set $b 2; + set_rotate $b 1 3; + + set $c 3; + set_rotate $c 1 3; + + set $d 0; + set_rotate $d 1 3; + + set $e 1; + set_rotate $e 3 5; + + echo "a = $a"; + echo "b = $b"; + echo "c = $c"; + echo "d = $d"; + echo "e = $e"; + } +--- request + GET /bar +--- response_body +a = 2 +b = 3 +c = 1 +d = 1 +e = 3 +--- no_error_log +[error] + + + +=== TEST 2: bad current value +--- config + location /bar { + set $a abc; + set_rotate $a 1 3; + + echo "a = $a"; + } +--- request + GET /bar +--- response_body_like: ^a = [12]$ +--- error_log +set_rotate: bad current value: "abc" + + + +=== TEST 3: bad "from" value +--- config + location /bar { + set $a 2; + set_rotate $a abc 3; + + echo "a = $a"; + } +--- request + GET /bar +--- response_body_like: 500 Internal Server Error +--- error_code: 500 +--- error_log +set_rotate: bad "from" argument value: "abc" + + + +=== TEST 4: bad "to" argument value +--- config + location /bar { + set $a 2; + set_rotate $a 1 abc; + + echo "a = $a"; + } +--- request + GET /bar +--- response_body_like: 500 Internal Server Error +--- error_code: 500 +--- error_log +set_rotate: bad "to" argument value: "abc" + + + +=== TEST 5: when no current value is given +--- config + location /incr { + set_rotate $a 1 3; + + echo "a = $a"; + } + + location /t { + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + } +--- request + GET /t +--- response_body +a = 1 +a = 2 +a = 3 +a = 1 +a = 2 +a = 3 +--- no_error_log +[error] + + + +=== TEST 6: when no current value is given (starting from 0) +--- config + location /incr { + set_rotate $a 0 2; + + echo "a = $a"; + } + + location /t { + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + } +--- request + GET /t +--- response_body +a = 0 +a = 1 +a = 2 +a = 0 +a = 1 +a = 2 +--- no_error_log +[error] + + + +=== TEST 7: when a non-integer string value is given +--- config + location /incr { + set $a "hello"; + set_rotate $a 0 2; + + echo "a = $a"; + } + + location /t { + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + } +--- request + GET /t +--- response_body +a = 0 +a = 1 +a = 2 +a = 0 +a = 1 +a = 2 +--- error_log +set_rotate: bad current value: "hello" + + + +=== TEST 8: when an empty string value is given +--- config + location /incr { + set $a ""; + set_rotate $a 0 2; + + echo "a = $a"; + } + + location /t { + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + echo_location /incr; + } +--- request + GET /t +--- response_body +a = 0 +a = 1 +a = 2 +a = 0 +a = 1 +a = 2 +--- no_error_log +[error] + + + +=== TEST 9: value persistence is per-location +--- config + location /incr { + set_rotate $a 0 2; + + echo "a = $a"; + } + + location /incr2 { + set_rotate $a 0 2; + + echo "a = $a"; + } + + location /t { + echo_location /incr; + echo_location /incr2; + echo_location /incr; + echo_location /incr2; + echo_location /incr; + echo_location /incr2; + echo_location /incr; + echo_location /incr2; + echo_location /incr; + echo_location /incr2; + echo_location /incr; + echo_location /incr2; + } +--- request + GET /t +--- response_body +a = 0 +a = 0 +a = 1 +a = 1 +a = 2 +a = 2 +a = 0 +a = 0 +a = 1 +a = 1 +a = 2 +a = 2 +--- no_error_log +[error] diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/secure-random.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/secure-random.t new file mode 100644 index 0000000..1f0b4a3 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/secure-random.t @@ -0,0 +1,107 @@ +# vi:filetype= + +use Test::Nginx::Socket; + +repeat_each(2); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: a 32-character alphanum +--- config + location /alphanum { + set_secure_random_alphanum $res 32; + + echo $res; + } +--- request + GET /alphanum +--- response_body_like: ^[a-zA-Z0-9]{32}$ + + + +=== TEST 2: a 16-character alphanum +--- config + location /alphanum { + set_secure_random_alphanum $res 16; + + echo $res; + } +--- request + GET /alphanum +--- response_body_like: ^[a-zA-Z0-9]{16}$ + + + +=== TEST 3: a 1-character alphanum +--- config + location /alphanum { + set_secure_random_alphanum $res 1; + + echo $res; + } +--- request + GET /alphanum +--- response_body_like: ^[a-zA-Z0-9]{1}$ + + + +=== TEST 4: length less than <= 0 should fail +--- config + location /alphanum { + set_secure_random_alphanum $res 0; + + echo $res; + } +--- request + GET /alphanum +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 5: length less than <= 0 should fail +--- config + location /alphanum { + set_secure_random_alphanum $res -4; + + echo $res; + } +--- request + GET /alphanum +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 6: non-numeric length should fail +--- config + location /alphanum { + set_secure_random_alphanum $res bob; + + echo $res; + } +--- request + GET /alphanum +--- response_body_like: 500 Internal Server Error +--- error_code: 500 + + + +=== TEST 7: a 16-character lcalpha +--- config + location /lcalpha { + set_secure_random_lcalpha $res 16; + + echo $res; + } +--- request + GET /lcalpha +--- response_body_like: ^[a-z]{16}$ diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/t/unescape-uri.t b/modules_deb/libnginx-mod-http-set-misc-0.33/t/unescape-uri.t new file mode 100644 index 0000000..ad52b59 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/t/unescape-uri.t @@ -0,0 +1,58 @@ +# vi:filetype=perl + +use lib 'lib'; +use Test::Nginx::Socket; + +#repeat_each(3); + +plan tests => repeat_each() * 2 * blocks(); + +no_long_string(); + +run_tests(); + +#no_diff(); + +__DATA__ + +=== TEST 1: set unescape uri +buggy? +--- config + location /foo { + set $foo "hello%20world"; + set_unescape_uri $foo $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +hello world + + + +=== TEST 2: set unescape uri (in-place) +buggy? +--- config + location /foo { + set $foo "hello%20world"; + set_unescape_uri $foo; + echo $foo; + } +--- request +GET /foo +--- response_body +hello world + + + +=== TEST 3: unescape '+' to ' ' +--- config + location /bar { + set $a 'a+b'; + set_unescape_uri $a; + echo $a; + } +--- request + GET /bar +--- response_body +a b diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/util/build.sh b/modules_deb/libnginx-mod-http-set-misc-0.33/util/build.sh new file mode 100755 index 0000000..dc2bcb6 --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/util/build.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# this file is mostly meant to be used by the author himself. + +root=`pwd` +home=~ +version=$1 +force=$2 + + #--with-cc="gcc46" \ + #--with-ld-opt="-rdynamic" \ + #--with-mail \ + #--with-mail_ssl_module \ + +ngx-build $force $version \ + --with-cc-opt="-I$PCRE_INC -I$OPENSSL_INC" \ + --with-ld-opt="-L$PCRE_LIB -L$OPENSSL_LIB -Wl,-rpath,$PCRE_LIB:$OPENSSL_LIB" \ + --with-http_ssl_module \ + --without-mail_pop3_module \ + --without-mail_imap_module \ + --without-mail_smtp_module \ + --without-http_upstream_ip_hash_module \ + --without-http_empty_gif_module \ + --without-http_memcached_module \ + --without-http_referer_module \ + --without-http_autoindex_module \ + --without-http_auth_basic_module \ + --without-http_userid_module \ + --add-module=$root/../echo-nginx-module \ + --add-module=$root/../ndk-nginx-module \ + --add-module=$root/../iconv-nginx-module \ + --add-module=$root $opts \ + --with-debug \ + || exit 1 + diff --git a/modules_deb/libnginx-mod-http-set-misc-0.33/valgrind.suppress b/modules_deb/libnginx-mod-http-set-misc-0.33/valgrind.suppress new file mode 100644 index 0000000..470978e --- /dev/null +++ b/modules_deb/libnginx-mod-http-set-misc-0.33/valgrind.suppress @@ -0,0 +1,105 @@ +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_create_pool + fun:ngx_http_init_request +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_create_pool + fun:ngx_event_accept +} +{ + + Memcheck:Addr4 + fun:ngx_init_cycle + fun:ngx_master_process_cycle + fun:main +} +{ + + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_calloc + fun:ngx_event_process_init +} +{ + + exp-sgcheck:SorG + fun:ngx_http_variables_init_vars + fun:ngx_http_block +} +{ + + exp-sgcheck:SorG + fun:ngx_conf_parse +} +{ + + exp-sgcheck:SorG + fun:ngx_vslprintf + fun:ngx_log_error_core +} +{ + + exp-sgcheck:SorG + fun:ngx_conf_parse + fun:ngx_http_core_location +} +{ + nginx-core-process-init + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_event_process_init +} +{ + nginx-core-crc32-init + Memcheck:Leak + fun:malloc + fun:ngx_alloc + fun:ngx_crc32_table_init + fun:main +} +{ + libc-2.12.so + Memcheck:Param + epoll_ctl(event) + fun:epoll_ctl +} +{ + + Memcheck:Cond + fun:index + fun:expand_dynamic_string_token + fun:_dl_map_object + fun:map_doit + fun:_dl_catch_error + fun:do_preload + fun:dl_main +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_single_process_cycle +} +{ + + Memcheck:Leak + match-leak-kinds: definite + fun:malloc + fun:ngx_alloc + fun:ngx_set_environment + fun:ngx_worker_process_init + fun:ngx_worker_process_cycle +} diff --git a/modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitattributes b/modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitattributes new file mode 100644 index 0000000..6fe6f35 --- /dev/null +++ b/modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitattributes @@ -0,0 +1 @@ +*.t linguist-language=Text diff --git a/modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitignore b/modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitignore new file mode 100644 index 0000000..5e0cb97 --- /dev/null +++ b/modules_deb/libnginx-mod-http-srcache-filter-0.33/.gitignore @@ -0,0 +1,79 @@ +*.mobi +genmobi.sh +.libs +*.swp +*.slo +*.la +*.swo +*.lo +*~ +*.o +print.txt +.rsync +*.tar.gz +dist +build[78] +build +tags +update-readme +*.tmp +test/Makefile +test/blib +test.sh +t/t.sh +test/t/servroot/ +releng +reset +*.t_ +src/handler.h +src/util.c +src/module.h +src/module.c +src/drizzle.c +src/processor.h +src/handler.c +src/util.h +src/drizzle.h +src/processor.c +src/output.c +src/output.h +libdrizzle +ctags +src/stream.h +nginx +keepalive +reindex +src/keepalive.c +src/keepalive.h +src/checker.h +src/checker.c +src/quoting.h +src/quoting.c +src/module.h +src/module.c +src/util.h +src/util.c +src/processor.h +src/processor.c +src/rds.h +src/utils.h +src/handler.c +src/handler.h +src/var.[ch] +util/bench +*.html +trace.out* +try.sh +build9 +src/fetch.[ch] +src/store.[ch] +t/servroot/ +headers.[ch] +buildroot/ +build1[0-9] +go +all +analyze +addr2line +*.plist +Makefile diff --git a/modules_deb/libnginx-mod-http-srcache-filter-0.33/.travis.yml b/modules_deb/libnginx-mod-http-srcache-filter-0.33/.travis.yml new file mode 100644 index 0000000..600cf7d --- /dev/null +++ b/modules_deb/libnginx-mod-http-srcache-filter-0.33/.travis.yml @@ -0,0 +1,87 @@ +sudo: required +dist: bionic + +os: linux + +language: c + +cache: + directories: + - download-cache + +compiler: + - gcc + +env: + global: + - LUAJIT_PREFIX=/opt/luajit21 + - LUAJIT_LIB=$LUAJIT_PREFIX/lib + - LD_LIBRARY_PATH=$LUAJIT_LIB:$LD_LIBRARY_PATH + - LUAJIT_INC=$LUAJIT_PREFIX/include/luajit-2.1 + - LUA_INCLUDE_DIR=$LUAJIT_INC + - LUA_CMODULE_DIR=/lib + - JOBS=3 + - NGX_BUILD_JOBS=$JOBS + matrix: + - NGINX_VERSION=1.17.8 + - NGINX_VERSION=1.19.9 + - NGINX_VERSION=1.23.0 + +services: + - memcache + - redis-server + - postgresql + - mysql + +before_install: + - sudo apt-get install -qq -y axel cpanminus libtest-base-perl libtext-diff-perl liburi-perl libwww-perl libtest-longstring-perl liblist-moreutils-perl > build.log 2>&1 || (cat build.log && exit 1) + +install: + - echo $HOME + - if [ ! -d download-cache ]; then mkdir download-cache; fi + - if [ ! -f download-cache/ngx_http_redis-0.3.7.tar.gz ]; then wget -O download-cache/ngx_http_redis-0.3.7.tar.gz http://people.freebsd.org/~osa/ngx_http_redis-0.3.7.tar.gz; fi + - if [ ! -f download-cache/drizzle7-2011.07.21.tar.gz ]; then wget -O download-cache/drizzle7-2011.07.21.tar.gz http://openresty.org/download/drizzle7-2011.07.21.tar.gz; fi + - mkdir -p ~/work/nginx && cp download-cache/ngx_http_redis-0.3.7.tar.gz ~/work/nginx/ + - git clone https://github.com/openresty/nginx-devel-utils.git + - git clone https://github.com/openresty/openresty.git ../openresty + - git clone https://github.com/openresty/no-pool-nginx.git ../no-pool-nginx + - git clone https://github.com/simpl/ngx_devel_kit.git ../ndk-nginx-module + - git clone https://github.com/openresty/test-nginx.git + - git clone -b v2.1-agentzh https://github.com/openresty/luajit2.git + - git clone https://github.com/openresty/lua-nginx-module.git ../lua-nginx-module + - git clone https://github.com/openresty/lua-resty-core.git ../lua-resty-core + - git clone https://github.com/openresty/lua-resty-lrucache.git ../lua-resty-lrucache + - git clone https://github.com/openresty/nginx-eval-module.git ../eval-nginx-module + - git clone https://github.com/openresty/echo-nginx-module.git ../echo-nginx-module + - git clone https://github.com/openresty/set-misc-nginx-module.git ../set-misc-nginx-module + - git clone https://github.com/openresty/xss-nginx-module.git ../xss-nginx-module + - git clone https://github.com/openresty/redis2-nginx-module.git ../redis2-nginx-module + - git clone https://github.com/openresty/headers-more-nginx-module.git ../headers-more-nginx-module + - git clone https://github.com/openresty/rds-json-nginx-module.git ../rds-json-nginx-module + - git clone https://github.com/openresty/drizzle-nginx-module.git ../drizzle-nginx-module + - git clone https://github.com/openresty/memc-nginx-module.git ../memc-nginx-module + - git clone https://github.com/openresty/ngx_postgres.git ../postgres-nginx-module + - git clone https://github.com/openresty/openresty.git ../ngx_openresty + +before_script: + - mysql -uroot -e 'create database ngx_test; grant all on ngx_test.* to "ngx_test"@"%" identified by "ngx_test"; flush privileges;' + - psql -c "create database ngx_test;" -U postgres + - psql -c "create user ngx_test with password 'ngx_test';" -U postgres + - psql -c "grant all privileges on database ngx_test to ngx_test;" -U postgres + +script: + - tar xzf download-cache/drizzle7-2011.07.21.tar.gz && cd drizzle7-2011.07.21 + - ./configure --prefix=/usr --without-server > build.log 2>&1 || (cat build.log && exit 1) + - sudo PATH=$PATH make libdrizzle-1.0 install-libdrizzle-1.0 > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + - cd luajit2 + - make -j$JOBS CCDEBUG=-g Q= PREFIX=$LUAJIT_PREFIX CC=$CC XCFLAGS='-DLUA_USE_APICHECK -DLUA_USE_ASSERT' > build.log 2>&1 || (cat build.log && exit 1) + - sudo make install PREFIX=$LUAJIT_PREFIX > build.log 2>&1 || (cat build.log && exit 1) + - cd .. + - cd test-nginx && sudo cpanm . && cd .. + - export PATH=$PWD/work/nginx/sbin:$PWD/nginx-devel-utils:$PATH + - export NGX_BUILD_CC=$CC + - sh util/build.sh $NGINX_VERSION > build.log 2>&1 || (cat build.log && exit 1) + - nginx -V + - ldd `which nginx`|grep luajit + - prove -I. -r t diff --git a/modules_deb/libnginx-mod-http-srcache-filter-0.33/Changes b/modules_deb/libnginx-mod-http-srcache-filter-0.33/Changes new file mode 100644 index 0000000..5f257fe --- /dev/null +++ b/modules_deb/libnginx-mod-http-srcache-filter-0.33/Changes @@ -0,0 +1,16 @@ +v0.12 - 11 July 2011 +* now we properly support fetch/store subrequests with internal redirection in them. main requests with internal redirection will still not be stored into the cache if there is a cache miss. thanks Liseen Wan for reporting it. +* fixed spots that trigger the unused-but-set-variable warning by gcc 4.6. +* added srcache_store_skip and srcache_fetch_skip directives to skip cache fetching or storing based on variables that are set and not empty nor 0. thanks Andre. Examples of using Lua to set $nocache to avoid storing URIs that contain /tmp: + set_by_lua $nocache ' + if string.match(ngx.var.request_uri, "/tmp") then + return "true" + else + return "" + end'; + + srcache_store_skip $nocache; +* added new directive srcache_store_max_size. thanks Andre. +* made our filter optimization work with nginx HUP by clearing the ngx_http_srcache_used flag at nginx pre-config callback. thanks Marcus Clyne. +* now we skip NULL chains in our output filters and also removed the SUBREQUEST_IN_MEMORY flag for our srcache_store subrequests because it will cause mysterious hanging issues when memcached returns CLIENT_ERROR for "get". + diff --git a/modules_deb/libnginx-mod-http-srcache-filter-0.33/README.markdown b/modules_deb/libnginx-mod-http-srcache-filter-0.33/README.markdown new file mode 100644 index 0000000..e880b9c --- /dev/null +++ b/modules_deb/libnginx-mod-http-srcache-filter-0.33/README.markdown @@ -0,0 +1,1258 @@ +Name +==== + +**ngx_srcache** - Transparent subrequest-based caching layout for arbitrary nginx locations + +*This module is not distributed with the Nginx source.* See [the installation instructions](#installation). + +Table of Contents +================= + +* [Name](#name) +* [Status](#status) +* [Version](#version) +* [Synopsis](#synopsis) +* [Description](#description) + * [Subrequest caching](#subrequest-caching) + * [Distributed Memcached Caching](#distributed-memcached-caching) + * [Caching with Redis](#caching-with-redis) + * [Cache Key Preprocessing](#cache-key-preprocessing) +* [Directives](#directives) + * [srcache_fetch](#srcache_fetch) + * [srcache_fetch_skip](#srcache_fetch_skip) + * [srcache_store](#srcache_store) + * [srcache_store_max_size](#srcache_store_max_size) + * [srcache_store_skip](#srcache_store_skip) + * [srcache_store_statuses](#srcache_store_statuses) + * [srcache_store_ranges](#srcache_store_ranges) + * [srcache_header_buffer_size](#srcache_header_buffer_size) + * [srcache_store_hide_header](#srcache_store_hide_header) + * [srcache_store_pass_header](#srcache_store_pass_header) + * [srcache_methods](#srcache_methods) + * [srcache_ignore_content_encoding](#srcache_ignore_content_encoding) + * [srcache_request_cache_control](#srcache_request_cache_control) + * [srcache_response_cache_control](#srcache_response_cache_control) + * [srcache_store_no_store](#srcache_store_no_store) + * [srcache_store_no_cache](#srcache_store_no_cache) + * [srcache_store_private](#srcache_store_private) + * [srcache_default_expire](#srcache_default_expire) + * [srcache_max_expire](#srcache_max_expire) +* [Variables](#variables) + * [$srcache_expire](#srcache_expire) + * [$srcache_fetch_status](#srcache_fetch_status) + * [$srcache_store_status](#srcache_store_status) +* [Known Issues](#known-issues) +* [Caveats](#caveats) +* [Trouble Shooting](#trouble-shooting) +* [Installation](#installation) +* [Compatibility](#compatibility) +* [Community](#community) + * [English Mailing List](#english-mailing-list) + * [Chinese Mailing List](#chinese-mailing-list) +* [Bugs and Patches](#bugs-and-patches) +* [Source Repository](#source-repository) +* [Test Suite](#test-suite) +* [TODO](#todo) +* [Getting involved](#getting-involved) +* [Author](#author) +* [Copyright & License](#copyright--license) +* [See Also](#see-also) + +Status +====== + +This module is production ready. + +Version +======= + +This document describes srcache-nginx-module [v0.32](https://github.com/openresty/srcache-nginx-module/tags) released on 2 July 2020. + +Synopsis +======== + +```nginx + + upstream my_memcached { + server 10.62.136.7:11211; + keepalive 10; + } + + location = /memc { + internal; + + memc_connect_timeout 100ms; + memc_send_timeout 100ms; + memc_read_timeout 100ms; + memc_ignore_client_abort on; + + set $memc_key $query_string; + set $memc_exptime 300; + + memc_pass my_memcached; + } + + location /foo { + set $key $uri$args; + srcache_fetch GET /memc $key; + srcache_store PUT /memc $key; + srcache_store_statuses 200 301 302 307 308; + + # proxy_pass/fastcgi_pass/drizzle_pass/echo/etc... + # or even static files on the disk + } +``` + +```nginx + + location = /memc2 { + internal; + + memc_connect_timeout 100ms; + memc_send_timeout 100ms; + memc_read_timeout 100ms; + memc_ignore_client_abort on; + + set_unescape_uri $memc_key $arg_key; + set $memc_exptime $arg_exptime; + + memc_pass unix:/tmp/memcached.sock; + } + + location /bar { + set_escape_uri $key $uri$args; + srcache_fetch GET /memc2 key=$key; + srcache_store PUT /memc2 key=$key&exptime=$srcache_expire; + + # proxy_pass/fastcgi_pass/drizzle_pass/echo/etc... + # or even static files on the disk + } +``` + +```nginx + + map $request_method $skip_fetch { + default 0; + POST 1; + PUT 1; + } + + server { + listen 8080; + + location /api/ { + set $key "$uri?$args"; + + srcache_fetch GET /memc $key; + srcache_store PUT /memc $key; + + srcache_methods GET PUT POST; + srcache_fetch_skip $skip_fetch; + + # proxy_pass/drizzle_pass/content_by_lua/echo/... + } + } +``` + +[Back to TOC](#table-of-contents) + +Description +=========== + +This module provides a transparent caching layer for arbitrary nginx locations (like those use an upstream or even serve static disk files). The caching behavior is mostly compatible with [RFC 2616](http://www.ietf.org/rfc/rfc2616.txt). + +Usually, [memc-nginx-module](https://github.com/openresty/memc-nginx-module) is used together with this module to provide a concrete caching storage backend. But technically, any modules that provide a REST interface can be used as the fetching and storage subrequests used by this module. + +For main requests, the [srcache_fetch](#srcache_fetch) directive works at the end of the access phase, so the [standard access module](http://nginx.org/en/docs/http/ngx_http_access_module.html)'s [allow](http://nginx.org/en/docs/http/ngx_http_access_module.html#allow) and [deny](http://nginx.org/en/docs/http/ngx_http_access_module.html#deny) direcives run *before* ours, which is usually the desired behavior for security reasons. + +The workflow of this module looks like below: + +![srcache flowchart](http://agentzh.org/misc/image/srcache-flowchart.png "srcache flowchart") + +[Back to TOC](#table-of-contents) + +Subrequest caching +------------------ + +For *subrequests*, we explicitly **disallow** the use of this module because it's too difficult to get right. There used to be an implementation but it was buggy and I finally gave up fixing it and abandoned it. + +However, if you're using [lua-nginx-module](https://github.com/openresty/lua-nginx-module), it's easy to do subrequest caching in Lua all by yourself. That is, first issue a subrequest to an [memc-nginx-module](https://github.com/openresty/memc-nginx-module) location to do an explicit cache lookup, if cache hit, just use the cached data returned; otherwise, fall back to the true backend, and finally do a cache insertion to feed the data into the cache. + +Using this module for main request caching and Lua for subrequest caching is the approach that we're taking in our business. This hybrid solution works great in production. + +[Back to TOC](#table-of-contents) + +Distributed Memcached Caching +----------------------------- + +Here is a simple example demonstrating a distributed memcached caching mechanism built atop this module. Suppose we do have three different memcached nodes and we use simple modulo to hash our keys. + +```nginx + + http { + upstream moon { + server 10.62.136.54:11211; + server unix:/tmp/memcached.sock backup; + } + + upstream earth { + server 10.62.136.55:11211; + } + + upstream sun { + server 10.62.136.56:11211; + } + + upstream_list universe moon earth sun; + + server { + memc_connect_timeout 100ms; + memc_send_timeout 100ms; + memc_read_timeout 100ms; + + location = /memc { + internal; + + set $memc_key $query_string; + set_hashed_upstream $backend universe $memc_key; + set $memc_exptime 3600; # in seconds + memc_pass $backend; + } + + location / { + set $key $uri; + srcache_fetch GET /memc $key; + srcache_store PUT /memc $key; + + # proxy_pass/fastcgi_pass/content_by_lua/drizzle_pass/... + } + } + } +``` +Here's what is going on in the sample above: +1. We first define three upstreams, `moon`, `earth`, and `sun`. These are our three memcached servers. +1. And then we group them together as an upstream list entity named `universe` with the `upstream_list` directive provided by [set-misc-nginx-module](https://github.com/openresty/set-misc-nginx-module). +1. After that, we define an internal location named `/memc` for talking to the memcached cluster. +1. In this `/memc` location, we first set the `$memc_key` variable with the query string (`$args`), and then use the [set_hashed_upstream](https://github.com/openresty/set-misc-nginx-module#set_hashed_upstream) directive to hash our [$memc_key](https://github.com/openresty/memc-nginx-module#memc_key) over the upsteam list `universe`, so as to obtain a concrete upstream name to be assigned to the variable `$backend`. +1. We pass this `$backend` variable into the [memc_pass](https://github.com/openresty/memc-nginx-module#memc_pass) directive. The `$backend` variable can hold a value among `moon`, `earth`, and `sun`. +1. Also, we define the memcached caching expiration time to be 3600 seconds (i.e., an hour) by overriding the [$memc_exptime](https://github.com/openresty/memc-nginx-module#memc_exptime) variable. +1. In our main public location `/`, we configure the `$uri` variable as our cache key, and then configure [srcache_fetch](#srcache_fetch) for cache lookups and [srcache_store](#srcache_store) for cache updates. We're using two subrequests to our `/memc` location defined earlier in these two directives. + +One can use [lua-nginx-module](https://github.com/openresty/lua-nginx-module)'s [set_by_lua](https://github.com/openresty/lua-nginx-module#set_by_lua) or [rewrite_by_lua](https://github.com/openresty/lua-nginx-module#rewrite_by_lua) directives to inject custom Lua code to compute the `$backend` and/or `$key` variables in the sample above. + +One thing that should be taken care of is that memcached does have restriction on key lengths, i.e., 250 bytes, so for keys that may be very long, one could use the [set_md5](https://github.com/openresty/set-misc-nginx-module#set_md5) directive or its friends to pre-hash the key to a fixed-length digest before assigning it to `$memc_key` in the `/memc` location or the like. + +Further, one can utilize the [srcache_fetch_skip](#srcache_fetch_skip) and [srcache_store_skip](#srcache_store_skip) directives to control what to cache and what not on a per-request basis, and Lua can also be used here in a similar way. So the possibility is really unlimited. + +To maximize speed, we often enable TCP (or Unix Domain Socket) connection pool for our memcached upstreams provided by [HttpUpstreamKeepaliveModule](http://wiki.nginx.org/HttpUpstreamKeepaliveModule), for example, + +```nginx + + upstream moon { + server 10.62.136.54:11211; + server unix:/tmp/memcached.sock backup; + keepalive 10; + } +``` + +where we define a connection pool which holds up to 10 keep-alive connections (per nginx worker process) for our `moon` upstream (cluster). + +[Back to TOC](#table-of-contents) + +Caching with Redis +------------------ + +Redis is an alternative key-value store with many additional features. + +Here is a working example using the lua-resty-redis module: + +``` + location ~ '\.php$|^/update.php' { + # cache setup + set $key $request_uri; + try_files $uri =404; + + srcache_fetch_skip $skip_cache; + srcache_store_skip $skip_cache; + + srcache_response_cache_control off; + srcache_store_statuses 200 201 301 302 307 308 404 503; + + set_escape_uri $escaped_key $key; + + srcache_fetch GET /redis-fetch $key; + srcache_store PUT /redis-store key=$escaped_key; + + more_set_headers 'X-Cache-Fetch-Status $srcache_fetch_status'; + more_set_headers 'X-Cache-Store-Status $srcache_store_status'; + + fastcgi_split_path_info ^(.+?\.php)(|/.*)$; + # Security note: If you're running a version of PHP older than the + # latest 5.3, you should have "cgi.fix_pathinfo = 0;" in php.ini. + # See http://serverfault.com/q/627903/94922 for details. + include fastcgi_params; + # Block httproxy attacks. See https://httpoxy.org/. + fastcgi_param HTTP_PROXY ""; + fastcgi_param SCRIPT_FILENAME /var/www/html/$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param QUERY_STRING $query_string; + fastcgi_intercept_errors on; + + fastcgi_pass upstream-name; + } + + location /redis-fetch { + internal; + + resolver 8.8.8.8 valid=300s; + resolver_timeout 10s; + + content_by_lua_block { + local key = assert(ngx.var.request_uri, "no key found") + local redis = require "resty.redis" + local red, err = redis:new() + if not red then + ngx.log(ngx.ERR, "Failed to create redis variable, error -> ", err) + ngx.exit(500) + end + assert(red:connect("redis-master.default.svc.cluster.local", 6379)) + if not red then + ngx.log(ngx.ERR, "Failed to connect to redis, error -> ", err) + ngx.exit(500) + end + local res, err = red:auth("redispassword") + if not res then + ngx.say("failed to authenticate, ", err) + ngx.exit(500) + end + local data = assert(red:get(key)) + assert(red:set_keepalive(10000, 100)) + if res == ngx.null then + return ngx.exit(404) + end + ngx.print(data) + } + } + + location /redis-store { + internal; + + resolver 8.8.8.8 valid=300s; + resolver_timeout 10s; + + content_by_lua_block { + local value = assert(ngx.req.get_body_data(), "no value found") + local key = assert(ngx.var.request_uri, "no key found") + local redis = require "resty.redis" + local red, err = redis:new() + if not red then + ngx.log(ngx.ERR, "Failed to create redis variable, error -> ", err) + ngx.exit(500) + end + assert(red:connect("redis-master.default.svc.cluster.local", 6379)) + if not red then + ngx.log(ngx.ERR, "Failed to connect to redis, error -> ", err) + ngx.exit(500) + end + local res, err = red:auth("redispassword") + if not res then + ngx.say("failed to authenticate, ", err) + ngx.exit(500) + end + local data = assert(red:set(key, value)) + assert(red:set_keepalive(10000, 100)) + if res == ngx.null then + return ngx.exit(404) + end + } + } +``` + + +Here is a working example by using the HTTPRedis (fetch) and Redis2 (store) modules: + +```nginx + + location /api { + default_type text/css; + + set $key $uri; + set_escape_uri $escaped_key $key; + + srcache_fetch GET /redis $key; + srcache_store PUT /redis2 key=$escaped_key&exptime=120; + + # fastcgi_pass/proxy_pass/drizzle_pass/postgres_pass/echo/etc + } + + location = /redis { + internal; + + set_md5 $redis_key $args; + redis_pass 127.0.0.1:6379; + } + + location = /redis2 { + internal; + + set_unescape_uri $exptime $arg_exptime; + set_unescape_uri $key $arg_key; + set_md5 $key; + + redis2_query set $key $echo_request_body; + redis2_query expire $key $exptime; + redis2_pass 127.0.0.1:6379; + } +``` + +This example makes use of the [$echo_request_body](https://github.com/openresty/echo-nginx-module#echo_request_body) variable provided by [echo-nginx-module](https://github.com/openresty/echo-nginx-module). Note that you need the latest version of [echo-nginx-module](https://github.com/openresty/echo-nginx-module), `v0.38rc2` because earlier versions may not work reliably. + +Also, you need both [HttpRedisModule](http://wiki.nginx.org/HttpRedisModule) and [redis2-nginx-module](https://github.com/openresty/redis2-nginx-module). The former is used in the [srcache_fetch](#srcache_fetch) subrequest and the latter is used in the [srcache_store](#srcache_store) subrequest. + +The Nginx core also has a bug that could prevent [redis2-nginx-module](https://github.com/openresty/redis2-nginx-module)'s pipelining support from working properly in certain extreme conditions. And the following patch fixes this: + + http://mailman.nginx.org/pipermail/nginx-devel/2012-March/002040.html + +Note that, however, if you are using the [OpenResty](http://openresty.org/) 1.0.15.3 bundle or later, then you already have everything that you need here in the bundle. + +[Back to TOC](#table-of-contents) + +Cache Key Preprocessing +----------------------- + +It is often desired to preprocess the cache key to exclude random noises that may hurt the cache hit rate. For example, random session IDs in the URI arguments are usually desired to get removed. + +Consider the following URI querystring + + SID=BC3781C3-2E02-4A11-89CF-34E5CFE8B0EF&UID=44332&L=EN&M=1&H=1&UNC=0&SRC=LK&RT=62 + +we want to remove the `SID` and `UID` arguments from it. It is easy to achieve if you use [lua-nginx-module](https://github.com/openresty/lua-nginx-module) at the same time: + +```nginx + + location = /t { + rewrite_by_lua ' + local args = ngx.req.get_uri_args() + args.SID = nil + args.UID = nil + ngx.req.set_uri_args(args) + '; + + echo $args; + } +``` + +Here we use the [echo](https://github.com/openresty/echo-nginx-module#echo) directive from [echo-nginx-module](https://github.com/openresty/echo-nginx-module) to dump out +the final value of [$args](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_args) in the end. You can replace it with your +[srcache-nginx-module](https://github.com/openresty/srcache-nginx-module) configurations and upstream configurations instead for +your case. Let's test this /t interface with curl: + + $ curl 'localhost:8081/t?RT=62&SID=BC3781C3-2E02-4A11-89CF-34E5CFE8B0EF&UID=44332&L=EN&M=1&H=1&UNC=0&SRC=LK' + M=1&UNC=0&RT=62&H=1&L=EN&SRC=LK + +It is worth mentioning that, if you want to retain the order of the URI +arguments, then you can do string substitutions on the value of [$args](http://nginx.org/en/docs/http/ngx_http_core_module.html#var_args) +directly, for example, + + location = /t { + rewrite_by_lua ' + local args = ngx.var.args + newargs, n, err = ngx.re.gsub(args, [[\b[SU]ID=[^&]*&?]], "", "jo") + if n and n > 0 then + ngx.var.args = newargs + end + '; + + echo $args; + } + +Now test it with the original curl command again, we get exactly what +we would expect: + + RT=62&L=EN&M=1&H=1&UNC=0&SRC=LK + +But for caching purposes, it's good to normalize the URI argument +order so that you can increase the cache hit rate. And the hash table +entry order used by LuaJIT or Lua can be used to normalize the order +as a nice side effect. + +[Back to TOC](#table-of-contents) + +Directives +========== + +[Back to TOC](#table-of-contents) + +srcache_fetch +------------- +**syntax:** *srcache_fetch <method> <uri> <args>?* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *post-access* + +This directive registers an access phase handler that will issue an Nginx subrequest to lookup the cache. + +When the subrequest returns status code other than `200`, than a cache miss is signaled and the control flow will continue to the later phases including the content phase configured by [ngx_http_proxy_module](http://nginx.org/en/docs/http/ngx_http_proxy_module.html), [ngx_http_fastcgi_module](http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html), and others. If the subrequest returns `200 OK`, then a cache hit is signaled and this module will send the subrequest's response as the current main request's response to the client directly. + +This directive will always run at the end of the access phase, such that [ngx_http_access_module](http://nginx.org/en/docs/http/ngx_http_access_module.html)'s [allow](http://nginx.org/en/docs/http/ngx_http_access_module.html#allow) and [deny](http://nginx.org/en/docs/http/ngx_http_access_module.html#deny) will always run *before* this. + +You can use the [srcache_fetch_skip](#srcache_fetch_skip) directive to disable cache look-up selectively. + +[Back to TOC](#table-of-contents) + +srcache_fetch_skip +------------------ +**syntax:** *srcache_fetch_skip <flag>* + +**default:** *srcache_fetch_skip 0* + +**context:** *http, server, location, location if* + +**phase:** *post-access* + +The `` argument supports nginx variables. When this argument's value is not empty *and* not equal to `0`, then the fetching process will be unconditionally skipped. + +For example, to skip caching requests which have a cookie named `foo` with the value `bar`, we can write + +```nginx + + location / { + set $key ...; + set_by_lua $skip ' + if ngx.var.cookie_foo == "bar" then + return 1 + end + return 0 + '; + + srcache_fetch_skip $skip; + srcache_store_skip $skip; + + srcache_fetch GET /memc $key; + srcache_store GET /memc $key; + + # proxy_pass/fastcgi_pass/content_by_lua/... + } +``` +where [lua-nginx-module](https://github.com/openresty/lua-nginx-module) is used to calculate the value of the `$skip` variable at the (earlier) rewrite phase. Similarly, the `$key` variable can be computed by Lua using the [set_by_lua](https://github.com/openresty/lua-nginx-module#set_by_lua) or [rewrite_by_lua](https://github.com/openresty/lua-nginx-module#rewrite_by_lua) directive too. + +The standard [map](http://nginx.org/en/docs/http/ngx_http_map_module.html#map) directive can also be used to compute the value of the `$skip` variable used in the sample above: + +```nginx + + map $cookie_foo $skip { + default 0; + bar 1; + } +``` + +but your [map](http://nginx.org/en/docs/http/ngx_http_map_module.html#map) statement should be put into the `http` config block in your `nginx.conf` file though. + +[Back to TOC](#table-of-contents) + +srcache_store +------------- +**syntax:** *srcache_store <method> <uri> <args>?* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *output-filter* + +This directive registers an output filter handler that will issue an Nginx subrequest to save the response of the current main request into a cache backend. The status code of the subrequest will be ignored. + +You can use the [srcache_store_skip](#srcache_store_skip) and [srcache_store_max_size](#srcache_store_max_size) directives to disable caching for certain requests in case of a cache miss. + +Since the `v0.12rc7` release, both the response status line, response headers, and response bodies will be put into the cache. By default, the following special response headers will not be cached: + +* Connection +* Keep-Alive +* Proxy-Authenticate +* Proxy-Authorization +* TE +* Trailers +* Transfer-Encoding +* Upgrade +* Set-Cookie + +You can use the [srcache_store_pass_header](#srcache_store_pass_header) and/or [srcache_store_hide_header](#srcache_store_hide_header) directives to control what headers to cache and what not. + +The original response's data chunks get emitted as soon as +they arrive. `srcache_store` just copies and collects the data in an output filter without postponing them from being sent downstream. + +But please note that even though all the response data will be sent immediately, the current Nginx request lifetime will not finish until the srcache_store subrequest completes. That means a delay in closing the TCP connection on the server side (when HTTP keepalive is disabled, but proper HTTP clients should close the connection actively on the client side, which adds no extra delay or other issues at all) or serving the next request sent on the same TCP connection (when HTTP keepalive is in action). + +[Back to TOC](#table-of-contents) + +srcache_store_max_size +---------------------- +**syntax:** *srcache_store_max_size <size>* + +**default:** *srcache_store_max_size 0* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +When the response body length is exceeding this size, this module will not try to store the response body into the cache using the subrequest template that is specified in [srcache_store](#srcache_store). + +This is particular useful when using a cache storage backend that does have a hard upper limit on the input data. For example, the Memcached server has a default limit of `1 MB` by item. + +When `0` is specified (the default value), there's no limit check at all. + +[Back to TOC](#table-of-contents) + +srcache_store_skip +------------------ +**syntax:** *srcache_store_skip <flag>* + +**default:** *srcache_store_skip 0* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +The `` argument supports Nginx variables. When this argument's value is not empty *and* not equal to `0`, then the storing process will be unconditionally skipped. + +Starting from the `v0.25` release, the `` expression (possibly containing Nginx variables) can be evaluated up to twice: the first time is right after the response header is being sent and when the `` expression is not evaluated to true values it will be evaluated again right after the end of the response body data stream is seen. Before `v0.25`, only the first time evaluation is performed. + +Here's an example using Lua to set $nocache to avoid storing URIs that contain the string "/tmp": + +```nginx + + set_by_lua $nocache ' + if string.match(ngx.var.uri, "/tmp") then + return 1 + end + return 0'; + + srcache_store_skip $nocache; +``` + +[Back to TOC](#table-of-contents) + +srcache_store_statuses +---------------------- +**syntax:** *srcache_store_statuses <status1> <status2> ..* + +**default:** *srcache_store_statuses 200 301 302 307 308* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +This directive controls what responses to store to the cache according to their status code. + +By default, only `200`, `301`, `302`, `307` and `308` responses will be stored to cache and any other responses will skip [srcache_store](#srcache_store). + +You can specify arbitrary positive numbers for the response status code that you'd like to cache, even including error code like `404` and `503`. For example: + +```nginx + + srcache_store_statuses 200 201 301 302 307 308 404 503; +``` + +At least one argument should be given to this directive. + +This directive was first introduced in the `v0.13rc2` release. + +[Back to TOC](#table-of-contents) + +srcache_store_ranges +-------------------- +**syntax:** *srcache_store_ranges on|off* + +**default:** *srcache_store_ranges off* + +**context:** *http, server, location, location if* + +**phase:** *output-body-filter* + +When this directive is turned on (default to `off`), [srcache_store](#srcache_store) will also store 206 Partial Content responses generated by the standard `ngx_http_range_filter_module`. If you turn this directive on, you MUST add `$http_range` to your cache keys. For example, + +```nginx + + location / { + set $key "$uri$args$http_range"; + srcache_fetch GET /memc $key; + srcache_store PUT /memc $key; + } +``` + +This directive was first introduced in the `v0.27` release. + +[Back to TOC](#table-of-contents) + +srcache_header_buffer_size +-------------------------- +**syntax:** *srcache_header_buffer_size <size>* + +**default:** *srcache_header_buffer_size 4k/8k* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +This directive controles the header buffer when serializing response headers for [srcache_store](#srcache_store). The default size is the page size, usually `4k` or `8k` depending on specific platforms. + +Note that the buffer is not used to hold all the response headers, but just each individual header. So the buffer is merely needed to be big enough to hold the longest response header. + +This directive was first introduced in the `v0.12rc7` release. + +[Back to TOC](#table-of-contents) + +srcache_store_hide_header +------------------------- +**syntax:** *srcache_store_hide_header <header>* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +By default, this module caches all the response headers except the following ones: + +* Connection +* Keep-Alive +* Proxy-Authenticate +* Proxy-Authorization +* TE +* Trailers +* Transfer-Encoding +* Upgrade +* Set-Cookie + +You can hide even more response headers from [srcache_store](#srcache_store) by listing their names (case-insensitive) by means of this directive. For examples, + +```nginx + + srcache_store_hide_header X-Foo; + srcache_store_hide_header Last-Modified; +``` + +Multiple occurrences of this directive are allowed in a single location. + +This directive was first introduced in the `v0.12rc7` release. + +See also [srcache_store_pass_header](#srcache_store_pass_header). + +[Back to TOC](#table-of-contents) + +srcache_store_pass_header +------------------------- +**syntax:** *srcache_store_pass_header <header>* + +**default:** *no* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +By default, this module caches all the response headers except the following ones: + +* Connection +* Keep-Alive +* Proxy-Authenticate +* Proxy-Authorization +* TE +* Trailers +* Transfer-Encoding +* Upgrade +* Set-Cookie + +You can force [srcache_store](#srcache_store) to store one or more of these response headers from [srcache_store](#srcache_store) by listing their names (case-insensitive) by means of this directive. For examples, + +```nginx + + srcache_store_pass_header Set-Cookie; + srcache_store_pass_header Proxy-Autenticate; +``` + +Multiple occurrences of this directive are allowed in a single location. + +This directive was first introduced in the `v0.12rc7` release. + +See also [srcache_store_hide_header](#srcache_store_hide_header). + +[Back to TOC](#table-of-contents) + +srcache_methods +--------------- +**syntax:** *srcache_methods <method>...* + +**default:** *srcache_methods GET HEAD* + +**context:** *http, server, location* + +**phase:** *post-access, output-header-filter* + +This directive specifies HTTP request methods that are considered by either [srcache_fetch](#srcache_fetch) or [srcache_store](#srcache_store). HTTP request methods not listed will be skipped completely from the cache. + +The following HTTP methods are allowed: `GET`, `HEAD`, `POST`, `PUT`, and `DELETE`. The `GET` and `HEAD` methods are always implicitly included in the list regardless of their presence in this directive. + +Note that since the `v0.17` release `HEAD` requests are always skipped by [srcache_store](#srcache_store) because their responses never carry a response body. + +This directive was first introduced in the `v0.12rc7` release. + +[Back to TOC](#table-of-contents) + +srcache_ignore_content_encoding +------------------------------- +**syntax:** *srcache_ignore_content_encoding on|off* + +**default:** *srcache_ignore_content_encoding off* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +When this directive is turned `off` (which is the default), non-empty `Content-Encoding` response header will cause [srcache_store](#srcache_store) skip storing the whole response into the cache and issue a warning into nginx's `error.log` file like this: + + + [warn] 12500#0: *1 srcache_store skipped due to response header "Content-Encoding: gzip" + (maybe you forgot to disable compression on the backend?) + + +Turning on this directive will ignore the `Content-Encoding` response header and store the response as usual (and also without warning). + +It's recommended to always disable gzip/deflate compression on your backend server by specifying the following line in your `nginx.conf` file: + +```nginx + + proxy_set_header Accept-Encoding ""; +``` + +This directive was first introduced in the `v0.12rc7` release. + +[Back to TOC](#table-of-contents) + +srcache_request_cache_control +----------------------------- +**syntax:** *srcache_request_cache_control on|off* + +**default:** *srcache_request_cache_control off* + +**context:** *http, server, location* + +**phase:** *post-access, output-header-filter* + +When this directive is turned `on`, the request headers `Cache-Control` and `Pragma` will be honored by this module in the following ways: + +1. [srcache_fetch](#srcache_fetch), i.e., the cache lookup operation, will be skipped when request headers `Cache-Control: no-cache` and/or `Pragma: no-cache` are present. +1. [srcache_store](#srcache_store), i.e., the cache store operation, will be skipped when the request header `Cache-Control: no-store` is specified. + +Turning off this directive will disable this functionality and is considered safer for busy sites mainly relying on cache for speed. + +This directive was first introduced in the `v0.12rc7` release. + +See also [srcache_response_cache_control](#srcache_response_cache_control). + +[Back to TOC](#table-of-contents) + +srcache_response_cache_control +------------------------------ +**syntax:** *srcache_response_cache_control on|off* + +**default:** *srcache_response_cache_control on* + +**context:** *http, server, location* + +**phase:** *output-header-filter* + +When this directive is turned `on`, the response headers `Cache-Control` and `Expires` will be honored by this module in the following ways: + +* `Cache-Control: private` skips [srcache_store](#srcache_store), +* `Cache-Control: no-store` skips [srcache_store](#srcache_store), +* `Cache-Control: no-cache` skips [srcache_store](#srcache_store), +* `Cache-Control: max-age=0` skips [srcache_store](#srcache_store), +* and `Expires: ` skips [srcache_store](#srcache_store). + +This directive takes priority over the [srcache_store_no_store](#srcache_store_no_store), [srcache_store_no_cache](#srcache_store_no_cache), and [srcache_store_private](#srcache_store_private) directives. + +This directive was first introduced in the `v0.12rc7` release. + +See also [srcache_request_cache_control](#srcache_request_cache_control). + +[Back to TOC](#table-of-contents) + +srcache_store_no_store +---------------------- +**syntax:** *srcache_store_no_store on|off* + +**default:** *srcache_store_no_store off* + +**context:** *http, server, location* + +**phase:** *output-header-filter* + +Turning this directive on will force responses with the header `Cache-Control: no-store` to be stored into the cache when [srcache_response_cache_control](#srcache_response_cache_control) is turned `on` *and* other conditions are met. Default to `off`. + +This directive was first introduced in the `v0.12rc7` release. + +[Back to TOC](#table-of-contents) + +srcache_store_no_cache +---------------------- +**syntax:** *srcache_store_no_cache on|off* + +**default:** *srcache_store_no_cache off* + +**context:** *http, server, location* + +**phase:** *output-header-filter* + +Turning this directive on will force responses with the header `Cache-Control: no-cache` to be stored into the cache when [srcache_response_cache_control](#srcache_response_cache_control) is turned `on` *and* other conditions are met. Default to `off`. + +This directive was first introduced in the `v0.12rc7` release. + +[Back to TOC](#table-of-contents) + +srcache_store_private +--------------------- +**syntax:** *srcache_store_private on|off* + +**default:** *srcache_store_private off* + +**context:** *http, server, location* + +**phase:** *output-header-filter* + +Turning this directive on will force responses with the header `Cache-Control: private` to be stored into the cache when [srcache_response_cache_control](#srcache_response_cache_control) is turned `on` *and* other conditions are met. Default to `off`. + +This directive was first introduced in the `v0.12rc7` release. + +[Back to TOC](#table-of-contents) + +srcache_default_expire +---------------------- +**syntax:** *srcache_default_expire <time>* + +**default:** *srcache_default_expire 60s* + +**context:** *http, server, location, location if* + +**phase:** *output-header-filter* + +This directive controls the default expiration time period that is allowed for the [$srcache_expire](#srcache_expire) variable value when neither `Cache-Control: max-age=N` nor `Expires` are specified in the response headers. + +The `