2
Vote

Bug in FindContentType!? obsolete quotes - why not using ContentType ctor!?

description

hi,
i think i found a bug in the method FindContentType.
 
you are parsing the content-type header via regex - the charset as well:
...
        if (Regex.IsMatch(headers["content-type"], @"charset=""(.*?)""", RegexOptions.IgnoreCase))
            returnValue.CharSet = Regex.Match(headers["content-type"], @"charset=""(.*?)""", RegexOptions.IgnoreCase).Groups[1].Value;
...
 
the quotes behind the equal sign should be all obsolete (at least in charset).
 
BUT why dont you just pass the whole header value to the constructor (this is working like a charm) like:
returnValue = new ContentType(headers["content-type"]);
 
thanks, toebens

comments

icnocop wrote Feb 28, 2013 at 9:59 PM

Hi toebens,

Thank you for uploading patch #6687! :)