Mercurial > pidgin
diff libpurple/util.c @ 28255:79c14adf9669
Change purple_url_encode() to not encode . _ - ~ because it's not
necessary. Also use capital letters instead of lowercase. RFC3986
says capital letters are a SHOULD and that lowercase letters should
be equivalent.
AOL's clientlogin authentication requires both of these changes for
our signature to match up with the signature generated on AOL's side.
Original I had implemented an oscar-specific version of our url
encode function with these two changes, but I'm pretty sure it's
safe to make this in purple_url_encode(). It looks like it's almost
always used to encode pieces of URLs. MSN uses it for a few other
things... I tested setting those characters in your friendly name
and it works fine.
| author | Mark Doliner <mark@kingant.net> |
|---|---|
| date | Fri, 11 Sep 2009 18:17:03 +0000 |
| parents | 10c28fac798d |
| children | dab0d17dc6c1 6e9917e067e6 |
line wrap: on
line diff
--- a/libpurple/util.c Fri Sep 11 16:00:54 2009 +0000 +++ b/libpurple/util.c Fri Sep 11 18:17:03 2009 +0000 @@ -4378,14 +4378,14 @@ gunichar c = g_utf8_get_char(iter); /* If the character is an ASCII character and is alphanumeric * no need to escape */ - if (c < 128 && isalnum(c)) { + if (c < 128 && (isalnum(c) || c == '-' || c == '.' || c == '_' || c == '~')) { buf[j++] = c; } else { int bytes = g_unichar_to_utf8(c, utf_char); for (i = 0; i < bytes; i++) { if (j > (BUF_LEN - 4)) break; - sprintf(buf + j, "%%%02x", utf_char[i] & 0xff); + sprintf(buf + j, "%%%02X", utf_char[i] & 0xff); j += 3; } }
