aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Connect/ConnectManager.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Connect/ConnectManager.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
index fba098dab..af1628ba4 100644
--- a/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
+++ b/MediaBrowser.Server.Implementations/Connect/ConnectManager.cs
@@ -10,7 +10,6 @@ using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
-using System.Net;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
@@ -113,7 +112,12 @@ namespace MediaBrowser.Server.Implementations.Connect
{
var url = "Servers";
url = GetConnectUrl(url);
- var postData = new Dictionary<string, string> {{"name", _appHost.FriendlyName}, {"url", wanApiAddress}};
+
+ var postData = new Dictionary<string, string>
+ {
+ {"name", _appHost.FriendlyName},
+ {"url", wanApiAddress}
+ };
using (var stream = await _httpClient.Post(url, postData, CancellationToken.None).ConfigureAwait(false))
{
@@ -131,12 +135,24 @@ namespace MediaBrowser.Server.Implementations.Connect
var url = "Servers";
url = GetConnectUrl(url);
url += "?id=" + ConnectServerId;
- var postData = new Dictionary<string, string> {{"name", _appHost.FriendlyName}, {"url", wanApiAddress}};
// TODO: Add Access-Key http request header
+ var options = new HttpRequestOptions
+ {
+ Url = url,
+ CancellationToken = CancellationToken.None
+ };
+
+ options.SetPostData(new Dictionary<string, string>
+ {
+ {"name", _appHost.FriendlyName},
+ {"url", wanApiAddress}
+ });
+
+ options.RequestHeaders.Add("X-Connect-Token", ConnectAccessKey);
// No need to examine the response
- using (var stream = await _httpClient.Post(url, postData, CancellationToken.None).ConfigureAwait(false))
+ using (var stream = (await _httpClient.Post(options).ConfigureAwait(false)).Content)
{
}
}