Hey all,
I'm a new-ish user of libmicrohttpd and have over the past couple weeks
ventured for the first time into using POST data.
I'm implementing a server that has thusfar only used GET and we were getting
all of the key-value pairs using MHD_get_connection_values. Something like:
typedef std::pair<std::string, std::string> TArg;
typedef std::vector<TArg> TArgs;
static int _get_params (void *cls, enum MHD_ValueKind , const char *key, const
char *data)
{
TArgs* args = (TArgs*)cls;
TArg arg(key, (data ? data : ""));
args->push_back (arg);
return MHD_YES;
}
and then in the answer callback passed to MHD_start_daemon, there's a line:
TArgs args;
MHD_get_connection_values (connection, t, _get_params, &args);
Ensuring that _get_params will be iterated over to get all the values and stock
them in TArgs.
All of this works well in GET and we'd like to set up the same thing in POST.
However, reading over POST, I don't see a clean way to iterate over keys and
values in the same manner. I've followed through the tutorials and can create
postprocessors for single keys that handle uploads of large chunks of data, but
I can't figure out how to do the above sort of manipulation. Does anyone have
any intuition about how the above could be done via POST?
Cheers,
Mike