gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r25972 - in libmicrohttpd: . src/daemon


From: gnunet
Subject: [GNUnet-SVN] r25972 - in libmicrohttpd: . src/daemon
Date: Fri, 1 Feb 2013 10:20:40 +0100

Author: grothoff
Date: 2013-02-01 10:20:40 +0100 (Fri, 01 Feb 2013)
New Revision: 25972

Modified:
   libmicrohttpd/ChangeLog
   libmicrohttpd/src/daemon/postprocessor.c
   libmicrohttpd/src/daemon/postprocessor_test.c
Log:
fix #2733

Modified: libmicrohttpd/ChangeLog
===================================================================
--- libmicrohttpd/ChangeLog     2013-02-01 09:01:10 UTC (rev 25971)
+++ libmicrohttpd/ChangeLog     2013-02-01 09:20:40 UTC (rev 25972)
@@ -1,3 +1,8 @@
+Fri Feb  1 10:19:44 CET 2013
+       Handle case where POST data contains "key=" without value
+       at the end and is not new-line terminated by invoking the
+       callback with the "key" during MHD_destroy_post_processor (#2733). -CG
+
 Wed Jan 30 13:09:30 CET 2013
        Adding more 'const' to allow keeping of reason phrases in ROM.
        (see mailinglist). -CG/MV

Modified: libmicrohttpd/src/daemon/postprocessor.c
===================================================================
--- libmicrohttpd/src/daemon/postprocessor.c    2013-02-01 09:01:10 UTC (rev 
25971)
+++ libmicrohttpd/src/daemon/postprocessor.c    2013-02-01 09:20:40 UTC (rev 
25972)
@@ -1062,6 +1062,13 @@
 
   if (NULL == pp)
     return MHD_YES;
+  if (PP_ProcessValue == pp->state)
+  {
+    /* key without terminated value left at the end of the
+       buffer; fake receiving a termination character to
+       ensure it is also processed */
+    post_process_urlencoded (pp, "\n", 1);
+  }
   /* These internal strings need cleaning up since
      the post-processing may have been interrupted
      at any stage */

Modified: libmicrohttpd/src/daemon/postprocessor_test.c
===================================================================
--- libmicrohttpd/src/daemon/postprocessor_test.c       2013-02-01 09:01:10 UTC 
(rev 25971)
+++ libmicrohttpd/src/daemon/postprocessor_test.c       2013-02-01 09:20:40 UTC 
(rev 25972)
@@ -60,11 +60,12 @@
   "pics", "file2.gif", "image/gif", "binary", "filedata2",
 #define FORM_NESTED_END (FORM_NESTED_START + 15)
   NULL, NULL, NULL, NULL, NULL,
-#define URL_EMPTY_VALUE_DATA "key1=value1&key2="
+#define URL_EMPTY_VALUE_DATA "key1=value1&key2=&key3="
 #define URL_EMPTY_VALUE_START (FORM_NESTED_END + 5)
   "key1", NULL, NULL, NULL, "value1",
-  "key2", NULL, NULL, NULL, NULL,
-#define URL_EMPTY_VALUE_END (URL_EMPTY_VALUE_START + 10)
+  "key2", NULL, NULL, NULL, "",
+  "key3", NULL, NULL, NULL, "",
+#define URL_EMPTY_VALUE_END (URL_EMPTY_VALUE_START + 15)
   NULL, NULL, NULL, NULL, NULL
 };
 
@@ -95,8 +96,8 @@
            "VC: `%s' `%s' `%s' `%s' `%.*s'\n",
            key, filename, content_type, transfer_encoding, size, data);
 #endif
-  if (size == 0)
-    return MHD_YES;
+  if ( (0 != off) && (0 == size) )
+    return MHD_YES; 
   if ((idx < 0) ||
       (want[idx] == NULL) ||
       (0 != strcmp (key, want[idx])) ||




reply via email to

[Prev in Thread] Current Thread [Next in Thread]