summaryrefslogtreecommitdiff
path: root/http.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-10-08 12:57:11 -0400
committerNick Mathewson <nickm@torproject.org>2010-10-08 12:57:11 -0400
commit2e63a604da3f3c77800d2a2ff1681d8397ecdac6 (patch)
tree6f2c1207169fb0bfec6ce3eb60ebb1b3ec5ebcc6 /http.c
parent3b844893859c08a17c039dccef2e07e42e7c2f69 (diff)
downloadlibevent-2e63a604da3f3c77800d2a2ff1681d8397ecdac6.tar.gz
evhttp_encode_uri encodes all reserved characters, including !$'()*+,/:=@
Perviously, some characters not listed as "unreserved" by RFC 3986 (notably "!$'()*+,/:=@") were not encoded by evhttp_encode_uri. This made trouble, especially when encoding path components (where @ and / are bad news) and parameters (where + should get encoded so it doesn't later decode into a space). Spotted by Bas Verhoeven.
Diffstat (limited to 'http.c')
-rw-r--r--http.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/http.c b/http.c
index 979aece9..a472c5be 100644
--- a/http.c
+++ b/http.c
@@ -2295,12 +2295,13 @@ evhttp_send_page(struct evhttp_request *req, struct evbuffer *databuf)
}
static const char uri_chars[256] = {
+ /* 0 */
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0,
/* 64 */
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1,
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0,
@@ -2317,7 +2318,7 @@ static const char uri_chars[256] = {
};
/*
- * Helper functions to encode/decode a URI.
+ * Helper functions to encode/decode a string for inclusion in a URI.
* The returned string must be freed by the caller.
*/
char *