Jaymon / dsnparse

Easily parse DSN urls (connection strings) in Python
MIT License
21 stars 8 forks source link

No decoding of url encoded characters in hostname #7

Closed runfalk closed 4 years ago

runfalk commented 5 years ago

For postgresql postgresql://%2Fvar%2Flib%2Fpostgresql/dbname is a valid DSN when connecting to a UNIX socket. It is actually not valid to not url encode the / (see https://www.postgresql.org/docs/10/libpq-connect.html)

It is also possible to specify the path as a paramter without encoding it: postgresql:///dbname?host=/var/lib/postgresql

It would be great if the parsed DSN decoded that as well re-encoded it when doing geturl.

Jaymon commented 5 years ago

I'd love a pull request for this, add appropriate tests and make sure all tests pass and I will merge it in