aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs')
-rw-r--r--MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs20
1 files changed, 7 insertions, 13 deletions
diff --git a/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs b/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs
index f540a8004..b1ae21a43 100644
--- a/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs
+++ b/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs
@@ -2,7 +2,6 @@
using MediaBrowser.Controller.Configuration;
using System;
using System.IO;
-using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;
@@ -14,8 +13,6 @@ namespace MediaBrowser.Dlna.PlayTo
private const string USERAGENT = "Microsoft-Windows/6.2 UPnP/1.0 Microsoft-DLNA DLNADOC/1.50";
private const string FriendlyName = "MediaBrowser";
- private static readonly CookieContainer Container = new CookieContainer();
-
private readonly IHttpClient _httpClient;
private readonly IServerConfigurationManager _config;
@@ -31,7 +28,7 @@ namespace MediaBrowser.Dlna.PlayTo
if (!serviceUrl.StartsWith("/"))
serviceUrl = "/" + serviceUrl;
- var response = await PostSoapDataAsync(new Uri(baseUrl + serviceUrl), "\"" + service.ServiceType + "#" + command + "\"", postData, header)
+ var response = await PostSoapDataAsync(baseUrl + serviceUrl, "\"" + service.ServiceType + "#" + command + "\"", postData, header)
.ConfigureAwait(false);
using (var stream = response.Content)
@@ -43,11 +40,11 @@ namespace MediaBrowser.Dlna.PlayTo
}
}
- public async Task SubscribeAsync(Uri url, string ip, int port, string localIp, int eventport, int timeOut = 3600)
+ public async Task SubscribeAsync(string url, string ip, int port, string localIp, int eventport, int timeOut = 3600)
{
var options = new HttpRequestOptions
{
- Url = url.ToString(),
+ Url = url,
UserAgent = USERAGENT,
LogRequest = _config.Configuration.DlnaOptions.EnableDebugLogging
};
@@ -56,7 +53,6 @@ namespace MediaBrowser.Dlna.PlayTo
options.RequestHeaders["CALLBACK"] = "<" + localIp + ":" + eventport + ">";
options.RequestHeaders["NT"] = "upnp:event";
options.RequestHeaders["TIMEOUT"] = "Second - " + timeOut;
- //request.CookieContainer = Container;
using (await _httpClient.Get(options).ConfigureAwait(false))
{
@@ -75,24 +71,22 @@ namespace MediaBrowser.Dlna.PlayTo
options.RequestHeaders["CALLBACK"] = "<" + localIp + ":" + eventport + ">";
options.RequestHeaders["NT"] = "upnp:event";
options.RequestHeaders["TIMEOUT"] = "Second - 3600";
- //request.CookieContainer = Container;
using (await _httpClient.Get(options).ConfigureAwait(false))
{
}
}
- public async Task<XDocument> GetDataAsync(Uri url)
+ public async Task<XDocument> GetDataAsync(string url)
{
var options = new HttpRequestOptions
{
- Url = url.ToString(),
+ Url = url,
UserAgent = USERAGENT,
LogRequest = _config.Configuration.DlnaOptions.EnableDebugLogging
};
options.RequestHeaders["FriendlyName.DLNA.ORG"] = FriendlyName;
- //request.CookieContainer = Container;
using (var stream = await _httpClient.Get(options).ConfigureAwait(false))
{
@@ -103,14 +97,14 @@ namespace MediaBrowser.Dlna.PlayTo
}
}
- private Task<HttpResponseInfo> PostSoapDataAsync(Uri url, string soapAction, string postData, string header = null, int timeOut = 20000)
+ private Task<HttpResponseInfo> PostSoapDataAsync(string url, string soapAction, string postData, string header = null)
{
if (!soapAction.StartsWith("\""))
soapAction = "\"" + soapAction + "\"";
var options = new HttpRequestOptions
{
- Url = url.ToString(),
+ Url = url,
UserAgent = USERAGENT,
LogRequest = _config.Configuration.DlnaOptions.EnableDebugLogging
};