[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r25971 - libmicrohttpd/src/daemon
From: |
gnunet |
Subject: |
[GNUnet-SVN] r25971 - libmicrohttpd/src/daemon |
Date: |
Fri, 1 Feb 2013 10:01:10 +0100 |
Author: grothoff
Date: 2013-02-01 10:01:10 +0100 (Fri, 01 Feb 2013)
New Revision: 25971
Modified:
libmicrohttpd/src/daemon/postprocessor_test.c
Log:
testcase for #2733
Modified: libmicrohttpd/src/daemon/postprocessor_test.c
===================================================================
--- libmicrohttpd/src/daemon/postprocessor_test.c 2013-02-01 08:48:47 UTC
(rev 25970)
+++ libmicrohttpd/src/daemon/postprocessor_test.c 2013-02-01 09:01:10 UTC
(rev 25971)
@@ -60,6 +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_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)
+ NULL, NULL, NULL, NULL, NULL
};
static int
@@ -212,6 +218,43 @@
return 0;
}
+
+static int
+test_empty_value ()
+{
+ struct MHD_Connection connection;
+ struct MHD_HTTP_Header header;
+ struct MHD_PostProcessor *pp;
+ unsigned int want_off = URL_EMPTY_VALUE_START;
+ int i;
+ int delta;
+ size_t size;
+
+ memset (&connection, 0, sizeof (struct MHD_Connection));
+ memset (&header, 0, sizeof (struct MHD_HTTP_Header));
+ connection.headers_received = &header;
+ header.header = MHD_HTTP_HEADER_CONTENT_TYPE;
+ header.value = MHD_HTTP_POST_ENCODING_FORM_URLENCODED;
+ header.kind = MHD_HEADER_KIND;
+ pp = MHD_create_post_processor (&connection,
+ 1024, &value_checker, &want_off);
+ i = 0;
+ size = strlen (URL_EMPTY_VALUE_DATA);
+ while (i < size)
+ {
+ delta = 1 + RANDOM () % (size - i);
+ MHD_post_process (pp, &URL_EMPTY_VALUE_DATA[i], delta);
+ i += delta;
+ }
+ MHD_destroy_post_processor (pp);
+ if (want_off != URL_EMPTY_VALUE_END)
+ return 8;
+ return 0;
+}
+
+
+
+
int
main (int argc, char *const *argv)
{
@@ -220,6 +263,7 @@
errorCount += test_urlencoding ();
errorCount += test_multipart ();
errorCount += test_nested_multipart ();
+ errorCount += test_empty_value ();
if (errorCount != 0)
fprintf (stderr, "Error (code: %u)\n", errorCount);
return errorCount != 0; /* 0 == pass */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r25971 - libmicrohttpd/src/daemon,
gnunet <=