Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make buf_append_urlencoded() percent-encode fewer characters.
Per RFC 3986, the characters '-', '_', '.', '~' don't need to be
percent-encoded anywhere in a URL or query string.

Removed special case for ' ' → '+' to prevent incompatibility with ocserv:
http://lists.infradead.org/pipermail/openconnect-devel/2016-October/004042.html

		/* else if (c==' ')
			buf_append_bytes(buf, "+", 1); */

Signed-off-by: Dan Lenski <dlenski@gmail.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dlenski authored and dwmw2 committed Dec 13, 2016
1 parent 685704f commit 1d84a7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion http.c
Expand Up @@ -45,7 +45,7 @@ void buf_append_urlencoded(struct oc_text_buf *buf, const char *str)
{
while (str && *str) {
unsigned char c = *str;
if (c < 0x80 && isalnum((int)(c)))
if (c < 0x80 && (isalnum((int)(c)) || c=='-' || c=='_' || c=='.' || c=='~'))
buf_append_bytes(buf, str, 1);
else
buf_append(buf, "%%%02x", c);
Expand Down

0 comments on commit 1d84a7b

Please sign in to comment.