From 49855a037607c89426b59f54ae2d3049dc5d1c74 Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Thu, 2 Apr 2015 12:34:16 -0700 Subject: [PATCH 1/3] bugfix: fixed compilation failures with nginx 1.7.11+ configured with --with-threads. --- src/ngx_postgres_ddebug.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ngx_postgres_ddebug.h b/src/ngx_postgres_ddebug.h index 7cc05ecd..38253fca 100644 --- a/src/ngx_postgres_ddebug.h +++ b/src/ngx_postgres_ddebug.h @@ -29,6 +29,7 @@ #ifndef _NGX_POSTGRES_DDEBUG_H_ #define _NGX_POSTGRES_DDEBUG_H_ +#include #include #if defined(DDEBUG) && (DDEBUG) From 04e33d179be93c4b7ecd0b1e7d461724262548da Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Tue, 16 Jun 2015 20:52:46 +0800 Subject: [PATCH 2/3] bugfix: use ngx_abs() instead of abs() to fix one clang warning (-Wabsolute-value). --- src/ngx_postgres_output.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ngx_postgres_output.c b/src/ngx_postgres_output.c index 81a0b275..9fa5481c 100644 --- a/src/ngx_postgres_output.c +++ b/src/ngx_postgres_output.c @@ -549,7 +549,7 @@ ngx_postgres_output_chain(ngx_http_request_t *r, ngx_chain_t *cl) pglcf = ngx_http_get_module_loc_conf(r, ngx_postgres_module); pgctx = ngx_http_get_module_ctx(r, ngx_postgres_module); - r->headers_out.status = pgctx->status ? abs(pgctx->status) + r->headers_out.status = pgctx->status ? ngx_abs(pgctx->status) : NGX_HTTP_OK; if (pglcf->output_handler == &ngx_postgres_output_rds) { From 7950a250e9bc99967d83c57fbbadb9d0d6d5c4bf Mon Sep 17 00:00:00 2001 From: "Yichun Zhang (agentzh)" Date: Sat, 4 Jul 2015 15:24:05 +0800 Subject: [PATCH 3/3] feature: fixed compilation errors with nginx 1.9.1+. thanks Vadim A. Misbakh-Soloviov for the original patch in #38. --- src/ngx_postgres_util.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ngx_postgres_util.c b/src/ngx_postgres_util.c index 11b27979..ae7de38c 100644 --- a/src/ngx_postgres_util.c +++ b/src/ngx_postgres_util.c @@ -45,7 +45,9 @@ void ngx_postgres_upstream_finalize_request(ngx_http_request_t *r, ngx_http_upstream_t *u, ngx_int_t rc) { +#if defined(nginx_version) && (nginx_version < 1009001) ngx_time_t *tp; +#endif dd("entering"); @@ -61,10 +63,15 @@ ngx_postgres_upstream_finalize_request(ngx_http_request_t *r, u->resolved->ctx = NULL; } +#if defined(nginx_version) && (nginx_version >= 1009001) + if (u->state && u->state->response_time) { + u->state->response_time = ngx_current_msec - u->state->response_time; +#else if (u->state && u->state->response_sec) { tp = ngx_timeofday(); u->state->response_sec = tp->sec - u->state->response_sec; u->state->response_msec = tp->msec - u->state->response_msec; +#endif if (u->pipe) { u->state->response_length = u->pipe->read_length;