X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=libcitadel%2Flib%2Furlhandling.c;fp=libcitadel%2Flib%2Furlhandling.c;h=5259d8228c6b69a416c47fbb1f23828daf86c983;hb=a2f3fd43db6471e9c82bb4fb4c5b819ad6888bbe;hp=44be3f598a6aa1e77dffb2b6ea684ecefaca4d57;hpb=17ff73d9da7ae04a02ce72a0e1f9757fd97f70dd;p=citadel.git diff --git a/libcitadel/lib/urlhandling.c b/libcitadel/lib/urlhandling.c index 44be3f598..5259d8228 100644 --- a/libcitadel/lib/urlhandling.c +++ b/libcitadel/lib/urlhandling.c @@ -55,9 +55,14 @@ int ParseURL(ParsedURL **Url, StrBuf *UrlStr, unsigned short DefaultPort) url->LocalPart = strchr(pch, '/'); if (url->LocalPart != NULL) { if ((*(url->LocalPart + 1) == '/') && - (*(url->LocalPart + 2) == ':')) { /* TODO: find default port for this protocol... */ - url->Host = url->LocalPart + 3; + (*(url->LocalPart - 1) == ':')) { /* TODO: find default port for this protocol... */ + url->Host = url->LocalPart + 2; url->LocalPart = strchr(url->Host, '/'); + if (url->LocalPart != NULL) + { + StrBufPeek(url->URL, url->LocalPart, 0, '\0'); + url->LocalPart++; + } } } if (url->LocalPart == NULL) { @@ -119,12 +124,16 @@ void CurlPrepareURL(ParsedURL *Url) else Url->UrlWithoutCred = NewStrBufPlain(HKEY("http://")); StrBufAppendBufPlain(Url->UrlWithoutCred, Url->Host, -1, 0); + StrBufAppendBufPlain(Url->UrlWithoutCred, HKEY(":"), 0); StrBufAppendPrintf(Url->UrlWithoutCred, "%u", Url->Port); + StrBufAppendBufPlain(Url->UrlWithoutCred, HKEY("/"), 0); if (Url->LocalPart) - StrBufAppendBufPlain(Url->UrlWithoutCred, Url->LocalPart, -1, 0); + { + StrBufAppendBufPlain(Url->UrlWithoutCred, Url->LocalPart, -1, 0); + } if (Url->User != NULL) { Url->CurlCreds = NewStrBufPlain(Url->User, -1); @@ -132,4 +141,5 @@ void CurlPrepareURL(ParsedURL *Url) if (Url->Pass != NULL) StrBufAppendBufPlain(Url->CurlCreds, Url->Pass, -1, 0); } + Url->PlainUrl = ChrPtr(Url->UrlWithoutCred); }