Fixed: Can now specify a cookie for BitMeTv.

This commit is contained in:
Taloth Saldono 2015-03-14 16:06:46 +01:00
parent d1ce1bf218
commit 96469be7f0
5 changed files with 46 additions and 5 deletions

View file

@ -14,6 +14,7 @@ namespace NzbDrone.Common.Http
Headers = new HttpHeader();
_segments = new Dictionary<string, string>();
AllowAutoRedirect = true;
Cookies = new Dictionary<string, string>();
if (httpAccept != null)
{
@ -44,6 +45,7 @@ namespace NzbDrone.Common.Http
public NetworkCredential NetworkCredential { get; set; }
public bool SuppressHttpError { get; set; }
public bool AllowAutoRedirect { get; set; }
public Dictionary<string, string> Cookies { get; private set; }
public override string ToString()
{
@ -66,5 +68,20 @@ namespace NzbDrone.Common.Http
_segments.Add(key, value);
}
public void AddCookie(string key, string value)
{
Cookies[key] = value;
}
public void AddCookie(string cookies)
{
foreach (var pair in cookies.Split(';'))
{
var split = pair.Split('=');
Cookies[split[0].Trim()] = split[1].Trim();
}
}
}
}