commit 1f4a53507e325cfdc48e3024e00c59f7e721faba
parent fd764222b83142d78879290547fcd415744c8cb9
Author: Christian Grothoff <christian@grothoff.org>
Date: Sun, 1 Jun 2014 22:08:47 +0000
fix #3413
Diffstat:
5 files changed, 35 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,12 @@
+Mon Jun 2 00:03:28 CEST 2014
+ Added back unescaping for URI path (#3413) but without
+ unescaping '+' (#3371) to remain compatible with
+ MHD 0.9.34 and before. Note that applications providing
+ a custom MHD_OPTION_UNESCAPE_CALLBACK are no longer expected
+ to replace '+' with ' ', as that is now done separately for
+ the locations where this transformation is appropriate.
+ Releasing 0.9.37. -CG
+
Wed May 28 15:30:56 CEST 2014
Properly applying patch that was supposed to be
committed on "May 2 20:22:45 CEST 2014" to address
diff --git a/configure.ac b/configure.ac
@@ -22,15 +22,15 @@
#
AC_PREREQ([2.60])
LT_PREREQ([2.4.0])
-AC_INIT([libmicrohttpd],[0.9.36],[libmicrohttpd@gnu.org])
+AC_INIT([libmicrohttpd],[0.9.37],[libmicrohttpd@gnu.org])
AM_INIT_AUTOMAKE([silent-rules] [subdir-objects])
AC_CONFIG_HEADERS([MHD_config.h])
AC_CONFIG_MACRO_DIR([m4])
AH_TOP([#define _GNU_SOURCE 1])
-LIB_VERSION_CURRENT=35
+LIB_VERSION_CURRENT=37
LIB_VERSION_REVISION=0
-LIB_VERSION_AGE=25
+LIB_VERSION_AGE=27
AC_SUBST(LIB_VERSION_CURRENT)
AC_SUBST(LIB_VERSION_REVISION)
AC_SUBST(LIB_VERSION_AGE)
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
@@ -130,7 +130,7 @@ typedef intptr_t ssize_t;
* Current version of the library.
* 0x01093001 = 1.9.30-1.
*/
-#define MHD_VERSION 0x00093601
+#define MHD_VERSION 0x00093700
/**
* MHD-internal return code for "YES".
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
@@ -149,6 +149,21 @@ MHD_get_connection_values (struct MHD_Connection *connection,
/**
+ * Convert all occurences of '+' to ' '.
+ *
+ * @param arg string that is modified
+ */
+static void
+escape_plus (char *arg)
+{
+ char *p;
+
+ for (p=strchr (arg, '+'); NULL != p; p = strchr (p + 1, '+'))
+ *p = ' ';
+}
+
+
+/**
* This function can be used to add an entry to the HTTP headers of a
* connection (so that the #MHD_get_connection_values function will
* return them -- and the `struct MHD_PostProcessor` will also see
@@ -1175,6 +1190,7 @@ parse_arguments (enum MHD_ValueKind kind,
if (NULL == equals)
{
/* got 'foo', add key 'foo' with NULL for value */
+ escape_plus (args);
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
args);
@@ -1186,9 +1202,11 @@ parse_arguments (enum MHD_ValueKind kind,
/* got 'foo=bar' */
equals[0] = '\0';
equals++;
+ escape_plus (args);
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
args);
+ escape_plus (equals);
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
equals);
@@ -1201,6 +1219,7 @@ parse_arguments (enum MHD_ValueKind kind,
(equals >= amper) )
{
/* got 'foo&bar' or 'foo&bar=val', add key 'foo' with NULL for value */
+ escape_plus (args);
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
args);
@@ -1219,9 +1238,11 @@ parse_arguments (enum MHD_ValueKind kind,
so we got regular 'foo=value&bar...'-kind of argument */
equals[0] = '\0';
equals++;
+ escape_plus (args);
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
args);
+ escape_plus (equals);
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
equals);
@@ -1369,11 +1390,9 @@ parse_initial_message_line (struct MHD_Connection *connection,
args++;
parse_arguments (MHD_GET_ARGUMENT_KIND, connection, args);
}
-#if 0
connection->daemon->unescape_callback (connection->daemon->unescape_callback_cls,
connection,
uri);
-#endif
connection->url = uri;
if (NULL == http_version)
connection->version = "";
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
@@ -105,7 +105,7 @@ MHD_DLOG (const struct MHD_Daemon *daemon, const char *format, ...)
/**
- * Process escape sequences ('+'=space, %HH) Updates val in place; the
+ * Process escape sequences ('%HH') Updates val in place; the
* result should be UTF-8 encoded and cannot be larger than the input.
* The result must also still be 0-terminated.
*
@@ -130,11 +130,6 @@ MHD_http_unescape (void *cls,
{
switch (*rpos)
{
- case '+':
- *wpos = ' ';
- wpos++;
- rpos++;
- break;
case '%':
if ( ('\0' == rpos[1]) ||
('\0' == rpos[2]) )