aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-06-21 23:05:51 +0200
committerChristian Grothoff <christian@grothoff.org>2020-07-05 16:50:14 +0200
commit25ecc97717490a0ee149cc0af5cec07e764d1acb (patch)
tree71397533b7f0ed4e4e8e5b20dc3242c76b822d7a /src/include
parenta54757de661b7debeec9d2057357eab118deb5bc (diff)
add TALER_MHD_parse_internal_json_data()
Diffstat (limited to 'src/include')
-rw-r--r--src/include/taler_mhd_lib.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/include/taler_mhd_lib.h b/src/include/taler_mhd_lib.h
index 71006e8bc..8cfb80721 100644
--- a/src/include/taler_mhd_lib.h
+++ b/src/include/taler_mhd_lib.h
@@ -264,7 +264,8 @@ TALER_MHD_parse_post_cleanup_callback (void *con_cls);
/**
* Parse JSON object into components based on the given field
- * specification.
+ * specification. If parsing fails, we return an HTTP
+ * status code of 400 (#MHD_HTTP_BAD_REQUEST).
*
* @param connection the connection to send an error response to
* @param root the JSON node to start the navigation at.
@@ -283,6 +284,30 @@ TALER_MHD_parse_json_data (struct MHD_Connection *connection,
/**
+ * Parse JSON object that we (the server!) generated into components based on
+ * the given field specification. The difference to
+ * #TALER_MHD_parse_json_data() is that this function will fail
+ * with an HTTP failure of 500 (internal server error) in case
+ * parsing fails, instead of blaming it on the client with a
+ * 400 (#MHD_HTTP_BAD_REQUEST).
+ *
+ * @param connection the connection to send an error response to
+ * @param root the JSON node to start the navigation at.
+ * @param spec field specification for the parser
+ * @return
+ * #GNUNET_YES if navigation was successful (caller is responsible
+ * for freeing allocated variable-size data using
+ * GNUNET_JSON_parse_free() when done)
+ * #GNUNET_NO if json is malformed, error response was generated
+ * #GNUNET_SYSERR on internal error
+ */
+enum GNUNET_GenericReturnValue
+TALER_MHD_parse_internal_json_data (struct MHD_Connection *connection,
+ const json_t *root,
+ struct GNUNET_JSON_Specification *spec);
+
+
+/**
* Parse JSON array into components based on the given field
* specification. Generates error response on parse errors.
*