diff options
Diffstat (limited to 'src/backend/anastasis-httpd_policy_upload.c')
-rw-r--r-- | src/backend/anastasis-httpd_policy_upload.c | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/src/backend/anastasis-httpd_policy_upload.c b/src/backend/anastasis-httpd_policy_upload.c index b63a82e..2cc0389 100644 --- a/src/backend/anastasis-httpd_policy_upload.c +++ b/src/backend/anastasis-httpd_policy_upload.c @@ -86,6 +86,16 @@ struct PolicyUploadContext char *upload; /** + * Meta data uploaded by the client, or NULL for none. + */ + void *meta_data; + + /** + * Number of bytes in @e meta_data. + */ + size_t meta_data_size; + + /** * Used while we are awaiting proposal creation. */ struct TALER_MERCHANT_PostOrdersHandle *po; @@ -220,6 +230,7 @@ cleanup_ctx (struct TM_HandlerContext *hc) if (NULL != puc->resp) MHD_destroy_response (puc->resp); GNUNET_free (puc->upload); + GNUNET_free (puc->meta_data); GNUNET_free (puc); } @@ -680,6 +691,32 @@ AH_handler_policy_post ( } } puc->account = *account_pub; + + /* check for meta-data */ + { + const char *metas; + + metas = MHD_lookup_connection_value (connection, + MHD_HEADER_KIND, + ANASTASIS_HTTP_HEADER_POLICY_META_DATA); + if (NULL != metas) + { + if (GNUNET_OK != + GNUNET_STRINGS_string_to_data_alloc (metas, + strlen (metas), + &puc->meta_data, + &puc->meta_data_size)) + { + GNUNET_break_op (0); + return TALER_MHD_reply_with_error ( + connection, + MHD_HTTP_BAD_REQUEST, + TALER_EC_GENERIC_HTTP_HEADERS_MALFORMED, + ANASTASIS_HTTP_HEADER_POLICY_META_DATA + " header must include a base32-encoded value"); + } + } + } /* now setup 'puc' */ { const char *lens; @@ -1121,8 +1158,8 @@ AH_handler_policy_post ( &puc->new_policy_upload_hash, puc->upload, puc->upload_size, - NULL, /* FIXME: meta-data! */ - 0, + puc->meta_data, + puc->meta_data_size, &puc->payment_identifier, &version); GNUNET_snprintf (version_s, |