aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-23 20:04:02 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-23 20:04:02 -0400
commitcbd767ddcef7a857fb48d1cdb13e79e0ebf201b7 (patch)
treeff7084f61b85d0cf97327501c22b7be67058422a /MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
parentbb281d4bcc56f0ea923e14d352d057a74587c33d (diff)
improve image serving performance slightly
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs15
1 files changed, 11 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
index f6547dec1..4f795fdd5 100644
--- a/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
+++ b/MediaBrowser.Server.Implementations/HttpServer/HttpServer.cs
@@ -314,6 +314,8 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <param name="context">The CTX.</param>
private async void ProcessHttpRequestAsync(HttpListenerContext context)
{
+ var date = DateTime.Now;
+
LogHttpRequest(context);
if (context.Request.IsWebSocketRequest)
@@ -360,7 +362,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
var url = context.Request.Url.ToString();
var endPoint = context.Request.RemoteEndPoint;
- LogResponse(context, url, endPoint);
+ var duration = DateTime.Now - date;
+
+ LogResponse(context, url, endPoint, duration);
}
catch (Exception ex)
@@ -461,14 +465,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer
/// <param name="ctx">The CTX.</param>
/// <param name="url">The URL.</param>
/// <param name="endPoint">The end point.</param>
- private void LogResponse(HttpListenerContext ctx, string url, IPEndPoint endPoint)
+ /// <param name="duration">The duration.</param>
+ private void LogResponse(HttpListenerContext ctx, string url, IPEndPoint endPoint, TimeSpan duration)
{
if (!EnableHttpRequestLogging)
{
return;
}
- var statusode = ctx.Response.StatusCode;
+ var statusCode = ctx.Response.StatusCode;
var log = new StringBuilder();
@@ -476,7 +481,9 @@ namespace MediaBrowser.Server.Implementations.HttpServer
log.AppendLine("Headers: " + string.Join(",", ctx.Response.Headers.AllKeys.Select(k => k + "=" + ctx.Response.Headers[k])));
- var msg = "Http Response Sent (" + statusode + ") to " + endPoint;
+ var responseTime = string.Format(". Response time: {0} ms", duration.TotalMilliseconds);
+
+ var msg = "Response code " + statusCode + " sent to " + endPoint + responseTime;
_logger.LogMultiline(msg, LogSeverity.Debug, log);
}