Griffin.WebServer
Griffin.WebServer copied to clipboard
CookieParser bug: _index, _cookieValue and _cookieName not reset in Parse(...)
_index, _cookieValue and _cookieName have to be set to 0, "" and "" respectively at the start of Parse(...) method or only the first cookie parsing will yield correct result.
Here is the fix for that issue in HttpCookieParser change the Parse method to
/// <summary>
/// Parse cookie string
/// </summary>
/// <returns>A generated cookie collection.</returns>
public IHttpCookieCollection<IHttpCookie> Parse(string value)
{
_index = 0;
_cookieValue = "";
_cookieName = "";
if (value == null) throw new ArgumentNullException("value");
_headerValue = value;
_cookies = new HttpCookieCollection<IHttpCookie>();
_parserMethod = Name_Before;
while (!IsEOF)
{
_parserMethod();
}
OnCookie(_cookieName, _cookieValue);
return _cookies;
}