Skip to content

Commit 76669a3

Browse files
authored
Folding ws between "Content-Type:" and "plain/text" leads to empty header (#96)
* Add testcase with folding whitespace between "Content-Type:" and "text/plain" * Fix handling of newlines between Content-Type and the type itself
1 parent c8bf355 commit 76669a3

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

resources/content_type.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,5 +1217,12 @@
12171217
]
12181218
]
12191219
}
1220+
},
1221+
{
1222+
"header": "\n text/plain\r\n",
1223+
"expected": {
1224+
"c_type": "text",
1225+
"c_subtype": "plain"
1226+
}
12201227
}
12211228
]

src/parsers/fields/content_type.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,9 @@ impl<'x> MessageStream<'x> {
329329
}
330330

331331
if next_is_space {
332+
if parser.state == ContentState::Type {
333+
continue;
334+
}
332335
parser.state = ContentState::AttributeName;
333336
self.next();
334337

0 commit comments

Comments
 (0)