summaryrefslogtreecommitdiff
path: root/res/res_ari_applications.c
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_ari_applications.c')
-rw-r--r--res/res_ari_applications.c42
1 files changed, 4 insertions, 38 deletions
diff --git a/res/res_ari_applications.c b/res/res_ari_applications.c
index 7ce9722fd..f2b5b8e52 100644
--- a/res/res_ari_applications.c
+++ b/res/res_ari_applications.c
@@ -62,10 +62,9 @@ ASTERISK_REGISTER_FILE()
static void ast_ari_applications_list_cb(
struct ast_tcptls_session_instance *ser,
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct ast_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_applications_list_args args = {};
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -113,11 +112,10 @@ fin: __attribute__((unused))
static void ast_ari_applications_get_cb(
struct ast_tcptls_session_instance *ser,
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct ast_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_applications_get_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -210,11 +208,10 @@ int ast_ari_applications_subscribe_parse_body(
static void ast_ari_applications_subscribe_cb(
struct ast_tcptls_session_instance *ser,
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct ast_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_applications_subscribe_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -272,21 +269,6 @@ static void ast_ari_applications_subscribe_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_applications_subscribe_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;
@@ -376,11 +358,10 @@ int ast_ari_applications_unsubscribe_parse_body(
static void ast_ari_applications_unsubscribe_cb(
struct ast_tcptls_session_instance *ser,
struct ast_variable *get_params, struct ast_variable *path_vars,
- struct ast_variable *headers, struct ast_ari_response *response)
+ struct ast_variable *headers, struct ast_json *body, struct ast_ari_response *response)
{
struct ast_ari_applications_unsubscribe_args args = {};
struct ast_variable *i;
- RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
#if defined(AST_DEVMODE)
int is_valid;
int code;
@@ -438,21 +419,6 @@ static void ast_ari_applications_unsubscribe_cb(
} else
{}
}
- /* Look for a JSON request entity */
- body = ast_http_get_json(ser, headers);
- if (!body) {
- switch (errno) {
- case EFBIG:
- ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
- goto fin;
- case ENOMEM:
- ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
- goto fin;
- case EIO:
- ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
- goto fin;
- }
- }
if (ast_ari_applications_unsubscribe_parse_body(body, &args)) {
ast_ari_response_alloc_failed(response);
goto fin;