diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-18 21:28:40 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-07-18 21:28:40 -0400 |
| commit | bc657237aa4c541fe0079fcbb7616dbe87bbf0a7 (patch) | |
| tree | 9484ae9d074f618f320b5cdd3d75482766cba591 /MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs | |
| parent | ea559a6e274c2067cda780ba81bc5237c9e2ebf7 (diff) | |
consolidate web socket onto one port
Diffstat (limited to 'MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs b/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs index ac1621709..e0a5764d5 100644 --- a/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs +++ b/MediaBrowser.Server.Implementations/HttpServer/ResponseFilter.cs @@ -1,4 +1,5 @@ using MediaBrowser.Model.Logging; +using MediaBrowser.Server.Implementations.HttpServer.SocketSharp; using ServiceStack; using ServiceStack.Web; using System; @@ -66,13 +67,23 @@ namespace MediaBrowser.Server.Implementations.HttpServer if (length > 0) { - var response = (HttpListenerResponse)res.OriginalResponse; - - response.ContentLength64 = length; - - // Disable chunked encoding. Technically this is only needed when using Content-Range, but - // anytime we know the content length there's no need for it - response.SendChunked = false; + res.SetContentLength(length); + + var listenerResponse = res.OriginalResponse as HttpListenerResponse; + + if (listenerResponse != null) + { + // Disable chunked encoding. Technically this is only needed when using Content-Range, but + // anytime we know the content length there's no need for it + listenerResponse.SendChunked = false; + return; + } + + var sharpResponse = res as WebSocketSharpResponse; + if (sharpResponse != null) + { + sharpResponse.SendChunked = false; + } } } } |
