fix mono project

This commit is contained in:
Luke Pulverenti 2016-11-12 17:46:38 -05:00
parent 1714cb8764
commit 102bbe2beb
6 changed files with 66 additions and 58 deletions

View File

@ -115,6 +115,34 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\BDInfo\BDInfo.csproj">
<Project>{88ae38df-19d7-406f-a6a9-09527719a21e}</Project>
<Name>BDInfo</Name>
</ProjectReference>
<ProjectReference Include="..\DvdLib\DvdLib.csproj">
<Project>{713f42b5-878e-499d-a878-e4c652b1d5e8}</Project>
<Name>DvdLib</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Dlna\Emby.Dlna.csproj">
<Project>{805844ab-e92f-45e6-9d99-4f6d48d129a5}</Project>
<Name>Emby.Dlna</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Drawing.ImageMagick\Emby.Drawing.ImageMagick.csproj">
<Project>{6cfee013-6e7c-432b-ac37-cabf0880c69a}</Project>
<Name>Emby.Drawing.ImageMagick</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Drawing.Net\Emby.Drawing.Net.csproj">
<Project>{c97a239e-a96c-4d64-a844-ccf8cc30aecb}</Project>
<Name>Emby.Drawing.Net</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Drawing\Emby.Drawing.csproj">
<Project>{08fff49b-f175-4807-a2b5-73b0ebd9f716}</Project>
<Name>Emby.Drawing</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Photos\Emby.Photos.csproj">
<Project>{89ab4548-770d-41fd-a891-8daff44f452c}</Project>
<Name>Emby.Photos</Name>
</ProjectReference>
<ProjectReference Include="..\Emby.Server.Implementations\Emby.Server.Implementations.csproj">
<Project>{e383961b-9356-4d5d-8233-9a1079d03055}</Project>
<Name>Emby.Server.Implementations</Name>
@ -163,6 +191,22 @@
<Project>{23499896-B135-4527-8574-C26E926EA99E}</Project>
<Name>MediaBrowser.XbmcMetadata</Name>
</ProjectReference>
<ProjectReference Include="..\OpenSubtitlesHandler\OpenSubtitlesHandler.csproj">
<Project>{4a4402d4-e910-443b-b8fc-2c18286a2ca0}</Project>
<Name>OpenSubtitlesHandler</Name>
</ProjectReference>
<ProjectReference Include="..\RSSDP\RSSDP.csproj">
<Project>{21002819-c39a-4d3e-be83-2a276a77fb1f}</Project>
<Name>RSSDP</Name>
</ProjectReference>
<ProjectReference Include="..\ServiceStack\ServiceStack.csproj">
<Project>{680a1709-25eb-4d52-a87f-ee03ffd94baa}</Project>
<Name>ServiceStack</Name>
</ProjectReference>
<ProjectReference Include="..\SocketHttpListener.Portable\SocketHttpListener.Portable.csproj">
<Project>{4f26d5d8-a7b0-42b3-ba42-7cb7d245934e}</Project>
<Name>SocketHttpListener.Portable</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="..\ThirdParty\SQLite3\osx\libsqlite3.0.dylib">

View File

@ -23,32 +23,13 @@ namespace ServiceStack.Host
var taskResult = ServiceStackHost.Instance.GetTaskResult(taskResponse, RequestName);
var taskResults = taskResult as Task[];
if (taskResults == null)
var subTask = taskResult as Task;
if (subTask != null)
{
var subTask = taskResult as Task;
if (subTask != null)
taskResult = ServiceStackHost.Instance.GetTaskResult(subTask, RequestName);
return taskResult;
taskResult = ServiceStackHost.Instance.GetTaskResult(subTask, RequestName);
}
if (taskResults.Length == 0)
{
return new object[] { };
}
var firstResponse = ServiceStackHost.Instance.GetTaskResult(taskResults[0], RequestName);
var batchedResponses = firstResponse != null
? (object[])Array.CreateInstance(firstResponse.GetType(), taskResults.Length)
: new object[taskResults.Length];
batchedResponses[0] = firstResponse;
for (var i = 1; i < taskResults.Length; i++)
{
batchedResponses[i] = ServiceStackHost.Instance.GetTaskResult(taskResults[i], RequestName);
}
return batchedResponses;
return taskResult;
}
protected static object CreateContentTypeRequest(IRequest httpReq, Type requestType, string contentType)
@ -141,18 +122,13 @@ namespace ServiceStack.Host
var request = httpReq.Dto = CreateRequest(httpReq, restPath);
if (appHost.ApplyRequestFilters(httpReq, httpRes, request))
return;
appHost.ApplyRequestFilters(httpReq, httpRes, request);
var rawResponse = await ServiceStackHost.Instance.ServiceController.Execute(request, httpReq).ConfigureAwait(false);
if (httpRes.IsClosed)
return;
var response = await HandleResponseAsync(rawResponse).ConfigureAwait(false);
if (appHost.ApplyResponseFilters(httpReq, httpRes, response))
return;
appHost.ApplyResponseFilters(httpReq, httpRes, response);
await httpRes.WriteToResponse(httpReq, response).ConfigureAwait(false);
}

