aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs12
-rw-r--r--Emby.Server.Implementations/packages.config2
-rw-r--r--MediaBrowser.Api/Playback/Hls/BaseHlsService.cs3
-rw-r--r--ServiceStack/HttpResponseExtensionsInternal.cs2
-rw-r--r--SocketHttpListener.Portable/Net/HttpConnection.cs4
-rw-r--r--SocketHttpListener.Portable/Net/HttpListenerResponse.cs16
-rw-r--r--SocketHttpListener.Portable/Net/ResponseStream.cs2
7 files changed, 32 insertions, 9 deletions
diff --git a/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs b/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs
index dc049cbde..36f795411 100644
--- a/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs
+++ b/Emby.Server.Implementations/HttpServer/SocketSharp/WebSocketSharpResponse.cs
@@ -4,6 +4,7 @@ using System.IO;
using System.Net;
using System.Text;
using MediaBrowser.Model.Logging;
+using SocketHttpListener.Net;
using HttpListenerResponse = SocketHttpListener.Net.HttpListenerResponse;
using IHttpResponse = MediaBrowser.Model.Services.IHttpResponse;
using IRequest = MediaBrowser.Model.Services.IRequest;
@@ -101,12 +102,15 @@ namespace Emby.Server.Implementations.HttpServer.SocketSharp
var outputStream = response.OutputStream;
// This is needed with compression
- //if (!string.IsNullOrWhiteSpace(GetHeader("Content-Encoding")))
+ if (outputStream is ResponseStream)
{
- outputStream.Flush();
- }
+ //if (!string.IsNullOrWhiteSpace(GetHeader("Content-Encoding")))
+ {
+ outputStream.Flush();
+ }
- outputStream.Dispose();
+ outputStream.Dispose();
+ }
response.Close();
}
catch (Exception ex)
diff --git a/Emby.Server.Implementations/packages.config b/Emby.Server.Implementations/packages.config
index 5d75af7a2..8464b9b37 100644
--- a/Emby.Server.Implementations/packages.config
+++ b/Emby.Server.Implementations/packages.config
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Emby.XmlTv" version="1.0.1" targetFramework="portable45-net45+win8" />
+ <package id="Emby.XmlTv" version="1.0.2" targetFramework="portable45-net45+win8" />
<package id="MediaBrowser.Naming" version="1.0.2" targetFramework="portable45-net45+win8" />
<package id="SQLitePCL.pretty" version="1.1.0" targetFramework="portable45-net45+win8" />
<package id="SQLitePCLRaw.core" version="1.1.1-pre20161109081005" targetFramework="portable45-net45+win8" />
diff --git a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
index 8d1c0a61e..690acb163 100644
--- a/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
+++ b/MediaBrowser.Api/Playback/Hls/BaseHlsService.cs
@@ -153,7 +153,8 @@ namespace MediaBrowser.Api.Playback.Hls
var newDuration = "#EXT-X-TARGETDURATION:" + segmentLength.ToString(UsCulture);
- text = text.Replace("#EXT-X-TARGETDURATION:" + (segmentLength + 1).ToString(UsCulture), newDuration, StringComparison.OrdinalIgnoreCase);
+ text = text.Replace("#EXT-X-TARGETDURATION:" + (segmentLength - 1).ToString(UsCulture), newDuration, StringComparison.OrdinalIgnoreCase);
+ //text = text.Replace("#EXT-X-TARGETDURATION:" + (segmentLength + 1).ToString(UsCulture), newDuration, StringComparison.OrdinalIgnoreCase);
return text;
}
diff --git a/ServiceStack/HttpResponseExtensionsInternal.cs b/ServiceStack/HttpResponseExtensionsInternal.cs
index f78647721..feb18081a 100644
--- a/ServiceStack/HttpResponseExtensionsInternal.cs
+++ b/ServiceStack/HttpResponseExtensionsInternal.cs
@@ -130,7 +130,7 @@ namespace ServiceStack
{
foreach (var responseHeaders in responseOptions.Headers)
{
- if (responseHeaders.Key == "Content-Length")
+ if (string.Equals(responseHeaders.Key, "Content-Length", StringComparison.OrdinalIgnoreCase))
{
response.SetContentLength(long.Parse(responseHeaders.Value));
continue;
diff --git a/SocketHttpListener.Portable/Net/HttpConnection.cs b/SocketHttpListener.Portable/Net/HttpConnection.cs
index b09d02254..4b54fc013 100644
--- a/SocketHttpListener.Portable/Net/HttpConnection.cs
+++ b/SocketHttpListener.Portable/Net/HttpConnection.cs
@@ -209,7 +209,9 @@ namespace SocketHttpListener.Net
// TODO: can we get this stream before reading the input?
if (o_stream == null)
{
- if (context.Response.SendChunked || isExpect100Continue || context.Response.ContentLength64 <= 0)
+ context.Response.DetermineIfChunked();
+
+ if (context.Response.SendChunked || isExpect100Continue || context.Request.IsWebSocketRequest)
{
o_stream = new ResponseStream(stream, context.Response, _memoryStreamFactory, _textEncoding);
}
diff --git a/SocketHttpListener.Portable/Net/HttpListenerResponse.cs b/SocketHttpListener.Portable/Net/HttpListenerResponse.cs
index 880473c0a..c1182de34 100644
--- a/SocketHttpListener.Portable/Net/HttpListenerResponse.cs
+++ b/SocketHttpListener.Portable/Net/HttpListenerResponse.cs
@@ -362,6 +362,22 @@ namespace SocketHttpListener.Net
return false;
}
+ public void DetermineIfChunked()
+ {
+ if (chunked)
+ {
+ return ;
+ }
+
+ Version v = context.Request.ProtocolVersion;
+ if (!cl_set && !chunked && v >= HttpVersion.Version11)
+ chunked = true;
+ if (!chunked && string.Equals(headers["Transfer-Encoding"], "chunked"))
+ {
+ chunked = true;
+ }
+ }
+
internal void SendHeaders(bool closing, MemoryStream ms)
{
Encoding encoding = content_encoding;
diff --git a/SocketHttpListener.Portable/Net/ResponseStream.cs b/SocketHttpListener.Portable/Net/ResponseStream.cs
index 7a6425dea..6067a89ec 100644
--- a/SocketHttpListener.Portable/Net/ResponseStream.cs
+++ b/SocketHttpListener.Portable/Net/ResponseStream.cs
@@ -14,7 +14,7 @@ namespace SocketHttpListener.Net
// Update: we send a single packet for the first non-chunked Write
// What happens when we set content-length to X and write X-1 bytes then close?
// what if we don't set content-length at all?
- class ResponseStream : Stream
+ public class ResponseStream : Stream
{
HttpListenerResponse response;
bool disposed;