diff options
Diffstat (limited to 'MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs')
| -rw-r--r-- | MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs b/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs index ccc7d46e6..f0689751c 100644 --- a/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs +++ b/MediaBrowser.Dlna/PlayTo/SsdpHttpClient.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.Net; +using System; +using MediaBrowser.Common.Net; using MediaBrowser.Controller.Configuration; using MediaBrowser.Dlna.Common; using System.Globalization; @@ -29,11 +30,7 @@ namespace MediaBrowser.Dlna.PlayTo string postData, string header = null) { - var serviceUrl = service.ControlUrl; - if (!serviceUrl.StartsWith("/")) - serviceUrl = "/" + serviceUrl; - - var response = await PostSoapDataAsync(baseUrl + serviceUrl, "\"" + service.ServiceType + "#" + command + "\"", postData, header) + var response = await PostSoapDataAsync(NormalizeServiceUrl(baseUrl, service.ControlUrl), "\"" + service.ServiceType + "#" + command + "\"", postData, header) .ConfigureAwait(false); using (var stream = response.Content) @@ -45,6 +42,20 @@ namespace MediaBrowser.Dlna.PlayTo } } + private string NormalizeServiceUrl(string baseUrl, string serviceUrl) + { + // If it's already a complete url, don't stick anything onto the front of it + if (serviceUrl.StartsWith("http", StringComparison.OrdinalIgnoreCase)) + { + return serviceUrl; + } + + if (!serviceUrl.StartsWith("/")) + serviceUrl = "/" + serviceUrl; + + return baseUrl + serviceUrl; + } + private readonly CultureInfo _usCulture = new CultureInfo("en-US"); public async Task SubscribeAsync(string url, |
