Added test for parse_url()

This commit is contained in:
Sergey Lyubka committed 2014-05-19 12:56:07 +01:00
1 parent 3536670b82
commit 1bede7e28b
2 files changed
+20 -3

No files matched your search

+4 -3
View File
@@ -3992,11 +3992,12 @@ static int parse_url(const char *url, char *proto, size_t plen,
snprintf(fmt3, sizeof(fmt3), "%%%zu[^: ]:%%hu%%n", hlen);
if (sscanf(url, fmt1, proto, host, port, &n) == 3 ||
sscanf(url, fmt2, proto, host, &n) == 2 ||
sscanf(url, fmt3, host, port, &n) == 2) {
sscanf(url, fmt2, proto, host, &n) == 2) {
return n;
} else if (sscanf(url, fmt3, host, port, &n) == 2) {
proto[0] = '\0';
return n;
}
return 0;
}