From 64c9e859e02d7d0d94139560b91d42a58aeae9ce Mon Sep 17 00:00:00 2001 From: Mark Spencer Date: Mon, 26 Apr 2004 03:45:10 +0000 Subject: [PATCH] Also handle properly \r\n instead of just \n... git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@2765 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 69c03e3017..e17f77fc91 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -1936,6 +1936,7 @@ static void parse(struct sip_request *req) /* Divide fields by NULL's */ char *c; int f = 0; + int lastr = 0; c = req->data; /* First header starts immediately */ @@ -1959,15 +1960,21 @@ static void parse(struct sip_request *req) if ((c[1] == ' ') || (c[1] == '\t')) { /* Continuation of previous header */ *c = ' '; + if (lastr) { + *(c-1) = ' '; + } } else { f++; req->header[f] = c + 1; } } + lastr = 0; } else if (*c == '\r') { /* Ignore but eliminate \r's */ *c = 0; - } + lastr = 1; + } else + lastr = 0; c++; } /* Check for last header */