Skip to content

Conversation

@natano
Copy link

@natano natano commented Mar 19, 2019

Prior to version 0.18.0 it was possible to have an '@' in a connection
string, but that feature got lost when the parsing code was rewritten to
support multiple host addresses.

Prior to version 0.18.0 it was possible to have an '@' in a connection
string, but that feature got lost when the parsing code was rewritten to
support multiple host addresses.
@elprans
Copy link
Member

elprans commented Mar 19, 2019

If I'm reading libpq's parsing code correctly, it looks for the first @ when splitting [1], which is inconsistent with what urlparse does. I think we should fix that discrepancy instead and require urlescape on usernames containing the @ character.

[1] https://github.com/postgres/postgres/blob/28988a84cf19c01dba3c3fb40e95d9cd6e4888da/src/interfaces/libpq/fe-connect.c#L5575-L5581

elprans added a commit that referenced this pull request Aug 19, 2019
When a connection string component contains characters that have a
special meaning in the URI (e.g. '@' or '='), percent-encoding must be
used.  asyncpg must take care to unquote the parsed components
correctly, and it doesn't currently.

Additionally, this makes asyncpg follow the libpq's behavior of parsing
the authentication part of netloc, i.e. split on the first '@' and not
the last.

Fixes: #418
Fixes: #471
@elprans elprans closed this in 5513b9d Oct 3, 2019
@elprans elprans closed this in #472 Oct 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants