diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/daemon/postprocessor.c | 7 | ||||
-rw-r--r-- | src/daemon/postprocessor_test.c | 11 |
3 files changed, 18 insertions, 5 deletions
@@ -1,3 +1,8 @@ | |||
1 | Fri Feb 1 10:19:44 CET 2013 | ||
2 | Handle case where POST data contains "key=" without value | ||
3 | at the end and is not new-line terminated by invoking the | ||
4 | callback with the "key" during MHD_destroy_post_processor (#2733). -CG | ||
5 | |||
1 | Wed Jan 30 13:09:30 CET 2013 | 6 | Wed Jan 30 13:09:30 CET 2013 |
2 | Adding more 'const' to allow keeping of reason phrases in ROM. | 7 | Adding more 'const' to allow keeping of reason phrases in ROM. |
3 | (see mailinglist). -CG/MV | 8 | (see mailinglist). -CG/MV |
diff --git a/src/daemon/postprocessor.c b/src/daemon/postprocessor.c index b93816ee..9be5e68f 100644 --- a/src/daemon/postprocessor.c +++ b/src/daemon/postprocessor.c | |||
@@ -1062,6 +1062,13 @@ MHD_destroy_post_processor (struct MHD_PostProcessor *pp) | |||
1062 | 1062 | ||
1063 | if (NULL == pp) | 1063 | if (NULL == pp) |
1064 | return MHD_YES; | 1064 | return MHD_YES; |
1065 | if (PP_ProcessValue == pp->state) | ||
1066 | { | ||
1067 | /* key without terminated value left at the end of the | ||
1068 | buffer; fake receiving a termination character to | ||
1069 | ensure it is also processed */ | ||
1070 | post_process_urlencoded (pp, "\n", 1); | ||
1071 | } | ||
1065 | /* These internal strings need cleaning up since | 1072 | /* These internal strings need cleaning up since |
1066 | the post-processing may have been interrupted | 1073 | the post-processing may have been interrupted |
1067 | at any stage */ | 1074 | at any stage */ |
diff --git a/src/daemon/postprocessor_test.c b/src/daemon/postprocessor_test.c index 6042a8f4..f470024a 100644 --- a/src/daemon/postprocessor_test.c +++ b/src/daemon/postprocessor_test.c | |||
@@ -60,11 +60,12 @@ const char *want[] = { | |||
60 | "pics", "file2.gif", "image/gif", "binary", "filedata2", | 60 | "pics", "file2.gif", "image/gif", "binary", "filedata2", |
61 | #define FORM_NESTED_END (FORM_NESTED_START + 15) | 61 | #define FORM_NESTED_END (FORM_NESTED_START + 15) |
62 | NULL, NULL, NULL, NULL, NULL, | 62 | NULL, NULL, NULL, NULL, NULL, |
63 | #define URL_EMPTY_VALUE_DATA "key1=value1&key2=" | 63 | #define URL_EMPTY_VALUE_DATA "key1=value1&key2=&key3=" |
64 | #define URL_EMPTY_VALUE_START (FORM_NESTED_END + 5) | 64 | #define URL_EMPTY_VALUE_START (FORM_NESTED_END + 5) |
65 | "key1", NULL, NULL, NULL, "value1", | 65 | "key1", NULL, NULL, NULL, "value1", |
66 | "key2", NULL, NULL, NULL, NULL, | 66 | "key2", NULL, NULL, NULL, "", |
67 | #define URL_EMPTY_VALUE_END (URL_EMPTY_VALUE_START + 10) | 67 | "key3", NULL, NULL, NULL, "", |
68 | #define URL_EMPTY_VALUE_END (URL_EMPTY_VALUE_START + 15) | ||
68 | NULL, NULL, NULL, NULL, NULL | 69 | NULL, NULL, NULL, NULL, NULL |
69 | }; | 70 | }; |
70 | 71 | ||
@@ -95,8 +96,8 @@ value_checker (void *cls, | |||
95 | "VC: `%s' `%s' `%s' `%s' `%.*s'\n", | 96 | "VC: `%s' `%s' `%s' `%s' `%.*s'\n", |
96 | key, filename, content_type, transfer_encoding, size, data); | 97 | key, filename, content_type, transfer_encoding, size, data); |
97 | #endif | 98 | #endif |
98 | if (size == 0) | 99 | if ( (0 != off) && (0 == size) ) |
99 | return MHD_YES; | 100 | return MHD_YES; |
100 | if ((idx < 0) || | 101 | if ((idx < 0) || |
101 | (want[idx] == NULL) || | 102 | (want[idx] == NULL) || |
102 | (0 != strcmp (key, want[idx])) || | 103 | (0 != strcmp (key, want[idx])) || |