Thread: pgsql: libpq: Discard leading and trailing spaces for parameters and va

pgsql: libpq: Discard leading and trailing spaces for parameters and va

From
Michael Paquier
Date:
libpq: Discard leading and trailing spaces for parameters and values in URIs

Integer values applied a parsing rule through pqParseIntParam() that
made URIs like this one working, even if these include spaces around
values:
"postgresql://localhost:5432/postgres?keepalives=1 &keepalives_idle=1 "

This commit changes the parsing so as spaces before and after parameters
and values are discarded, offering more consistency with the parsing
that already applied to libpq for integer values in URIs.

Note that %20 can be used in a URI for a space character.  ECPGconnect()
has been discarded leading and trailing spaces around parameters and
values that for a long time, as well.  Like f22e84df1dea, this is done
as a HEAD-only change.

Reviewed-by: Yuto Sasaki
Discussion: https://postgr.es/m/Zv3oWOfcrHTph7JK@paquier.xyz

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/430ce189fc4521a1c197eee36b8ca6b37b29e86e

Modified Files
--------------
src/interfaces/libpq/fe-connect.c | 42 +++++++++++++++++++++++++++++++++------
src/interfaces/libpq/t/001_uri.pl | 18 +++++++++++++++++
2 files changed, 54 insertions(+), 6 deletions(-)