[Asterisk-cvs] asterisk/channels chan_sip.c,1.338,1.339

markster at lists.digium.com markster at lists.digium.com
Sun Apr 25 23:32:41 CDT 2004


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv25746/channels

Modified Files:
	chan_sip.c 
Log Message:
First pass at handling multi-line headers


Index: chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.338
retrieving revision 1.339
diff -u -d -r1.338 -r1.339
--- chan_sip.c	22 Apr 2004 00:20:33 -0000	1.338
+++ chan_sip.c	26 Apr 2004 03:38:32 -0000	1.339
@@ -1934,7 +1934,7 @@
 static void parse(struct sip_request *req)
 {
 	/* Divide fields by NULL's */
-	char *c;
+	char *c, *last = NULL;
 	int f = 0;
 	c = req->data;
 
@@ -1955,9 +1955,18 @@
 			}
 			if (f >= SIP_MAX_HEADERS - 1) {
 				ast_log(LOG_WARNING, "Too many SIP headers...\n");
-			} else
-				f++;
-			req->header[f] = c + 1;
+			} else {
+				if ((c[1] == ' ') || (c[1] == '\t')) {
+					/* Continuation of previous header */
+					if (last) {
+						while(last < c)
+							*(last++) = ' ';
+					}
+				} else {
+					f++;
+					req->header[f] = c + 1;
+				}
+			}
 		} else if (*c == '\r') {
 			/* Ignore but eliminate \r's */
 			*c = 0;




More information about the svn-commits mailing list