[asterisk-commits] sgriepentrog: branch 12 r410858 - /branches/12/main/http.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 18 09:51:11 CDT 2014


Author: sgriepentrog
Date: Tue Mar 18 09:51:02 2014
New Revision: 410858

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410858
Log:
ARI: allow json content type with zero length body

When a request was received with a Content-type of json,
the body was sent for json parsing - even if it was zero
length.  This resulted in ARI requests failing that were
valid, such as a channel DELETE with no parameters.  The
code has now been changed to skip json parsing with zero
content length.

(closes issue SWP-6748)
Reported by: Samuel Galarneau
Review: https://reviewboard.asterisk.org/r/3360/


Modified:
    branches/12/main/http.c

Modified: branches/12/main/http.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/http.c?view=diff&rev=410858&r1=410857&r2=410858
==============================================================================
--- branches/12/main/http.c (original)
+++ branches/12/main/http.c Tue Mar 18 09:51:02 2014
@@ -880,9 +880,13 @@
 	}
 
 	buf = ast_http_get_contents(&content_length, ser, headers);
-	if (buf == NULL)
-	{
+	if (buf == NULL) {
 		/* errno already set */
+		return NULL;
+	}
+
+	if (!content_length) {
+		/* it is not an error to have zero content */
 		return NULL;
 	}
 




More information about the asterisk-commits mailing list