aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/connection.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/connection.c')
-rw-r--r--src/microhttpd/connection.c23
1 files changed, 21 insertions, 2 deletions
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 */
156static void
157escape_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 = "";