diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-05-26 16:06:31 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-05-26 16:06:31 -0400 |
| commit | 8bd7055d1738f22e9f52cd80a79e7a4ac23d61ff (patch) | |
| tree | 185830059da50b6c43f13ca528fe981c1266808f /MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs | |
| parent | a3d796cd54c809c7ec2783e5cab6c37b2950410d (diff) | |
| parent | b666c627c8def4d1236090372bd6795fec940979 (diff) | |
Merge pull request #1109 from MediaBrowser/dev
3.0.5621.3
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs b/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs index 23ecde191..c47332dbe 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs @@ -45,19 +45,15 @@ namespace MediaBrowser.Server.Implementations.HttpServer } } - if (dto is CompressedResult) - { - // Per Google PageSpeed - // This instructs the proxies to cache two versions of the resource: one compressed, and one uncompressed. - // The correct version of the resource is delivered based on the client request header. - // This is a good choice for applications that are singly homed and depend on public proxies for user locality. - res.AddHeader("Vary", "Accept-Encoding"); - } + var vary = "Accept-Encoding"; var hasOptions = dto as IHasOptions; + var sharpResponse = res as WebSocketSharpResponse; if (hasOptions != null) { + //hasOptions.Options["Server"] = "Mono-HTTPAPI/1.1"; + // Content length has to be explicitly set on on HttpListenerResponse or it won't be happy string contentLength; @@ -79,14 +75,29 @@ namespace MediaBrowser.Server.Implementations.HttpServer return; } - var sharpResponse = res as WebSocketSharpResponse; if (sharpResponse != null) { sharpResponse.SendChunked = false; } } } + + string hasOptionsVary; + if (hasOptions.Options.TryGetValue("Vary", out hasOptionsVary)) + { + vary = hasOptionsVary; + } + + hasOptions.Options["Vary"] = vary; } + + //res.KeepAlive = false; + + // Per Google PageSpeed + // This instructs the proxies to cache two versions of the resource: one compressed, and one uncompressed. + // The correct version of the resource is delivered based on the client request header. + // This is a good choice for applications that are singly homed and depend on public proxies for user locality. + res.AddHeader("Vary", vary); } /// <summary> |
