aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-10-22 19:27:09 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-10-22 19:27:09 -0400
commitc2361db772591e176fcf2ded2e3b1725cf1c5dd7 (patch)
tree8dd114ae95ff2a800902c76a01c519a499bf59e1 /Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
parent4fb4a87ca0d2730a8dee20ceb09f31e01ff6d5cf (diff)
separate encoding from content type values
Diffstat (limited to 'Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs')
-rw-r--r--Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs32
1 files changed, 27 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
index 3fdd05135..ae53e3a5b 100644
--- a/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
+++ b/Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs
@@ -320,8 +320,6 @@ namespace Emby.Server.Implementations.HttpClientManager
private async Task<HttpResponseInfo> GetCachedResponse(string responseCachePath, TimeSpan cacheLength, string url)
{
- _logger.Info("Checking for cache file {0}", responseCachePath);
-
try
{
if (_fileSystem.GetLastWriteTimeUtc(responseCachePath).Add(cacheLength) > DateTime.UtcNow)
@@ -402,7 +400,17 @@ namespace Emby.Server.Implementations.HttpClientManager
var bytes = options.RequestContentBytes ??
Encoding.UTF8.GetBytes(options.RequestContent ?? string.Empty);
- httpWebRequest.ContentType = options.RequestContentType ?? "application/x-www-form-urlencoded";
+ var contentType = options.RequestContentType ?? "application/x-www-form-urlencoded";
+
+ if (options.RequestContentEncoding != null)
+ {
+ if (options.RequestContentEncoding.Equals(Encoding.UTF8))
+ {
+ contentType = contentType.TrimEnd(';') + "; charset=\"utf-8\"";
+ }
+ }
+
+ httpWebRequest.ContentType = contentType;
httpWebRequest.ContentLength = bytes.Length;
(await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false)).Write(bytes, 0, bytes.Length);
@@ -430,7 +438,14 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.LogRequest)
{
- _logger.Info("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ if (options.LogRequestAsDebug)
+ {
+ _logger.Debug("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ }
+ else
+ {
+ _logger.Info("HttpClientManager {0}: {1}", httpMethod.ToUpper(), options.Url);
+ }
}
try
@@ -597,7 +612,14 @@ namespace Emby.Server.Implementations.HttpClientManager
if (options.LogRequest)
{
- _logger.Info("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
+ if (options.LogRequestAsDebug)
+ {
+ _logger.Debug("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
+ }
+ else
+ {
+ _logger.Info("HttpClientManager.GetTempFileResponse url: {0}", options.Url);
+ }
}
var client = GetHttpClient(GetHostFromUrl(options.Url), options.EnableHttpCompression);