allow binary zero in unescaped GET arguments (see mailinglist)

This commit is contained in:
Christian Grothoff
2019-03-20 10:46:21 +01:00
parent e2c268e379
commit 1b610e5b13
11 changed files with 214 additions and 64 deletions
+12 -5
View File
@@ -15,11 +15,16 @@
static int
print_out_key (void *cls, enum MHD_ValueKind kind, const char *key,
const char *value)
print_out_key (void *cls,
enum MHD_ValueKind kind,
const char *key,
const char *value,
size_t value_size)
{
(void)cls; /* Unused. Silent compiler warning. */
(void)kind; /* Unused. Silent compiler warning. */
(void) cls; /* Unused. Silent compiler warning. */
(void) kind; /* Unused. Silent compiler warning. */
(void) value_size;
printf ("%s: %s\n", key, value);
return MHD_YES;
}
@@ -38,7 +43,9 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
(void)con_cls; /* Unused. Silent compiler warning. */
printf ("New %s request for %s using version %s\n", method, url, version);
MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key,
MHD_get_connection_values (connection,
MHD_HEADER_KIND,
&print_out_key,
NULL);
return MHD_NO;
+12 -1
View File
@@ -1356,7 +1356,7 @@ reason for request termination see @code{MHD_OPTION_NOTIFY_COMPLETED}.
@end deftypefn
@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t value_size)
Iterator over key-value pairs. This iterator can be used to iterate
over all of the cookies, headers, or @code{POST}-data fields of a
request, and also to iterate over the headers that have been added to a
@@ -1375,6 +1375,17 @@ key for the value, can be an empty string
@item value
value corresponding value, can be NULL
@item value_size
number of bytes in @code{value}. This argument was introduced in
@code{MHD_VERSION} 0x00096301 to allow applications to use binary
zeros in values. Applications using this argument must ensure that
they are using a sufficiently recent version of MHD, i.e. by testing
@code{MHD_get_version()} for values above or equal to 0.9.64.
Applications that do not need zeros in values and that want to compile
without warnings against newer versions of MHD should not declare this
argument and cast the function pointer argument to
@code{MHD_KeyValueIterator}.
@end table
Return @code{MHD_YES} to continue iterating, @code{MHD_NO} to abort the