Jelajahi Sumber

update response headers for HEAD requests

Luke Pulverenti 7 tahun lalu
induk
melakukan
768f20b1bb

+ 7 - 1
Emby.Server.Implementations/HttpServer/HttpListenerHost.cs

@@ -579,7 +579,13 @@ namespace Emby.Server.Implementations.HttpServer
 
             catch (Exception ex)
             {
-                ErrorHandler(ex, httpReq, !string.Equals(ex.GetType().Name, "SocketException", StringComparison.OrdinalIgnoreCase));
+                var logException = !string.Equals(ex.GetType().Name, "SocketException", StringComparison.OrdinalIgnoreCase);
+
+#if DEBUG
+                logException = true;
+#endif
+
+                ErrorHandler(ex, httpReq, logException);
             }
             finally
             {

+ 2 - 11
Emby.Server.Implementations/HttpServer/HttpResultFactory.cs

@@ -424,16 +424,6 @@ namespace Emby.Server.Implementations.HttpServer
 
             options.ResponseHeaders = options.ResponseHeaders ?? new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
 
-            if (!options.ResponseHeaders.ContainsKey("Content-Disposition"))
-            {
-                // Quotes are valid in linux. They'll possibly cause issues here
-                var filename = (Path.GetFileName(path) ?? string.Empty).Replace("\"", string.Empty);
-                if (!string.IsNullOrWhiteSpace(filename))
-                {
-                    options.ResponseHeaders["Content-Disposition"] = "inline; filename=\"" + filename + "\"";
-                }
-            }
-
             return GetStaticResult(requestContext, options);
         }
 
@@ -490,7 +480,8 @@ namespace Emby.Server.Implementations.HttpServer
                 return result;
             }
 
-            var isHeadRequest = options.IsHeadRequest;
+            // TODO: We don't really need the option value
+            var isHeadRequest = options.IsHeadRequest || string.Equals(requestContext.Verb, "HEAD", StringComparison.OrdinalIgnoreCase);
             var factoryFn = options.ContentFactory;
             var responseHeaders = options.ResponseHeaders;
 

+ 1 - 1
SharedVersion.cs

@@ -1,3 +1,3 @@
 using System.Reflection;
 
-[assembly: AssemblyVersion("3.2.32.4")]
+[assembly: AssemblyVersion("3.2.32.5")]