postgres://someuser@/var/run/sippy
Here the sippy is the database name, while /var/run is the location of the
socket. This change should be backward compatible since '/' is not
allowed in the database name.
... | ... |
@@ -143,6 +143,8 @@ static int parse_db_url(struct db_id* id, const char* url) |
143 | 143 |
break; |
144 | 144 |
|
145 | 145 |
case '/': |
146 |
+ if (strchr(url + i + 1, '/') != NULL) |
|
147 |
+ break; |
|
146 | 148 |
if (dupl_string(&id->host, begin, url + i) < 0) goto err; |
147 | 149 |
if (dupl_string(&id->database, url + i + 1, url + len) < 0) goto err; |
148 | 150 |
return 0; |
... | ... |
@@ -159,6 +161,8 @@ static int parse_db_url(struct db_id* id, const char* url) |
159 | 161 |
break; |
160 | 162 |
|
161 | 163 |
case '/': |
164 |
+ if (strchr(url + i + 1, '/') != NULL) |
|
165 |
+ break; |
|
162 | 166 |
id->host = prev_token; |
163 | 167 |
id->port = str2s(begin, url + i - begin, 0); |
164 | 168 |
if (dupl_string(&id->database, url + i + 1, url + len) < 0) goto err; |
... | ... |
@@ -175,6 +179,8 @@ static int parse_db_url(struct db_id* id, const char* url) |
175 | 179 |
break; |
176 | 180 |
|
177 | 181 |
case '/': |
182 |
+ if (strchr(url + i + 1, '/') != NULL) |
|
183 |
+ break; |
|
178 | 184 |
if (dupl_string(&id->host, begin, url + i) < 0) goto err; |
179 | 185 |
if (dupl_string(&id->database, url + i + 1, url + len) < 0) goto err; |
180 | 186 |
return 0; |