[BUG] Bzr can't pull bundles from http urls

Aaron Bentley aaron.bentley at utoronto.ca
Thu Dec 7 16:20:07 GMT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Arbash Meinel wrote:
> We are escaping the character, which from what I've seen works just
> fine.

It doesn't.  Try applying the bundle and taking out the tilde change.
The SFTP tests will puke because the url contains an "unsafe" character.

Membership in the "safe" set is being used for two different things:
1. testing whether a url is valid
2. encoding potentially troublesome characters.

But urls with potentially troublesome characters are still valid.

If you look at normalize_url, it can't make up its mind:

      if c not in _url_safe_characters:
          raise errors.InvalidURL(url, 'URLs can only contain specific'
                                      ' safe characters (not %r)' % c)

But later:

if path[i] not in _url_safe_characters:
    chars = path[i].encode('utf-8')
    path[i] = ''.join(['%%%02X' % ord(c) for c in
                       path[i].encode('utf-8')])

> It has worked over sftp, and over http. IE I can access:
> http://bazaar.launchpad.net/~bzr/bzr/trunk/.bzr/branch-format
> and
> http://bazaar.launchpad.net/%7Ebzr/bzr/trunk/.bzr/branch-format

Well, it does not work if you make the mistake of normalizing such a url
from bytestring input.

>  _url_safe_characters = set(
>     "abcdefghijklmnopqrstuvwxyz" # Lowercase alpha
>     "ABCDEFGHIJKLMNOPQRSTUVWXYZ" # Uppercase alpha
>     "0123456789" # Numbers
>     "_.-!~*'()"  # Unreserved characters
>     "/;?:@&=+$," # Reserved characters
>     "%#"         # Extra reserved characters
>  )

I agree.  That's nice.  Submitted with this change.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFFeD830F+nu1YWqI0RAn3gAJwJU7NKOqlH0jjT9bAAm7yWG42jnwCfWBkV
MfRKsq0hF4psFoW01d39QIU=
=IDZS
-----END PGP SIGNATURE-----




More information about the bazaar mailing list