[sr-dev] git:master: gzcompress: enable compression for http messages

Daniel-Constantin Mierla miconda at gmail.com
Mon Sep 23 19:01:51 CEST 2013


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Sep 23 18:41:51 2013 +0200

gzcompress: enable compression for http messages

- tested replying with compressed body to an HTTP request from FireFox

---

 modules/gzcompress/gzcompress_mod.c |   32 ++++++++++----------------------
 1 files changed, 10 insertions(+), 22 deletions(-)

diff --git a/modules/gzcompress/gzcompress_mod.c b/modules/gzcompress/gzcompress_mod.c
index 38c7687..a681aa8 100644
--- a/modules/gzcompress/gzcompress_mod.c
+++ b/modules/gzcompress/gzcompress_mod.c
@@ -132,13 +132,19 @@ int gzc_prepare_msg(sip_msg_t *msg)
 
 	if(msg->first_line.type==SIP_REQUEST)
 	{
-		if(!IS_SIP(msg))
+		if(!IS_SIP(msg) && !IS_HTTP(msg))
 		{
-			LM_DBG("non sip request message\n");
+			LM_DBG("non sip or http request\n");
 			return 1;
 		}
-	} else if(msg->first_line.type!=SIP_REPLY) {
-		LM_DBG("non sip message\n");
+	} else if(msg->first_line.type==SIP_REPLY) {
+		if(!IS_SIP_REPLY(msg) && !IS_HTTP_REPLY(msg))
+		{
+			LM_DBG("non sip or http response\n");
+			return 1;
+		}
+	} else {
+		LM_DBG("non sip or http message\n");
 		return 1;
 	}
 
@@ -148,24 +154,6 @@ int gzc_prepare_msg(sip_msg_t *msg)
 		return 2;
 	}
 
-	if(parse_from_header(msg)<0)
-	{
-		LM_ERR("cannot parse FROM header\n");
-		return 3;
-	}
-
-	if(parse_to_header(msg)<0 || msg->to==NULL)
-	{
-		LM_ERR("cannot parse TO header\n");
-		return 3;
-	}
-
-	if(get_to(msg)==NULL)
-	{
-		LM_ERR("cannot get TO header\n");
-		return 3;
-	}
-
 	return 0;
 }
 




More information about the sr-dev mailing list