mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-15 14:28:24 +00:00
Merge "chan_sip.c: Stop handling continuation lines after reading headers" into 13
This commit is contained in:
@@ -9833,8 +9833,10 @@ static void lws2sws(struct ast_str *data)
|
|||||||
int len = ast_str_strlen(data);
|
int len = ast_str_strlen(data);
|
||||||
int h = 0, t = 0;
|
int h = 0, t = 0;
|
||||||
int lws = 0;
|
int lws = 0;
|
||||||
|
int just_read_eol = 0;
|
||||||
|
int done_with_headers = 0;
|
||||||
|
|
||||||
for (; h < len;) {
|
while (h < len) {
|
||||||
/* Eliminate all CRs */
|
/* Eliminate all CRs */
|
||||||
if (msgbuf[h] == '\r') {
|
if (msgbuf[h] == '\r') {
|
||||||
h++;
|
h++;
|
||||||
@@ -9842,11 +9844,17 @@ static void lws2sws(struct ast_str *data)
|
|||||||
}
|
}
|
||||||
/* Check for end-of-line */
|
/* Check for end-of-line */
|
||||||
if (msgbuf[h] == '\n') {
|
if (msgbuf[h] == '\n') {
|
||||||
|
if (just_read_eol) {
|
||||||
|
done_with_headers = 1;
|
||||||
|
} else {
|
||||||
|
just_read_eol = 1;
|
||||||
|
}
|
||||||
/* 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] == ' ' || msgbuf[h + 1] == '\t') {
|
if (!done_with_headers
|
||||||
|
&& (msgbuf[h + 1] == ' ' || msgbuf[h + 1] == '\t')) {
|
||||||
/* Merge continuation line */
|
/* Merge continuation line */
|
||||||
h++;
|
h++;
|
||||||
continue;
|
continue;
|
||||||
@@ -9855,8 +9863,11 @@ static void lws2sws(struct ast_str *data)
|
|||||||
msgbuf[t++] = msgbuf[h++];
|
msgbuf[t++] = msgbuf[h++];
|
||||||
lws = 0;
|
lws = 0;
|
||||||
continue;
|
continue;
|
||||||
|
} else {
|
||||||
|
just_read_eol = 0;
|
||||||
}
|
}
|
||||||
if (msgbuf[h] == ' ' || msgbuf[h] == '\t') {
|
if (!done_with_headers
|
||||||
|
&& (msgbuf[h] == ' ' || msgbuf[h] == '\t')) {
|
||||||
if (lws) {
|
if (lws) {
|
||||||
h++;
|
h++;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user