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:
Adrien Destugues 2013-10-15 14:45:16 +02:00
parent 7696f7dd54
commit bb1d0adcd1

View File

@ -659,7 +659,14 @@ BUrl::_ExtractAuthority(const BString& urlString, int16* origin)
(*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
if (userInfoEnd != -1) {