mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-09-17 17:14:18 +02:00
Fixed: Refactored the Indexer architecture to support non-rss indexers.
This commit is contained in:
@@ -21,7 +21,7 @@ namespace NzbDrone.Common.Http
|
||||
{
|
||||
Request = request;
|
||||
Headers = headers;
|
||||
ResponseData = Encoding.UTF8.GetBytes(content);
|
||||
ResponseData = Headers.GetEncodingFromContentType().GetBytes(content);
|
||||
_content = content;
|
||||
StatusCode = statusCode;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace NzbDrone.Common.Http
|
||||
{
|
||||
if (_content == null)
|
||||
{
|
||||
_content = GetStringFromResponseData();
|
||||
_content = Headers.GetEncodingFromContentType().GetString(ResponseData);
|
||||
}
|
||||
|
||||
return _content;
|
||||
@@ -66,36 +66,6 @@ namespace NzbDrone.Common.Http
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected virtual String GetStringFromResponseData()
|
||||
{
|
||||
Encoding encoding = null;
|
||||
|
||||
if (Headers.ContentType.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
var charset = Headers.ContentType.ToLowerInvariant()
|
||||
.Split(';', '=', ' ')
|
||||
.SkipWhile(v => v != "charset")
|
||||
.Skip(1).FirstOrDefault();
|
||||
|
||||
if (charset.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
encoding = Encoding.GetEncoding(charset);
|
||||
}
|
||||
}
|
||||
|
||||
if (encoding == null)
|
||||
{
|
||||
// TODO: Find encoding by Byte order mask.
|
||||
}
|
||||
|
||||
if (encoding == null)
|
||||
{
|
||||
encoding = Encoding.UTF8;
|
||||
}
|
||||
|
||||
return encoding.GetString(ResponseData);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user