update image encoding

This commit is contained in:
Luke Pulverenti
2015-10-28 15:40:38 -04:00
parent 813c715489
commit 9b998a068a
27 changed files with 239 additions and 129 deletions

View File

@@ -92,7 +92,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
{typeof (FileNotFoundException), 404},
{typeof (DirectoryNotFoundException), 404},
{typeof (SecurityException), 401},
{typeof (UnauthorizedAccessException), 500}
{typeof (PaymentRequiredException), 402},
{typeof (UnauthorizedAccessException), 500},
{typeof (ApplicationException), 500}
};
HostConfig.Instance.DebugMode = true;

View File

@@ -16,7 +16,10 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <param name="duration">The duration.</param>
public static void LogResponse(ILogger logger, int statusCode, string url, string endPoint, TimeSpan duration)
{
logger.Info("HTTP Response {0} to {1}. Time: {2}ms. {3}", statusCode, endPoint, Convert.ToInt32(duration.TotalMilliseconds).ToString(CultureInfo.InvariantCulture), url);
var durationMs = duration.TotalMilliseconds;
var logSuffix = durationMs >= 1000 ? "ms (slow)" : "ms";
logger.Info("HTTP Response {0} to {1}. Time: {2}{3}. {4}", statusCode, endPoint, Convert.ToInt32(durationMs).ToString(CultureInfo.InvariantCulture), logSuffix, url);
}
}
}

View File

@@ -183,15 +183,7 @@ namespace MediaBrowser.Server.Implementations.HttpServer.SocketSharp
/// <param name="request">The request.</param>
private static void LogRequest(ILogger logger, HttpListenerRequest request)
{
var log = new StringBuilder();
var headers = string.Join(",", request.Headers.AllKeys.Where(i => !string.Equals(i, "cookie", StringComparison.OrdinalIgnoreCase) && !string.Equals(i, "Referer", StringComparison.OrdinalIgnoreCase)).Select(k => k + "=" + request.Headers[k]));
log.AppendLine("Ip: " + request.RemoteEndPoint + ". Headers: " + headers);
var type = request.IsWebSocketRequest ? "Web Socket" : "HTTP " + request.HttpMethod;
logger.LogMultiline(type + " " + request.Url, LogSeverity.Info, log);
logger.Info("{0} {1}. UserAgent: {2}", (request.IsWebSocketRequest ? "WS" : "HTTP " + request.HttpMethod), request.Url, request.UserAgent ?? string.Empty);
}
private void HandleError(Exception ex, HttpListenerContext context)