- we previously would use strch to find the first @ in the URL
- when there is an @ inside of the username this one would be hit.
- since we first search for the end of the host-path, we can search from the right for the last @ to separate the user:auth from the real hostname.
*/
url->URL = NewStrBufDup(UrlStr);
url->Host = pch = ChrPtr(url->URL);
*/
url->URL = NewStrBufDup(UrlStr);
url->Host = pch = ChrPtr(url->URL);
- url->LocalPart = strchr(pch, '/');
+ pEndHost = url->LocalPart = strchr(pch, '/');
if (url->LocalPart != NULL) {
if ((*(url->LocalPart + 1) == '/') &&
(*(url->LocalPart - 1) == ':')) { /* TODO: find default port for this protocol... */
url->Host = url->LocalPart + 2;
if (url->LocalPart != NULL) {
if ((*(url->LocalPart + 1) == '/') &&
(*(url->LocalPart - 1) == ':')) { /* TODO: find default port for this protocol... */
url->Host = url->LocalPart + 2;
- url->LocalPart = strchr(url->Host, '/');
+ pEndHost = url->LocalPart = strchr(url->Host, '/');
if (url->LocalPart != NULL)
{
StrBufPeek(url->URL, url->LocalPart, 0, '\0');
if (url->LocalPart != NULL)
{
StrBufPeek(url->URL, url->LocalPart, 0, '\0');
}
}
if (url->LocalPart == NULL) {
}
}
if (url->LocalPart == NULL) {
- url->LocalPart = pch + StrLength(url->URL);
+ pEndHost = url->LocalPart = ChrPtr(url->URL) + StrLength(url->URL);
- pCredEnd = strchr(pch, '@');
+ pCredEnd = strrchr(ChrPtr(url->URL), '@');
if (pCredEnd >= url->LocalPart)
pCredEnd = NULL;
if (pCredEnd != NULL)
if (pCredEnd >= url->LocalPart)
pCredEnd = NULL;
if (pCredEnd != NULL)