[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [libmicrohttpd] 01/02: test_postprocessor_amp: fixed to rea
From: |
gnunet |
Subject: |
[GNUnet-SVN] [libmicrohttpd] 01/02: test_postprocessor_amp: fixed to really test something |
Date: |
Fri, 03 May 2019 17:12:04 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd.
commit 9631f33bdf935e9ef572977a7d5387a732453972
Author: Evgeny Grin (Karlson2k) <address@hidden>
AuthorDate: Fri May 3 17:56:35 2019 +0300
test_postprocessor_amp: fixed to really test something
---
src/microhttpd/test_postprocessor_amp.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/microhttpd/test_postprocessor_amp.c
b/src/microhttpd/test_postprocessor_amp.c
index ef271810..fff56b21 100644
--- a/src/microhttpd/test_postprocessor_amp.c
+++ b/src/microhttpd/test_postprocessor_amp.c
@@ -5,6 +5,7 @@
#include <string.h>
#include <stdio.h>
+uint64_t num_errors;
int check_post(void *cls, enum MHD_ValueKind kind, const char* key,
const char* filename, const char* content_type,
@@ -16,6 +17,7 @@ int check_post(void *cls, enum MHD_ValueKind kind, const
char* key,
if ((0 != strcmp(key, "a")) && (0 != strcmp(key, "b")))
{
printf("ERROR: got unexpected '%s'\n", key);
+ num_errors++;
}
return MHD_YES;
@@ -30,6 +32,7 @@ main (int argc, char *const *argv)
struct MHD_PostProcessor *pp;
(void)argc; (void)argv; /* Unused. Silent compiler warning. */
+ num_errors = 0;
memset (&connection, 0, sizeof (struct MHD_Connection));
memset (&header, 0, sizeof (struct MHD_HTTP_Header));
connection.headers_received = &header;
@@ -39,12 +42,15 @@ main (int argc, char *const *argv)
pp = MHD_create_post_processor (&connection,
4096, &check_post, NULL);
+ if (NULL == pp)
+ return 1;
const char* post =
"a=xx+xx+xxx+xxxxx+xxxx+xxxxxxxx+xxx+xxxxxx+xxx+xxx+xxxxxxx+xxxxx%0A+++++++xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx%0A+++++++--%3E%0A++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++%3Cxx%3E%0A+++++++++++++++%3Cxx+xxxxxxx%3D%22x%22+xxxxx%3D%22xxxxx%22%3E%0A+++++++++++++++++++%3Cxxxxx+xxxxx%3D%22xxx%25%22%3E%0A+++++++++++++++++++++++%3Cxx%3E%0A+++++++++++++++++++++++++++%3Cxx+xxxxx%3D%22xxxx%22%3E%0A++++++++++++++++++
[...]
- MHD_post_process (pp, post, strlen(post));
+ if (MHD_YES != MHD_post_process (pp, post, strlen(post)))
+ num_errors++;
MHD_destroy_post_processor (pp);
- return 0;
+ return num_errors == 0 ? 0 : 2;
}
--
To stop receiving notification emails like this one, please contact
address@hidden