Merge pull request #2315 from MediaBrowser/dev

Dev
This commit is contained in:
Luke 2016-11-28 00:42:25 -05:00 committed by GitHub
commit f92e245dff
10 changed files with 35 additions and 24 deletions

View File

@ -305,8 +305,8 @@
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
<Name>SocketHttpListener.Portable</Name>
</ProjectReference>
<Reference Include="Emby.XmlTv, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.1\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
<Reference Include="Emby.XmlTv, Version=1.0.6175.23736, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Emby.XmlTv.1.0.2\lib\portable-net45+win8\Emby.XmlTv.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="MediaBrowser.Naming, Version=1.0.6159.25070, Culture=neutral, processorArchitecture=MSIL">

View File

@ -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)

View File

@ -141,7 +141,7 @@ namespace Emby.Server.Implementations.LiveTv.Listings
ProductionYear = !p.CopyrightDate.HasValue ? (int?)null : p.CopyrightDate.Value.Year,
SeasonNumber = p.Episode == null ? null : p.Episode.Series,
IsSeries = p.Episode != null,
IsRepeat = p.IsRepeat,
IsRepeat = p.IsPreviouslyShown && !p.IsNew,
IsPremiere = p.Premiere != null,
IsKids = p.Categories.Any(c => info.KidsCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),
IsMovie = p.Categories.Any(c => info.MovieCategories.Contains(c, StringComparer.OrdinalIgnoreCase)),

View File

@ -100,18 +100,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
extInf = extInf.Trim();
//Check for channel number with the format from SatIp
//int number;
//var numberIndex = channel.Name.IndexOf('.');
//if (numberIndex > 0)
//{
// if (int.TryParse(channel.Name.Substring(0, numberIndex), out number))
// {
// channel.Number = number.ToString();
// channel.Name = channel.Name.Substring(numberIndex + 1);
// }
//}
channel.ImageUrl = FindProperty("tvg-logo", extInf);
channel.Name = GetChannelName(extInf);

View File

@ -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" />

View File

@ -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;
}

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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;