[svn-commits] mmichelson: branch mmichelson/rls-rlmi r418322 - /team/mmichelson/rls-rlmi/res/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 10 10:23:58 CDT 2014


Author: mmichelson
Date: Thu Jul 10 10:23:47 2014
New Revision: 418322

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=418322
Log:
Fix parsing Accept headers when more than one is present.

PJSIP's parser will place multiple Accept values into an
array, as long as the values appear in the same Accept
header. However, if values are separated into multiple
accept headers, it's up to us to iterate over the headers
and accumulate the Accept header values ourselves.


Modified:
    team/mmichelson/rls-rlmi/res/res_pjsip_pubsub.c

Modified: team/mmichelson/rls-rlmi/res/res_pjsip_pubsub.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/rls-rlmi/res/res_pjsip_pubsub.c?view=diff&rev=418322&r1=418321&r2=418322
==============================================================================
--- team/mmichelson/rls-rlmi/res/res_pjsip_pubsub.c (original)
+++ team/mmichelson/rls-rlmi/res/res_pjsip_pubsub.c Thu Jul 10 10:23:47 2014
@@ -600,12 +600,11 @@
 static struct ast_sip_pubsub_body_generator *subscription_get_generator_from_rdata(pjsip_rx_data *rdata,
 	const struct ast_sip_subscription_handler *handler)
 {
-	pjsip_accept_hdr *accept_header;
+	pjsip_accept_hdr *accept_header = (pjsip_accept_hdr *) &rdata->msg_info.msg->hdr;
 	char accept[AST_SIP_MAX_ACCEPT][64];
 	size_t num_accept_headers = 0;
 
-	accept_header = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, rdata->msg_info.msg->hdr.next);
-	if (accept_header) {
+	while ((accept_header = pjsip_msg_find_hdr(rdata->msg_info.msg, PJSIP_H_ACCEPT, accept_header->next))) {
 		int i;
 
 		for (i = 0; i < accept_header->count; ++i) {
@@ -614,7 +613,9 @@
 				++num_accept_headers;
 			}
 		}
-	} else {
+	}
+
+	if (num_accept_headers == 0) {
 		/* If a SUBSCRIBE contains no Accept headers, then we must assume that
 		 * the default accept type for the event package is to be used.
 		 */




More information about the svn-commits mailing list