View File

@ -14,10 +14,8 @@ namespace ServiceStack
/// and no more processing should be done.
/// </summary>
/// <returns></returns>
public virtual bool ApplyRequestFilters(IRequest req, IResponse res, object requestDto)
public virtual void ApplyRequestFilters(IRequest req, IResponse res, object requestDto)
{
if (res.IsClosed) return res.IsClosed;
//Exec all RequestFilter attributes with Priority < 0
var attributes = FilterAttributeCache.GetRequestFilterAttributes(requestDto.GetType());
var i = 0;
@ -25,16 +23,12 @@ namespace ServiceStack
{
var attribute = attributes[i];
attribute.RequestFilter(req, res, requestDto);
if (res.IsClosed) return res.IsClosed;
}
if (res.IsClosed) return res.IsClosed;
//Exec global filters
foreach (var requestFilter in GlobalRequestFilters)
{
requestFilter(req, res, requestDto);
if (res.IsClosed) return res.IsClosed;
}
//Exec remaining RequestFilter attributes with Priority >= 0
@ -42,10 +36,7 @@ namespace ServiceStack
{
var attribute = attributes[i];
attribute.RequestFilter(req, res, requestDto);
if (res.IsClosed) return res.IsClosed;
}
return res.IsClosed;
}
/// <summary>
@ -53,21 +44,13 @@ namespace ServiceStack
/// and no more processing should be done.
/// </summary>
/// <returns></returns>
public virtual bool ApplyResponseFilters(IRequest req, IResponse res, object response)
public virtual void ApplyResponseFilters(IRequest req, IResponse res, object response)
{
if (response != null)
{
if (res.IsClosed) return res.IsClosed;
}
//Exec global filters
foreach (var responseFilter in GlobalResponseFilters)
{
responseFilter(req, res, response);
if (res.IsClosed) return res.IsClosed;
}
return res.IsClosed;
}
}

View File

@ -204,12 +204,12 @@ namespace SocketHttpListener.Net
return i_stream;
}
public Stream GetResponseStream()
public Stream GetResponseStream(HttpListenerRequest request)
{
// TODO: can we get this stream before reading the input?
if (o_stream == null)
{
if (context.Response.SendChunked)
if (context.Response.SendChunked || request == null || request.HasExpect100Continue)
{
o_stream = new ResponseStream(stream, context.Response, _memoryStreamFactory, _textEncoding);
}
@ -490,7 +490,7 @@ namespace SocketHttpListener.Net
{
if (!context.Request.IsWebSocketRequest || force_close)
{
Stream st = GetResponseStream();
Stream st = GetResponseStream(context.Request);
if (st != null)
st.Dispose();

View File

@ -179,16 +179,21 @@ namespace SocketHttpListener.Net
}
}
if (String.Compare(Headers["Expect"], "100-continue", StringComparison.OrdinalIgnoreCase) == 0)
if (HasExpect100Continue)
{
var output = context.Connection.GetResponseStream();
var output = (ResponseStream)context.Connection.GetResponseStream(this);
var _100continue = _textEncoding.GetASCIIEncoding().GetBytes("HTTP/1.1 100 Continue\r\n\r\n");
//output.InternalWrite(_100continue, 0, _100continue.Length);
output.InternalWrite(_100continue, 0, _100continue.Length);
}
}
public bool HasExpect100Continue
{
get { return String.Compare(Headers["Expect"], "100-continue", StringComparison.OrdinalIgnoreCase) == 0; }
}
static bool MaybeUri(string s)
{
int p = s.IndexOf(':');

View File

@ -149,7 +149,7 @@ namespace SocketHttpListener.Net
get
{
if (output_stream == null)
output_stream = context.Connection.GetResponseStream();
output_stream = context.Connection.GetResponseStream(context.Request);
return output_stream;
}
}
@ -489,7 +489,7 @@ namespace SocketHttpListener.Net
int preamble = encoding.GetPreamble().Length;
if (output_stream == null)
output_stream = context.Connection.GetResponseStream();
output_stream = context.Connection.GetResponseStream(context.Request);
/* Assumes that the ms was at position 0 */
ms.Position = preamble;