FRiCKLE / ngx_postgres

upstream module that allows nginx to communicate directly with PostgreSQL database.
http://labs.frickle.com/nginx_ngx_postgres/
BSD 2-Clause "Simplified" License
545 stars 122 forks source link

Capture the request body #64

Open Bibop182 opened 4 years ago

Bibop182 commented 4 years ago

This PR makes the following changes

Description

Now nginx will read the entire request body in the content step if the postgres_query directive was used. '$request_body' variable can now be used in sql query string.

The variable request_body cannot be processed by the postgres_escape directive during the rewrite phase. Therefore, for security reasons, the request_body value that is used in postgres_query is always processing to escape string literals during the content phase without the need for postgres_escape.

This behavior can be disabled by directive postgres_escape_request_body off.

Added tests to check behavior when using the request body. Added a configuration sample in the readme.

Changes for supporting current versions of nginx (fixes #57) included.