diff options
author | Michael Paquier | 2024-10-06 09:23:02 +0000 |
---|---|---|
committer | Michael Paquier | 2024-10-06 09:23:02 +0000 |
commit | 430ce189fc4521a1c197eee36b8ca6b37b29e86e (patch) | |
tree | c9b5193ed86c46faf4c6754e6a36e9854f80d4d7 /src/interfaces/libpq/t/001_uri.pl | |
parent | 68dfecbef210dc000271553cfcb2342989d4ca0f (diff) |
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/[email protected]
Diffstat (limited to 'src/interfaces/libpq/t/001_uri.pl')
-rw-r--r-- | src/interfaces/libpq/t/001_uri.pl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/interfaces/libpq/t/001_uri.pl b/src/interfaces/libpq/t/001_uri.pl index 49ea5377e03..27cf67ae800 100644 --- a/src/interfaces/libpq/t/001_uri.pl +++ b/src/interfaces/libpq/t/001_uri.pl @@ -86,6 +86,24 @@ my @tests = ( q{user='uri-user' host='host' (inet)}, q{}, ], + [ + # Leading and trailing spaces, works. + q{postgresql://host? user = uri-user & port = 12345 }, + q{user='uri-user' host='host' port='12345' (inet)}, + q{}, + ], + [ + # Trailing data in parameter. + q{postgresql://host? user user = uri & port = 12345 12 }, + q{}, + q{libpq_uri_regress: trailing data found: " user user "}, + ], + [ + # Trailing data in value. + q{postgresql://host? user = uri-user & port = 12345 12 }, + q{}, + q{libpq_uri_regress: trailing data found: " 12345 12 "}, + ], [ q{postgresql://host?}, q{host='host' (inet)}, q{}, ], [ q{postgresql://[::1]:12345/db}, |