rc = doveadm_http_server_istream_read(conn);
if (rc != 1) return rc;
conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY;
- return json_parse_next(conn->json_parser, type, value);
} else if (conn->json_state == JSON_STATE_COMMAND_PARAMETER_VALUE_ARRAY) {
/* reading through parameters in an array */
while ((rc = json_parse_next(conn->json_parser, type, value)) > 0) {
- if (*type == JSON_TYPE_ARRAY_END) {
- conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY;
- return json_parse_next(conn->json_parser, type, value);
- }
+ if (*type == JSON_TYPE_ARRAY_END)
+ break;
if (*type != JSON_TYPE_STRING)
return -2;
tmp = p_strdup(conn->client.pool,*value);
array_append(&conn->cmd_param->value.v_array, &tmp, 1);
}
- return rc;
+ if (rc <= 0)
+ return rc;
+ conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY;
} else if (conn->json_state == JSON_STATE_COMMAND_PARAMETER_VALUE) {
if (conn->cmd_param->type == CMD_PARAM_ISTREAM) {
- if (conn->cmd_param->value_set == TRUE)
- return json_parse_next(conn->json_parser, type, value);
struct istream* is[2] = {0};
rc = json_parse_next_stream(conn->json_parser, &is[0]);
if (rc != 1) return rc;
}
tmp = p_strdup(conn->client.pool,*value);
array_append(&conn->cmd_param->value.v_array, &tmp, 1);
- conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY;
- return json_parse_next(conn->json_parser, type, value);
} else {
conn->cmd_param->value_set = TRUE;
switch(conn->cmd_param->type) {
break;
}
}
- rc = json_parse_next(conn->json_parser, type, value);
conn->json_state = JSON_STATE_COMMAND_PARAMETER_KEY;
- return rc;
- } else {
- rc = json_parse_next(conn->json_parser, type, value); /* just get next */
- return rc;
}
+ return json_parse_next(conn->json_parser, type, value); /* just get next */
}
static void