aboutsummaryrefslogtreecommitdiff
path: root/OpenSubtitlesHandler/Utilities.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-12-28 16:13:12 -0500
committerGitHub <noreply@github.com>2016-12-28 16:13:12 -0500
commit2cb0f3eed635bb468b3672d08dca9a720b4fb48f (patch)
tree1a0d7c53ec148619ae966a81187413a33ca9a8a4 /OpenSubtitlesHandler/Utilities.cs
parente47ccdce4247b93faa6d27849b255aac83324c42 (diff)
parentc10b152018967ddafe72efbccfe8ca6c586cbf04 (diff)
Merge pull request #2372 from MediaBrowser/beta
Beta
Diffstat (limited to 'OpenSubtitlesHandler/Utilities.cs')
-rw-r--r--OpenSubtitlesHandler/Utilities.cs58
1 files changed, 4 insertions, 54 deletions
diff --git a/OpenSubtitlesHandler/Utilities.cs b/OpenSubtitlesHandler/Utilities.cs
index 3fe606c78..c012da462 100644
--- a/OpenSubtitlesHandler/Utilities.cs
+++ b/OpenSubtitlesHandler/Utilities.cs
@@ -37,7 +37,9 @@ namespace OpenSubtitlesHandler
public static IHttpClient HttpClient { get; set; }
public static ITextEncoding EncodingHelper { get; set; }
- private const string XML_RPC_SERVER = "https://api.opensubtitles.org/xml-rpc";
+ //private static string XML_RPC_SERVER = "https://api.opensubtitles.org/xml-rpc";
+ private static string XML_RPC_SERVER = "https://92.240.234.122/xml-rpc";
+ private static string HostHeader = "api.opensubtitles.org:443";
/// <summary>
/// Compute movie hash
@@ -142,32 +144,6 @@ namespace OpenSubtitlesHandler
public static Stream SendRequest(byte[] request, string userAgent)
{
return SendRequestAsync(request, userAgent, CancellationToken.None).Result;
-
- //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(XML_RPC_SERVER);
- //req.ContentType = "text/xml";
- //req.Host = "api.opensubtitles.org:80";
- //req.Method = "POST";
- //req.UserAgent = "xmlrpc-epi-php/0.2 (PHP)";
- //req.ContentLength = request.Length;
- //ServicePointManager.Expect100Continue = false;
- //try
- //{
- // using (Stream stm = req.GetRequestStream())
- // {
- // stm.Write(request, 0, request.Length);
- // }
-
- // WebResponse response = req.GetResponse();
- // return response.GetResponseStream();
- //}
- //catch (Exception ex)
- //{
- // Stream errorStream = new MemoryStream();
- // byte[] dd = Encoding.ASCII.GetBytes("ERROR: " + ex.Message);
- // errorStream.Write(dd, 0, dd.Length);
- // errorStream.Position = 0;
- // return errorStream;
- //}
}
public static async Task<Stream> SendRequestAsync(byte[] request, string userAgent, CancellationToken cancellationToken)
@@ -177,7 +153,7 @@ namespace OpenSubtitlesHandler
RequestContentBytes = request,
RequestContentType = "text/xml",
UserAgent = userAgent,
- Host = "api.opensubtitles.org:443",
+ Host = HostHeader,
Url = XML_RPC_SERVER,
// Response parsing will fail with this enabled
@@ -195,32 +171,6 @@ namespace OpenSubtitlesHandler
var result = await HttpClient.Post(options).ConfigureAwait(false);
return result.Content;
-
- //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(XML_RPC_SERVER);
- //req.ContentType = "text/xml";
- //req.Host = "api.opensubtitles.org:80";
- //req.Method = "POST";
- //req.UserAgent = "xmlrpc-epi-php/0.2 (PHP)";
- //req.ContentLength = request.Length;
- //ServicePointManager.Expect100Continue = false;
- //try
- //{
- // using (Stream stm = req.GetRequestStream())
- // {
- // stm.Write(request, 0, request.Length);
- // }
-
- // WebResponse response = req.GetResponse();
- // return response.GetResponseStream();
- //}
- //catch (Exception ex)
- //{
- // Stream errorStream = new MemoryStream();
- // byte[] dd = Encoding.ASCII.GetBytes("ERROR: " + ex.Message);
- // errorStream.Write(dd, 0, dd.Length);
- // errorStream.Position = 0;
- // return errorStream;
- //}
}
}