Permalink
Browse files

Fix compatibility with nginx-1.1.4+.

Partly from Yichun Zhang (agentzh).
  • Loading branch information...
1 parent 15d137c commit 6705c7588559176b290912cb8b8d1f02852b6bd5 @PiotrSikora PiotrSikora committed Nov 10, 2011
Showing with 26 additions and 1 deletion.
  1. +6 −0 src/ngx_postgres_handler.c
  2. +5 −0 src/ngx_postgres_output.c
  3. +15 −0 src/ngx_postgres_util.c
  4. +0 −1 src/ngx_postgres_util.h
@@ -218,6 +218,12 @@ ngx_postgres_handler(ngx_http_request_t *r)
ngx_del_timer(c->write);
}
+#if defined(nginx_version) && (nginx_version >= 1001004)
+ if (c->pool) {
+ ngx_destroy_pool(c->pool);
+ }
+#endif
+
ngx_free_connection(c);
ngx_postgres_upstream_finalize_request(r, u,
@@ -580,7 +580,12 @@ ngx_postgres_output_chain(ngx_http_request_t *r, ngx_chain_t *cl)
return rc;
}
+#if defined(nginx_version) && (nginx_version >= 1001004)
+ ngx_chain_update_chains(r->pool, &u->free_bufs, &u->busy_bufs, &cl,
+ u->output.tag);
+#else
ngx_chain_update_chains(&u->free_bufs, &u->busy_bufs, &cl, u->output.tag);
+#endif
dd("returning rc:%d", (int) rc);
return rc;
View
@@ -26,6 +26,9 @@
*/
#define DDEBUG 0
+
+#include <nginx.h>
+
#include "ngx_postgres_ddebug.h"
#include "ngx_postgres_util.h"
@@ -98,6 +101,12 @@ ngx_postgres_upstream_finalize_request(ngx_http_request_t *r,
"close http upstream connection: %d",
u->peer.connection->fd);
+#if defined(nginx_version) && (nginx_version >= 1001004)
+ if (u->peer.connection->pool) {
+ ngx_destroy_pool(u->peer.connection->pool);
+ }
+#endif
+
ngx_close_connection(u->peer.connection);
}
@@ -251,6 +260,12 @@ ngx_postgres_upstream_next(ngx_http_request_t *r,
}
#endif
+#if defined(nginx_version) && (nginx_version >= 1001004)
+ if (u->peer.connection->pool) {
+ ngx_destroy_pool(u->peer.connection->pool);
+ }
+#endif
+
ngx_close_connection(u->peer.connection);
}
View
@@ -28,7 +28,6 @@
#ifndef _NGX_POSTGRES_UTIL_H_
#define _NGX_POSTGRES_UTIL_H_
-#include <nginx.h>
#include <ngx_core.h>
#include <ngx_http.h>

0 comments on commit 6705c75

Please sign in to comment.