Make database optional

I was trying to use this to parse a redis url (which has no pathname) and ran into this issue.
Test case for redis URLs.