[Asterisk-code-review] res ari: Remove requirement that body exists when debug is on. (asterisk[15])
Jenkins2
asteriskteam at digium.com
Fri May 4 06:15:32 CDT 2018
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8913 )
Change subject: res_ari: Remove requirement that body exists when debug is on.
......................................................................
res_ari: Remove requirement that body exists when debug is on.
The "ari set debug" code for incoming requests incorrectly assumed
that all requests would contain a body. If one did not exist the
request would be incorrectly rejected. The response that was sent
was also incomplete as an incorrect function was used to construct
the response.
The code has now been changed to no longer require a request to have
a body and the response updated to use the correct function.
ASTERISK-27801
Change-Id: I4eef036ad54550a4368118cc348765ecac25e0f8
---
M res/res_ari.c
1 file changed, 3 insertions(+), 3 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/res/res_ari.c b/res/res_ari.c
index 9104ede..8a01809 100644
--- a/res/res_ari.c
+++ b/res/res_ari.c
@@ -985,9 +985,9 @@
struct ast_str *buf = ast_str_create(512);
char *str = ast_json_dump_string_format(body, ast_ari_json_format());
- if (!buf || !str) {
+ if (!buf || (body && !str)) {
ast_http_request_close_on_completion(ser);
- ast_http_error(ser, 500, "Server Error", "Out of memory");
+ ast_ari_response_error(&response, 500, "Server Error", "Out of memory");
ast_json_free(str);
ast_free(buf);
goto request_failed;
@@ -1001,7 +1001,7 @@
for (var = get_params; var; var = var->next) {
ast_str_append(&buf, 0, "%s: %s\n", var->name, var->value);
}
- ast_verbose("%sbody:\n%s\n\n", ast_str_buffer(buf), str);
+ ast_verbose("%sbody:\n%s\n\n", ast_str_buffer(buf), S_OR(str, ""));
ast_json_free(str);
ast_free(buf);
}
--
To view, visit https://gerrit.asterisk.org/8913
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I4eef036ad54550a4368118cc348765ecac25e0f8
Gerrit-Change-Number: 8913
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180504/00b92e24/attachment.html>
More information about the asterisk-code-review
mailing list