|
|
|
|
@ -4892,48 +4892,59 @@ static int parse_request(struct sip_request *req)
|
|
|
|
|
}
|
|
|
|
|
if (f >= SIP_MAX_HEADERS - 1) {
|
|
|
|
|
ast_log(LOG_WARNING, "Too many SIP headers. Ignoring.\n");
|
|
|
|
|
} else
|
|
|
|
|
} else {
|
|
|
|
|
f++;
|
|
|
|
|
req->header[f] = c + 1;
|
|
|
|
|
req->header[f] = c + 1;
|
|
|
|
|
}
|
|
|
|
|
} else if (*c == '\r') {
|
|
|
|
|
/* Ignore but eliminate \r's */
|
|
|
|
|
*c = 0;
|
|
|
|
|
}
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
/* Check for last header */
|
|
|
|
|
|
|
|
|
|
req->headers = f;
|
|
|
|
|
|
|
|
|
|
/* Check a non-newline-terminated last header */
|
|
|
|
|
if (!ast_strlen_zero(req->header[f])) {
|
|
|
|
|
if (sipdebug && option_debug > 3)
|
|
|
|
|
ast_log(LOG_DEBUG, "Header %d: %s (%d)\n", f, req->header[f], (int) strlen(req->header[f]));
|
|
|
|
|
f++;
|
|
|
|
|
req->headers++;
|
|
|
|
|
}
|
|
|
|
|
req->headers = f;
|
|
|
|
|
/* Now we process any mime content */
|
|
|
|
|
|
|
|
|
|
/* Now we process any body content */
|
|
|
|
|
f = 0;
|
|
|
|
|
req->line[f] = c;
|
|
|
|
|
while(*c) {
|
|
|
|
|
while (*c) {
|
|
|
|
|
if (*c == '\n') {
|
|
|
|
|
/* We've got a new line */
|
|
|
|
|
*c = 0;
|
|
|
|
|
if (sipdebug && option_debug > 3)
|
|
|
|
|
ast_log(LOG_DEBUG, "Line: %s (%d)\n", req->line[f], (int) strlen(req->line[f]));
|
|
|
|
|
if (f >= SIP_MAX_LINES - 1) {
|
|
|
|
|
if (f == SIP_MAX_LINES - 1) {
|
|
|
|
|
ast_log(LOG_WARNING, "Too many SDP lines. Ignoring.\n");
|
|
|
|
|
} else
|
|
|
|
|
break;
|
|
|
|
|
} else {
|
|
|
|
|
f++;
|
|
|
|
|
req->line[f] = c + 1;
|
|
|
|
|
req->line[f] = c + 1;
|
|
|
|
|
}
|
|
|
|
|
} else if (*c == '\r') {
|
|
|
|
|
/* Ignore and eliminate \r's */
|
|
|
|
|
*c = 0;
|
|
|
|
|
}
|
|
|
|
|
c++;
|
|
|
|
|
}
|
|
|
|
|
/* Check for last line */
|
|
|
|
|
if (!ast_strlen_zero(req->line[f]))
|
|
|
|
|
f++;
|
|
|
|
|
|
|
|
|
|
req->lines = f;
|
|
|
|
|
|
|
|
|
|
/* Check a non-newline-terminated last line */
|
|
|
|
|
if (!ast_strlen_zero(req->line[f])) {
|
|
|
|
|
req->lines++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (*c)
|
|
|
|
|
ast_log(LOG_WARNING, "Odd content, extra stuff left over ('%s')\n", c);
|
|
|
|
|
|
|
|
|
|
/* Split up the first line parts */
|
|
|
|
|
return determine_firstline_parts(req);
|
|
|
|
|
}
|
|
|
|
|
|