|
|
|
@ -66,9 +66,9 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|
|
|
|
|
|
|
|
|
lock (CurlGlobalHandle.Instance)
|
|
|
|
|
{
|
|
|
|
|
Stream responseStream = new MemoryStream();
|
|
|
|
|
Stream headerStream = new MemoryStream();
|
|
|
|
|
|
|
|
|
|
using (Stream responseStream = new MemoryStream())
|
|
|
|
|
using (Stream headerStream = new MemoryStream())
|
|
|
|
|
{
|
|
|
|
|
using (var curlEasy = new CurlEasy())
|
|
|
|
|
{
|
|
|
|
|
curlEasy.AutoReferer = false;
|
|
|
|
@ -158,6 +158,7 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void AddProxy(CurlEasy curlEasy, HttpRequest request)
|
|
|
|
|
{
|
|
|
|
@ -259,6 +260,7 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|
|
|
|
|
|
|
|
|
private byte[] ProcessResponseStream(HttpRequest request, Stream responseStream, WebHeaderCollection webHeaderCollection)
|
|
|
|
|
{
|
|
|
|
|
byte[] bytes = null;
|
|
|
|
|
responseStream.Position = 0;
|
|
|
|
|
|
|
|
|
|
if (responseStream.Length != 0)
|
|
|
|
@ -268,21 +270,27 @@ namespace NzbDrone.Common.Http.Dispatchers
|
|
|
|
|
{
|
|
|
|
|
if (encoding.IndexOf("gzip") != -1)
|
|
|
|
|
{
|
|
|
|
|
responseStream = new GZipStream(responseStream, CompressionMode.Decompress);
|
|
|
|
|
using (var zipStream = new GZipStream(responseStream, CompressionMode.Decompress))
|
|
|
|
|
{
|
|
|
|
|
bytes = zipStream.ToBytes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webHeaderCollection.Remove("Content-Encoding");
|
|
|
|
|
}
|
|
|
|
|
else if (encoding.IndexOf("deflate") != -1)
|
|
|
|
|
{
|
|
|
|
|
responseStream = new DeflateStream(responseStream, CompressionMode.Decompress);
|
|
|
|
|
using (var deflateStream = new DeflateStream(responseStream, CompressionMode.Decompress))
|
|
|
|
|
{
|
|
|
|
|
bytes = deflateStream.ToBytes();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
webHeaderCollection.Remove("Content-Encoding");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return responseStream.ToBytes();
|
|
|
|
|
|
|
|
|
|
if (bytes == null) bytes = responseStream.ToBytes();
|
|
|
|
|
return bytes;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|