[asterisk-commits] dlee: branch dlee/stasis-http r380577 - /team/dlee/stasis-http/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 30 16:04:08 CST 2013


Author: dlee
Date: Wed Jan 30 16:04:05 2013
New Revision: 380577

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=380577
Log:
Better handle incoming empty messages

Modified:
    team/dlee/stasis-http/res/res_stasis_http.c

Modified: team/dlee/stasis-http/res/res_stasis_http.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/res/res_stasis_http.c?view=diff&rev=380577&r1=380576&r2=380577
==============================================================================
--- team/dlee/stasis-http/res/res_stasis_http.c (original)
+++ team/dlee/stasis-http/res/res_stasis_http.c Wed Jan 30 16:04:05 2013
@@ -378,7 +378,7 @@
 	id = ast_json_integer_get(id_json);
 
 	if (ast_strlen_zero(command)) {
-		return build_err(id, "Missing command");
+		return build_err(id, "Missing command string");
 	}
 
 	if (strcmp("ActivateApplication", command) == 0) {
@@ -436,12 +436,13 @@
 
 			if (req == NULL) {
 				/* Parse error */
-				resp = ast_json_pack("{ s: { s: o, s: i, s: i, s: o } }",
+				RAII_VAR(char *, payloadz, ast_strndup(payload, payload_len), ast_free);
+				resp = ast_json_pack("{ s: { s: o, s: i, s: i, s: s } }",
 						     "error",
 						     "message", ast_json_stringf("Error parsing message: %s", err.text),
 						     "line", err.line,
 						     "column", err.column,
-						     "request", ast_json_stringf("%.*s", (int)payload_len, payload));
+						     "request", payloadz ? payloadz : "(null)");
 				if (!resp) {
 					ast_log(LOG_ERROR, "Error building error message. That's just messed up.\n");
 				}




More information about the asterisk-commits mailing list