Fix little SIP header continuation issue

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@4290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2004-11-18 04:26:22 +00:00
parent a71e44bbdc
commit 1632d45e85

View File

@@ -2517,33 +2517,32 @@ static int lws2sws(char *msgbuf, int len)
} }
/* Check for end-of-line */ /* Check for end-of-line */
if (msgbuf[h] == '\n') { if (msgbuf[h] == '\n') {
/* Check for end-of-message */ /* Check for end-of-message */
if (h + 1 == len) if (h + 1 == len)
break; break;
/* Check for a continuation line */ /* Check for a continuation line */
if (msgbuf[h + 1] == ' ') { if (msgbuf[h + 1] == ' ' || msgbuf[h + 1] == '\t') {
/* Merge continuation line */ /* Merge continuation line */
h++; h++;
continue;
}
/* Propagate LF and start new line */
msgbuf[t++] = msgbuf[h++];
lws = 0;
continue; continue;
} }
/* Propagate LF and start new line */ if (msgbuf[h] == ' ' || msgbuf[h] == '\t') {
msgbuf[t++] = msgbuf[h++]; if (lws) {
lws = 0; h++;
continue; continue;
} }
msgbuf[t++] = msgbuf[h++];
if (msgbuf[h] == ' ' || msgbuf[h] == '\t') { lws = 1;
if (lws) {
h++;
continue; continue;
} }
msgbuf[t++] = msgbuf[h++]; msgbuf[t++] = msgbuf[h++];
lws = 1; if (lws)
continue; lws = 0;
}
msgbuf[t++] = msgbuf[h++];
if (lws)
lws = 0;
} }
msgbuf[t] = '\0'; msgbuf[t] = '\0';
return t; return t;