diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-01 22:08:47 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-01 22:08:47 +0000 |
commit | 1f4a53507e325cfdc48e3024e00c59f7e721faba (patch) | |
tree | 7a1d0ae58793f0175be74e5f60da01afb21fe948 | |
parent | fd764222b83142d78879290547fcd415744c8cb9 (diff) | |
download | libmicrohttpd-1f4a53507e325cfdc48e3024e00c59f7e721faba.tar.gz libmicrohttpd-1f4a53507e325cfdc48e3024e00c59f7e721faba.zip |
fix #3413
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | src/include/microhttpd.h | 2 | ||||
-rw-r--r-- | src/microhttpd/connection.c | 23 | ||||
-rw-r--r-- | src/microhttpd/internal.c | 7 |
5 files changed, 35 insertions, 12 deletions
@@ -1,3 +1,12 @@ | |||
1 | Mon Jun 2 00:03:28 CEST 2014 | ||
2 | Added back unescaping for URI path (#3413) but without | ||
3 | unescaping '+' (#3371) to remain compatible with | ||
4 | MHD 0.9.34 and before. Note that applications providing | ||
5 | a custom MHD_OPTION_UNESCAPE_CALLBACK are no longer expected | ||
6 | to replace '+' with ' ', as that is now done separately for | ||
7 | the locations where this transformation is appropriate. | ||
8 | Releasing 0.9.37. -CG | ||
9 | |||
1 | Wed May 28 15:30:56 CEST 2014 | 10 | Wed May 28 15:30:56 CEST 2014 |
2 | Properly applying patch that was supposed to be | 11 | Properly applying patch that was supposed to be |
3 | committed on "May 2 20:22:45 CEST 2014" to address | 12 | committed on "May 2 20:22:45 CEST 2014" to address |
diff --git a/configure.ac b/configure.ac index 6e870513..c68f69de 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -22,15 +22,15 @@ | |||
22 | # | 22 | # |
23 | AC_PREREQ([2.60]) | 23 | AC_PREREQ([2.60]) |
24 | LT_PREREQ([2.4.0]) | 24 | LT_PREREQ([2.4.0]) |
25 | AC_INIT([libmicrohttpd],[0.9.36],[libmicrohttpd@gnu.org]) | 25 | AC_INIT([libmicrohttpd],[0.9.37],[libmicrohttpd@gnu.org]) |
26 | AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) | 26 | AM_INIT_AUTOMAKE([silent-rules] [subdir-objects]) |
27 | AC_CONFIG_HEADERS([MHD_config.h]) | 27 | AC_CONFIG_HEADERS([MHD_config.h]) |
28 | AC_CONFIG_MACRO_DIR([m4]) | 28 | AC_CONFIG_MACRO_DIR([m4]) |
29 | AH_TOP([#define _GNU_SOURCE 1]) | 29 | AH_TOP([#define _GNU_SOURCE 1]) |
30 | 30 | ||
31 | LIB_VERSION_CURRENT=35 | 31 | LIB_VERSION_CURRENT=37 |
32 | LIB_VERSION_REVISION=0 | 32 | LIB_VERSION_REVISION=0 |
33 | LIB_VERSION_AGE=25 | 33 | LIB_VERSION_AGE=27 |
34 | AC_SUBST(LIB_VERSION_CURRENT) | 34 | AC_SUBST(LIB_VERSION_CURRENT) |
35 | AC_SUBST(LIB_VERSION_REVISION) | 35 | AC_SUBST(LIB_VERSION_REVISION) |
36 | AC_SUBST(LIB_VERSION_AGE) | 36 | AC_SUBST(LIB_VERSION_AGE) |
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index de971643..30df9611 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -130,7 +130,7 @@ typedef intptr_t ssize_t; | |||
130 | * Current version of the library. | 130 | * Current version of the library. |
131 | * 0x01093001 = 1.9.30-1. | 131 | * 0x01093001 = 1.9.30-1. |
132 | */ | 132 | */ |
133 | #define MHD_VERSION 0x00093601 | 133 | #define MHD_VERSION 0x00093700 |
134 | 134 | ||
135 | /** | 135 | /** |
136 | * MHD-internal return code for "YES". | 136 | * MHD-internal return code for "YES". |
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c index 7afe2b48..945c3f69 100644 --- a/src/microhttpd/connection.c +++ b/src/microhttpd/connection.c | |||
@@ -149,6 +149,21 @@ MHD_get_connection_values (struct MHD_Connection *connection, | |||
149 | 149 | ||
150 | 150 | ||
151 | /** | 151 | /** |
152 | * Convert all occurences of '+' to ' '. | ||
153 | * | ||
154 | * @param arg string that is modified | ||
155 | */ | ||
156 | static void | ||
157 | escape_plus (char *arg) | ||
158 | { | ||
159 | char *p; | ||
160 | |||
161 | for (p=strchr (arg, '+'); NULL != p; p = strchr (p + 1, '+')) | ||
162 | *p = ' '; | ||
163 | } | ||
164 | |||
165 | |||
166 | /** | ||
152 | * This function can be used to add an entry to the HTTP headers of a | 167 | * This function can be used to add an entry to the HTTP headers of a |
153 | * connection (so that the #MHD_get_connection_values function will | 168 | * connection (so that the #MHD_get_connection_values function will |
154 | * return them -- and the `struct MHD_PostProcessor` will also see | 169 | * return them -- and the `struct MHD_PostProcessor` will also see |
@@ -1175,6 +1190,7 @@ parse_arguments (enum MHD_ValueKind kind, | |||
1175 | if (NULL == equals) | 1190 | if (NULL == equals) |
1176 | { | 1191 | { |
1177 | /* got 'foo', add key 'foo' with NULL for value */ | 1192 | /* got 'foo', add key 'foo' with NULL for value */ |
1193 | escape_plus (args); | ||
1178 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1194 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1179 | connection, | 1195 | connection, |
1180 | args); | 1196 | args); |
@@ -1186,9 +1202,11 @@ parse_arguments (enum MHD_ValueKind kind, | |||
1186 | /* got 'foo=bar' */ | 1202 | /* got 'foo=bar' */ |
1187 | equals[0] = '\0'; | 1203 | equals[0] = '\0'; |
1188 | equals++; | 1204 | equals++; |
1205 | escape_plus (args); | ||
1189 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1206 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1190 | connection, | 1207 | connection, |
1191 | args); | 1208 | args); |
1209 | escape_plus (equals); | ||
1192 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1210 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1193 | connection, | 1211 | connection, |
1194 | equals); | 1212 | equals); |
@@ -1201,6 +1219,7 @@ parse_arguments (enum MHD_ValueKind kind, | |||
1201 | (equals >= amper) ) | 1219 | (equals >= amper) ) |
1202 | { | 1220 | { |
1203 | /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */ | 1221 | /* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */ |
1222 | escape_plus (args); | ||
1204 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1223 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1205 | connection, | 1224 | connection, |
1206 | args); | 1225 | args); |
@@ -1219,9 +1238,11 @@ parse_arguments (enum MHD_ValueKind kind, | |||
1219 | so we got regular 'foo=value&bar...'-kind of argument */ | 1238 | so we got regular 'foo=value&bar...'-kind of argument */ |
1220 | equals[0] = '\0'; | 1239 | equals[0] = '\0'; |
1221 | equals++; | 1240 | equals++; |
1241 | escape_plus (args); | ||
1222 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1242 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1223 | connection, | 1243 | connection, |
1224 | args); | 1244 | args); |
1245 | escape_plus (equals); | ||
1225 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1246 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1226 | connection, | 1247 | connection, |
1227 | equals); | 1248 | equals); |
@@ -1369,11 +1390,9 @@ parse_initial_message_line (struct MHD_Connection *connection, | |||
1369 | args++; | 1390 | args++; |
1370 | parse_arguments (MHD_GET_ARGUMENT_KIND, connection, args); | 1391 | parse_arguments (MHD_GET_ARGUMENT_KIND, connection, args); |
1371 | } | 1392 | } |
1372 | #if 0 | ||
1373 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, | 1393 | connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls, |
1374 | connection, | 1394 | connection, |
1375 | uri); | 1395 | uri); |
1376 | #endif | ||
1377 | connection->url = uri; | 1396 | connection->url = uri; |
1378 | if (NULL == http_version) | 1397 | if (NULL == http_version) |
1379 | connection->version = ""; | 1398 | connection->version = ""; |
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c index 08d20cee..6170fe0a 100644 --- a/src/microhttpd/internal.c +++ b/src/microhttpd/internal.c | |||
@@ -105,7 +105,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...) | |||
105 | 105 | ||
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Process escape sequences ('+'=space, %HH) Updates val in place; the | 108 | * Process escape sequences ('%HH') Updates val in place; the |
109 | * result should be UTF-8 encoded and cannot be larger than the input. | 109 | * result should be UTF-8 encoded and cannot be larger than the input. |
110 | * The result must also still be 0-terminated. | 110 | * The result must also still be 0-terminated. |
111 | * | 111 | * |
@@ -130,11 +130,6 @@ MHD_http_unescape (void *cls, | |||
130 | { | 130 | { |
131 | switch (*rpos) | 131 | switch (*rpos) |
132 | { | 132 | { |
133 | case '+': | ||
134 | *wpos = ' '; | ||
135 | wpos++; | ||
136 | rpos++; | ||
137 | break; | ||
138 | case '%': | 133 | case '%': |
139 | if ( ('\0' == rpos[1]) || | 134 | if ( ('\0' == rpos[1]) || |
140 | ('\0' == rpos[2]) ) | 135 | ('\0' == rpos[2]) ) |