libyuarel
libyuarel copied to clipboard
user without password does not parse
Hi, thanks for sharing your code! I'm dumping a one-off parser I wrote myself in another project for yours.
One issue I found is it seems the code that parses credentials requires both user and password.
E.g. http://u:[email protected]
works, but http://[email protected]
does not.
Does this look like the right fix?
diff --git a/yuarel.c b/yuarel.c
index a5f313fb7..072bd76ad 100644
--- a/yuarel.c
+++ b/yuarel.c
@@ -180,12 +180,11 @@ yuarel_parse(struct yuarel *url, char *u)
*u = '\0';
u = strchr(url->username, ':');
- if (NULL == u) {
- return -1;
+ if (NULL != u) {
+ url->password = u + 1;
+ *u = '\0';
}
- url->password = u + 1;
- *u = '\0';
}
/* Missing hostname? */
Thank you, I will take a look at it :-)