diff --git a/src/core/ngx_alloc.c b/src/core/ngx_alloc.c index 110ab0161..311a34e26 100644 --- a/src/core/ngx_alloc.c +++ b/src/core/ngx_alloc.c @@ -59,20 +59,25 @@ void ngx_destroy_pool(ngx_pool_t *pool) free(l->alloc); } - /* we can use pool->log so we have to free() pool after all */ + /* + * we could allocate pool->log from this pool + * so we can not use this log while free()ing the pool + */ - for (p = pool->next; p ; p = n) { #if (NGX_DEBUG_ALLOC) + for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { ngx_log_debug(pool->log, "free: %08x" _ p); + } #endif - n = p->next; + + for (p = pool, n = pool->next; /* void */; p = n, n = n->next) { free(p); + + if (n == NULL) { + break; + } } -#if (NGX_DEBUG_ALLOC) - ngx_log_debug(pool->log, "free: %08x" _ pool); -#endif - free(pool); pool = NULL; } diff --git a/src/http/modules/ngx_http_ssi_filter.c b/src/http/modules/ngx_http_ssi_filter.c index a2ea85ba3..857a8526e 100644 --- a/src/http/modules/ngx_http_ssi_filter.c +++ b/src/http/modules/ngx_http_ssi_filter.c @@ -4,8 +4,27 @@ #include +#define NGX_HTTP_SSI_COMMAND_LEN 31 +#define NGX_HTTP_SSI_PARAM_LEN 31 + +#define NGX_HTTP_SSI_DONE 1 +#define NGX_HTTP_SSI_INVALID_COMMAND 2 +#define NGX_HTTP_SSI_INVALID_PARAM 3 +#define NGX_HTTP_SSI_INVALID_VALUE 4 +#define NGX_HTTP_SSI_LONG_VALUE 5 + + typedef struct { -} ngx_http_ssi_filter_ctx_t; + ngx_table_elt_t *param; + ngx_str_t command; + ngx_array_t params; + int state; + int looked; + char *pos; + ngx_chain_t *out; + int new_hunk; + u_int value_len; +} ngx_http_ssi_ctx_t; static int ngx_http_ssi_filter_init(ngx_cycle_t *cycle); @@ -37,12 +56,49 @@ static int (*next_header_filter) (ngx_http_request_t *r); static int (*next_body_filter) (ngx_http_request_t *r, ngx_chain_t *ch); -static comment_string = "