Skip to content

Commit f7efd44

Browse files
committed
parser/content: handle \r for Accept folding lines
When receiving a heeader with folding lines, we also need to skip '\r' when parsing the new lines. This way we can accept headers such as: Accept: application/sdp, application/isup, multipart/mixed, application/dtmf, application/dtmf-relay Thanks go to 46Labs for reporting this
1 parent 0712680 commit f7efd44

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

parser/parse_content.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ char* parse_content_length( char* buffer, char* end, int* length)
232232

233233
p = buffer;
234234
/* search the beginning of the number */
235-
while ( p<end && (*p==' ' || *p=='\t' ||
235+
while ( p<end && (*p==' ' || *p=='\t' || (*p=='\r' && *(p+1)=='\n') ||
236236
(*p=='\n' && (*(p+1)==' '||*(p+1)=='\t')) ))
237237
p++;
238238
if (p==end)
@@ -282,7 +282,7 @@ char* decode_mime_type(char *start, char *end, unsigned int *mime_type, content_
282282
LM_DBG("Decoding MIME type for:[%.*s]\n",(int)(end-start),start);
283283

284284
/* search the beginning of the type */
285-
while ( p<end && (*p==' ' || *p=='\t' ||
285+
while ( p<end && (*p==' ' || *p=='\t' || (*p=='\r' && *(p+1)=='\n') ||
286286
(*p=='\n' && (*(p+1)==' '||*(p+1)=='\t')) ))
287287
p++;
288288
if (p==end)

0 commit comments

Comments
 (0)