BUrl: fix handling of @ character
* @ is a separator (between user:password and host) only if there are no slashes before it * All slashes in user and password should be urlencoded (as well as any @ and :) * On the other hand, it's possible to have @ as part of an URL path or query. An example is Google Maps. Gets Google Maps working.
This commit is contained in:
@@ -659,7 +659,14 @@ BUrl::_ExtractAuthority(const BString& urlString, int16* origin)
|
|||||||
(*origin) += 2;
|
(*origin) += 2;
|
||||||
|
|
||||||
|
|
||||||
int16 userInfoEnd = urlString.FindFirst('@', *origin);
|
int32 userInfoEnd = urlString.FindFirst('@', *origin);
|
||||||
|
|
||||||
|
// if the @ comes after a /, it can't be the delimiter for
|
||||||
|
// user:pasword@host. Characters /:@ in user and password must be escaped.
|
||||||
|
// RFC1738, 3.1, Common Internet Scheme Syntax.
|
||||||
|
int32 nextSlash = urlString.FindFirst('/', *origin);
|
||||||
|
if(userInfoEnd > nextSlash)
|
||||||
|
userInfoEnd = -1;
|
||||||
|
|
||||||
// URL contains userinfo field
|
// URL contains userinfo field
|
||||||
if (userInfoEnd != -1) {
|
if (userInfoEnd != -1) {
|
||||||
|
|||||||
Reference in New Issue
Block a user