Merge pull request #1842 from blackwhale/issue-11350

Fix issue 11350 ibphobos2 regex match segfaults when a rare HTTP header is received
This commit is contained in:
Martin Nowak 2014-01-07 17:02:14 -08:00
commit 84dbc9934d

View file

@ -2062,6 +2062,9 @@ struct HTTP
// http headers. On redirected requests there may be several such
// status lines. The last one is the one recorded.
auto dg = (in char[] header)
{
import std.utf : UTFException;
try
{
if (header.empty)
{
@ -2105,6 +2108,11 @@ struct HTTP
if (!m.empty && callback !is null)
callback(fieldName, m.captures[2]);
headersIn[fieldName] = m.captures[2].idup;
}
catch(UTFException e)
{
//munch it - a header should be all ASCII, any "wrong UTF" is broken header
}
};
curl.onReceiveHeader = dg;