diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-03 15:06:57 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-08-03 15:06:57 +0200 |
commit | bb2d8ad5c542135e515252d20a235b166ae20d97 (patch) | |
tree | e0107ce30fb9077734197a08cd31c29d195e4825 /src/rest/gnunet-rest-server.c | |
parent | bb398bb6b75f7db7c52718618a1cde9bedaf13c9 (diff) | |
download | gnunet-bb2d8ad5c542135e515252d20a235b166ae20d97.tar.gz gnunet-bb2d8ad5c542135e515252d20a235b166ae20d97.zip |
- fix postdata iterator
Diffstat (limited to 'src/rest/gnunet-rest-server.c')
-rw-r--r-- | src/rest/gnunet-rest-server.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index 1bf4b332e..57a42b029 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c | |||
@@ -321,19 +321,25 @@ post_data_iter (void *cls, | |||
321 | return MHD_YES; | 321 | return MHD_YES; |
322 | 322 | ||
323 | GNUNET_CRYPTO_hash (key, strlen (key), &hkey); | 323 | GNUNET_CRYPTO_hash (key, strlen (key), &hkey); |
324 | GNUNET_asprintf (&val, "%s", data); | 324 | val = GNUNET_CONTAINER_multihashmap_get (handle->url_param_map, |
325 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put ( | 325 | &hkey); |
326 | if (NULL == val) | ||
327 | { | ||
328 | val = GNUNET_malloc (65536); | ||
329 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put ( | ||
326 | handle->url_param_map, | 330 | handle->url_param_map, |
327 | &hkey, | 331 | &hkey, |
328 | val, | 332 | val, |
329 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) | 333 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)) |
330 | { | 334 | { |
331 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 335 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
332 | "Could not load add url param '%s'=%s\n", | 336 | "Could not add url param '%s'\n", |
333 | key, | 337 | key, |
334 | data); | 338 | data); |
335 | GNUNET_free (val); | 339 | GNUNET_free (val); |
340 | } | ||
336 | } | 341 | } |
342 | memcpy (val + off, data, size); | ||
337 | return MHD_YES; | 343 | return MHD_YES; |
338 | } | 344 | } |
339 | 345 | ||
@@ -428,12 +434,8 @@ create_response (void *cls, | |||
428 | MHD_HEADER_KIND, | 434 | MHD_HEADER_KIND, |
429 | (MHD_KeyValueIterator) & header_iterator, | 435 | (MHD_KeyValueIterator) & header_iterator, |
430 | rest_conndata_handle); | 436 | rest_conndata_handle); |
431 | MHD_get_connection_values (con, | ||
432 | MHD_POSTDATA_KIND, | ||
433 | (MHD_KeyValueIterator) &post_data_iter, | ||
434 | rest_conndata_handle); | ||
435 | 437 | ||
436 | /*con_handle->pp = MHD_create_post_processor (con, | 438 | con_handle->pp = MHD_create_post_processor (con, |
437 | 65536, | 439 | 65536, |
438 | &post_data_iter, | 440 | &post_data_iter, |
439 | rest_conndata_handle); | 441 | rest_conndata_handle); |
@@ -441,7 +443,7 @@ create_response (void *cls, | |||
441 | { | 443 | { |
442 | MHD_post_process (con_handle->pp, upload_data, *upload_data_size); | 444 | MHD_post_process (con_handle->pp, upload_data, *upload_data_size); |
443 | } | 445 | } |
444 | MHD_destroy_post_processor (con_handle->pp);*/ | 446 | MHD_destroy_post_processor (con_handle->pp); |
445 | 447 | ||
446 | con_handle->state = GN_REST_STATE_PROCESSING; | 448 | con_handle->state = GN_REST_STATE_PROCESSING; |
447 | con_handle->plugin->process_request (rest_conndata_handle, | 449 | con_handle->plugin->process_request (rest_conndata_handle, |