Skip to content

Commit

Permalink
update http compression
Browse files Browse the repository at this point in the history
  • Loading branch information
LukePulverenti committed Jan 23, 2016
1 parent 6c0bd36 commit 03b0eec
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ private async void TimerCallback(object state)
{
Url = ipLookupUrl,
UserAgent = "Emby/" + _appHost.ApplicationVersion,
LogErrors = logErrors
LogErrors = logErrors,

// Seeing block length errors with our server
EnableHttpCompression = false

}).ConfigureAwait(false))
{
Expand Down
36 changes: 32 additions & 4 deletions MediaBrowser.Server.Implementations/EntryPoints/UsageReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public UsageReporter(IApplicationHost applicationHost, IHttpClient httpClient, I
_logger = logger;
}

public Task ReportServerUsage(CancellationToken cancellationToken)
public async Task ReportServerUsage(CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested();

Expand All @@ -51,10 +51,24 @@ public Task ReportServerUsage(CancellationToken cancellationToken)

data["plugins"] = string.Join(",", _applicationHost.Plugins.Select(i => i.Id).ToArray());

return _httpClient.Post(MbAdminUrl + "service/registration/ping", data, cancellationToken);
var options = new HttpRequestOptions
{
Url = MbAdminUrl + "service/registration/ping",
CancellationToken = cancellationToken,

// Seeing block length errors
EnableHttpCompression = false
};

options.SetPostData(data);

using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false))
{

}
}

public Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken)
public async Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken)
{
if (string.IsNullOrWhiteSpace(app.DeviceId))
{
Expand All @@ -79,7 +93,21 @@ public Task ReportAppUsage(ClientInfo app, CancellationToken cancellationToken)
{ "platform", app.DeviceName },
};

return _httpClient.Post(MbAdminUrl + "service/registration/ping", data, cancellationToken);
var options = new HttpRequestOptions
{
Url = MbAdminUrl + "service/registration/ping",
CancellationToken = cancellationToken,

// Seeing block length errors
EnableHttpCompression = false
};

options.SetPostData(data);

using (var response = await _httpClient.SendAsync(options, "POST").ConfigureAwait(false))
{

}
}
}

Expand Down

0 comments on commit 03b0eec

Please sign in to comment.