[sr-dev] git:master: modules/ims_auth: small cleanup/refactor in ims_get_body

Jason Penton jason.penton at gmail.com
Fri Jun 6 11:41:00 CEST 2014


Module: sip-router
Branch: master
Commit: c1a6e04fd6b3f6b97893abe77a6a19ff6dbb0054
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=c1a6e04fd6b3f6b97893abe77a6a19ff6dbb0054

Author: Jason Penton <jason.penton at gmail.com>
Committer: Jason Penton <jason.penton at gmail.com>
Date:   Fri Jun  6 11:40:13 2014 +0200

modules/ims_auth: small cleanup/refactor in ims_get_body

---

 modules/ims_auth/utils.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/modules/ims_auth/utils.c b/modules/ims_auth/utils.c
index 2551da6..0e2e365 100644
--- a/modules/ims_auth/utils.c
+++ b/modules/ims_auth/utils.c
@@ -283,20 +283,17 @@ int get_nonce_response(struct sip_msg *msg, str realm,str *nonce,str *response,
 str ims_get_body(struct sip_msg * msg)
 {		
 	str x={0,0};
-	x.s = get_body(msg);	
-	if (x.s==0) return x;
+	
 	if (parse_headers(msg,HDR_CONTENTLENGTH_F,0)!=0) {
 		LM_DBG("Error parsing until header Content-Length: \n");
 		return x;
 	}
-	if  (msg->content_length->parsed==NULL) {
-		LM_ERR(" body <%.*s>\n",msg->content_length->body.len,msg->content_length->body.s);
-		parse_content_length(msg->content_length->body.s,
-			msg->content_length->body.s+msg->content_length->body.len,&(x.len));
-		msg->content_length->parsed=(void*)(long)(x.len);
-	}else 
-		x.len = (long)msg->content_length->parsed;
-	return x;
+	x.len = (int)(long)msg->content_length->parsed;
+        
+        if (x.len>0) 
+            x.s = get_body(msg);	
+	
+        return x;
 }
 
 




More information about the sr-dev mailing list