Christian Grothoff 11 gadi atpakaļ
vecāks
revīzija
1f4a53507e
5 mainītis faili ar 35 papildinājumiem un 12 dzēšanām
  1. 9 0
      ChangeLog
  2. 3 3
      configure.ac
  3. 1 1
      src/include/microhttpd.h
  4. 21 2
      src/microhttpd/connection.c
  5. 1 6
      src/microhttpd/internal.c

+ 9 - 0
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

+ 3 - 3
configure.ac

@@ -22,15 +22,15 @@
 #
 AC_PREREQ([2.60])
 LT_PREREQ([2.4.0])
-AC_INIT([libmicrohttpd],[0.9.36],[[email protected]])
+AC_INIT([libmicrohttpd],[0.9.37],[[email protected]])
 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)

+ 1 - 1
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".

+ 21 - 2
src/microhttpd/connection.c

@@ -148,6 +148,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
@@ -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 = "";

+ 1 - 6
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]) )