[asterisk-commits] sgriepentrog: trunk r410863 - in /trunk: ./ main/http.c

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


Author: sgriepentrog
Date: Tue Mar 18 10:45:04 2014
New Revision: 410863

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=410863
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/
........

Merged revisions 410858 from http://svn.asterisk.org/svn/asterisk/branches/12

Modified:
    trunk/   (props changed)
    trunk/main/http.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-12-merged' - no diff available.

Modified: trunk/main/http.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/http.c?view=diff&rev=410863&r1=410862&r2=410863
==============================================================================
--- trunk/main/http.c (original)
+++ trunk/main/http.c Tue Mar 18 10:45:04 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