Permalink
Browse files

Merge pull request #92 from loudej/updating-ver

Bumping up to OWIN 0.12 ctp4
  • Loading branch information...
loudej committed Jul 27, 2012
2 parents 4792b7d + b2b1765 commit 6e2eb9a0438db8ba3347ad0cd93e182cc88a3e1b
Showing with 196 additions and 226 deletions.
  1. +1 −1 Sakefile.shade
  2. +2 −2 src/Adapters/Gate.Adapters.AspNetWebApi/Gate.Adapters.AspNetWebApi.csproj
  3. +8 −9 src/Adapters/Gate.Adapters.AspNetWebApi/WebApiAdapter.cs
  4. +1 −1 src/Adapters/Gate.Adapters.AspNetWebApi/packages.config
  5. +3 −2 src/Adapters/Gate.Adapters.Nancy/Gate.Adapters.Nancy.csproj
  6. +3 −3 src/Adapters/Gate.Adapters.Nancy/NancyAdapter.cs
  7. +1 −1 src/Adapters/Gate.Adapters.Nancy/packages.config
  8. +1 −1 src/CommonAssemblyInfo.cs
  9. +2 −14 src/Hosts/Gate.Hosts.AspNet/AppHandler.cs
  10. +2 −2 src/Hosts/Gate.Hosts.AspNet/Gate.Hosts.AspNet.csproj
  11. +1 −1 src/Hosts/Gate.Hosts.AspNet/packages.config
  12. +2 −2 src/Hosts/Gate.Hosts.Firefly/Gate.Hosts.Firefly.csproj
  13. +1 −1 src/Hosts/Gate.Hosts.Firefly/packages.config
  14. +2 −2 src/Hosts/Gate.Hosts.HttpListener/Gate.Hosts.HttpListener.csproj
  15. +1 −1 src/Hosts/Gate.Hosts.HttpListener/ServerFactory.cs
  16. +1 −1 src/Hosts/Gate.Hosts.HttpListener/packages.config
  17. +4 −2 src/Hosts/Gate.Hosts.Kayak/DataProducer.cs
  18. +2 −2 src/Hosts/Gate.Hosts.Kayak/Gate.Hosts.Kayak.csproj
  19. +0 −1 src/Hosts/Gate.Hosts.Kayak/GateRequestDelegate.cs
  20. +1 −1 src/Hosts/Gate.Hosts.Kayak/packages.config
  21. +5 −4 src/Hosts/Gate.Hosts/ErrorPage.cs
  22. +9 −12 src/Hosts/Gate.Hosts/ExecutionContextPerRequest.cs
  23. +3 −2 src/Hosts/Gate.Hosts/Gate.Hosts.csproj
  24. +1 −1 src/Hosts/Gate.Hosts/packages.config
  25. +5 −22 src/Main/Gate.Builder/Adapters.cs
  26. +0 −2 src/Main/Gate.Builder/AppBuilder.cs
  27. +3 −2 src/Main/Gate.Builder/Gate.Builder.csproj
  28. +1 −1 src/Main/Gate.Builder/NotFound.cs
  29. +1 −1 src/Main/Gate.Builder/packages.config
  30. +3 −3 src/Main/Gate.Middleware/Chunked.cs
  31. +7 −8 src/Main/Gate.Middleware/ContentLength.cs
  32. +2 −2 src/Main/Gate.Middleware/Gate.Middleware.csproj
  33. +1 −1 src/Main/Gate.Middleware/NotFound.cs
  34. +3 −3 src/Main/Gate.Middleware/ShowExceptions.cs
  35. +5 −5 src/Main/Gate.Middleware/StaticFiles/FileBody.cs
  36. +2 −1 src/Main/Gate.Middleware/StaticFiles/FileServer.cs
  37. +4 −4 src/Main/Gate.Middleware/StaticFiles/TextBody.cs
  38. +1 −1 src/Main/Gate.Middleware/packages.config
  39. +3 −2 src/Main/Gate/Gate.csproj
  40. +1 −0 src/Main/Gate/OwinConstants.cs
  41. +7 −8 src/Main/Gate/Request.cs
  42. +14 −14 src/Main/Gate/Response.cs
  43. +1 −2 src/Main/Gate/ResponseStream.cs
  44. +1 −1 src/Main/Gate/packages.config
  45. +3 −2 src/Samples/Sample.AspNetWebApi/Sample.AspNetWebApi.csproj
  46. +1 −1 src/Samples/Sample.AspNetWebApi/packages.config
  47. +3 −2 src/Samples/Sample.HelloWorld/Sample.HelloWorld.csproj
  48. +1 −1 src/Samples/Sample.HelloWorld/packages.config
  49. +2 −2 src/Samples/Sample.Nancy/Sample.Nancy.csproj
  50. +1 −1 src/Samples/Sample.Nancy/packages.config
  51. +2 −2 src/Samples/Samples.ViaRouting/Samples.ViaRouting.csproj
  52. +1 −1 src/Samples/Samples.ViaRouting/Startup.cs
  53. +1 −1 src/Samples/Samples.ViaRouting/packages.config
  54. +6 −8 src/Tests/Gate.Builder.Tests/AppBuilderTests.cs
  55. +3 −2 src/Tests/Gate.Builder.Tests/Gate.Builder.Tests.csproj
  56. +1 −1 src/Tests/Gate.Builder.Tests/packages.config
  57. +2 −2 src/Tests/Gate.Hosts.AspNet.Tests/Gate.Hosts.AspNet.Tests.csproj
  58. +1 −1 src/Tests/Gate.Hosts.AspNet.Tests/packages.config
  59. +2 −2 src/Tests/Gate.Hosts.HttpListener.Tests/Gate.Hosts.HttpListener.Tests.csproj
  60. +1 −1 src/Tests/Gate.Hosts.HttpListener.Tests/Startup.cs
  61. +1 −1 src/Tests/Gate.Hosts.HttpListener.Tests/packages.config
  62. +2 −2 src/Tests/Gate.Hosts.Kayak.Tests/Gate.Hosts.Kayak.Tests.csproj
  63. +1 −1 src/Tests/Gate.Hosts.Kayak.Tests/packages.config
  64. +4 −4 src/Tests/Gate.Middleware.Tests/CascadeTests.cs
  65. +2 −2 src/Tests/Gate.Middleware.Tests/ChunkedTests.cs
  66. +2 −2 src/Tests/Gate.Middleware.Tests/Gate.Middleware.Tests.csproj
  67. +3 −2 src/Tests/Gate.Middleware.Tests/MethodOverrideTests.cs
  68. +3 −3 src/Tests/Gate.Middleware.Tests/ShowExceptionsTests.cs
  69. +3 −2 src/Tests/Gate.Middleware.Tests/StaticFiles/FileServerTests.cs
  70. +1 −1 src/Tests/Gate.Middleware.Tests/packages.config
  71. +3 −2 src/Tests/Gate.TestHelpers/Gate.TestHelpers.csproj
  72. +8 −11 src/Tests/Gate.TestHelpers/TestHttpClient.cs
  73. +1 −1 src/Tests/Gate.TestHelpers/packages.config
  74. +2 −2 src/Tests/Gate.Tests/Gate.Tests.csproj
  75. +1 −2 src/Tests/Gate.Tests/RequestTests.cs
  76. +3 −2 src/Tests/Gate.Tests/ResponseTests.cs
  77. +2 −2 src/Tests/Gate.Tests/TestClientTests.cs
  78. +0 −1 src/Tests/Gate.Tests/UrlMapperTests.cs
  79. +1 −1 src/Tests/Gate.Tests/packages.config
View
@@ -1,7 +1,7 @@
var PROJECT='Gate'
var VERSION='0.12'
-var FULL_VERSION='${VERSION}-ctp3'
+var FULL_VERSION='${VERSION}-ctp4'
var AUTHORS='${PROJECT} contributors'
var BASE_DIR='${Directory.GetCurrentDirectory()}'
@@ -45,9 +45,9 @@
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\packages\Newtonsoft.Json.4.5.5\lib\net40\Newtonsoft.Json.dll</HintPath>
</Reference>
- <Reference Include="Owin, Version=0.11.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Net.Http, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
@@ -68,7 +68,7 @@ public static AppDelegate App(HttpServer server)
var owinRequestProtocol = Get<string>(call.Environment, "owin.RequestProtocol");
var owinRequestHeaders = call.Headers;
var owinRequestBody = call.Body;
- var cancellationToken = call.Completed;
+ var owinCallCompleted = Get<Task>(call.Environment, "owin.CallCompleted");
var uriBuilder =
new UriBuilder(owinRequestScheme, "localhost")
@@ -99,8 +99,11 @@ public static AppDelegate App(HttpServer server)
}
}
}
-
- return invoker.SendAsync(request, cancellationToken)
+
+ var cts = new CancellationTokenSource();
+ owinCallCompleted.Finally(() => cts.Cancel(false));
+
+ return invoker.SendAsync(request, cts.Token)
.Then(response =>
{
ResultParameters result = new ResultParameters();
@@ -131,18 +134,14 @@ private static T Get<T>(IDictionary<string, object> env, string name)
}
- private static BodyDelegate GetResponseBody(HttpContent content)
+ private static Func<Stream, Task> GetResponseBody(HttpContent content)
{
if (content == null)
{
return null;
}
- return (output, cancel) =>
- {
- cancel.ThrowIfCancellationRequested();
- return content.CopyToAsync(output);
- };
+ return output => content.CopyToAsync(output);
}
}
}
@@ -4,6 +4,6 @@
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.20516.0" />
<package id="Microsoft.Net.Http" version="2.0.20516.0" />
<package id="Newtonsoft.Json" version="4.5.5" />
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
@@ -37,8 +37,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Nancy.0.11.0\lib\net40\Nancy.dll</HintPath>
</Reference>
- <Reference Include="Owin, Version=0.11.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
@@ -43,7 +43,7 @@ public static AppDelegate App(INancyBootstrapper bootstrapper)
var owinRequestQueryString = Get<string>(env, OwinConstants.RequestQueryString);
var owinRequestBody = call.Body;
var serverClientIp = Get<string>(env, "server.CLIENT_IP");
- var callDisposing = call.Completed;
+ var callCompleted = Get<Task>(env, OwinConstants.CallCompleted);
var url = new Url
{
@@ -69,7 +69,7 @@ public static AppDelegate App(INancyBootstrapper bootstrapper)
nancyRequest,
context =>
{
- callDisposing.Register(context.Dispose);
+ callCompleted.Finally(context.Dispose);
var nancyResponse = context.Response;
var headers = nancyResponse.Headers.ToDictionary(kv => kv.Key, kv => new[] { kv.Value }, StringComparer.OrdinalIgnoreCase);
@@ -85,7 +85,7 @@ public static AppDelegate App(INancyBootstrapper bootstrapper)
{
Status = (int)nancyResponse.StatusCode,
Headers = headers,
- Body = (output, cancel) =>
+ Body = output =>
{
nancyResponse.Contents(output);
return TaskHelpers.Completed();
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Nancy" version="0.11.0" />
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
@@ -13,4 +13,4 @@
[assembly: AssemblyVersion("0.12")]
[assembly: AssemblyFileVersion("0.12")]
-[assembly: AssemblyInformationalVersion("0.12-ctp3")]
+[assembly: AssemblyInformationalVersion("0.12")]
@@ -22,7 +22,6 @@ public AppHandler(AppDelegate app)
public IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, object state)
{
- var cancellationTokenSource = new CancellationTokenSource();
var taskCompletionSource = new TaskCompletionSource<Action>(state);
if (callback != null)
taskCompletionSource.Task.ContinueWith(task => callback(task), TaskContinuationOptions.ExecuteSynchronously);
@@ -45,8 +44,6 @@ public IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallba
call.Body = httpRequest.InputStream;
- call.Completed = cancellationTokenSource.Token;
-
call.Environment = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase)
{
{OwinConstants.Version, "1.0"},
@@ -57,6 +54,7 @@ public IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallba
{OwinConstants.RequestQueryString, serverVariables.QueryString},
{OwinConstants.RequestProtocol, serverVariables.ProtocolVersion},
{"aspnet.HttpContextBase", httpContext},
+ {OwinConstants.CallCompleted, taskCompletionSource.Task},
};
foreach (var kv in serverVariables.AddToEnvironment())
{
@@ -84,8 +82,7 @@ public IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallba
if (result.Body != null)
{
- // TODO: Cancellation?
- result.Body(httpContext.Response.OutputStream, cancellationTokenSource.Token)
+ result.Body(httpContext.Response.OutputStream)
.Then(() =>
{
taskCompletionSource.TrySetResult(() => { });
@@ -113,15 +110,6 @@ public IAsyncResult BeginProcessRequest(HttpContextBase httpContext, AsyncCallba
taskCompletionSource.TrySetException(ex);
}
- if (taskCompletionSource.Task.IsCompleted)
- {
- cancellationTokenSource.Cancel(false);
- }
- else
- {
- taskCompletionSource.Task.ContinueWith(t => cancellationTokenSource.Cancel(false));
- }
-
return taskCompletionSource.Task;
}
@@ -36,9 +36,9 @@
<Private>True</Private>
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
- <Reference Include="Owin, Version=0.11.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" />
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
@@ -49,9 +49,9 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Firefly.0.4\lib\net40\Firefly.dll</HintPath>
</Reference>
- <Reference Include="Owin, Version=0.11.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Firefly" version="0.4" />
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
@@ -33,9 +33,9 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
- <Reference Include="Owin, Version=0.11.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
@@ -118,7 +118,7 @@ public static IDisposable Create(AppDelegate app, int port, string path)
{
try
{
- Task bodyTask = result.Body(context.Response.OutputStream, CancellationToken.None);
+ Task bodyTask = result.Body(context.Response.OutputStream);
bodyTask.ContinueWith(task => context.Response.Abort(), TaskContinuationOptions.NotOnRanToCompletion);
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
@@ -1,15 +1,17 @@
using System;
+using System.IO;
using System.Threading;
+using System.Threading.Tasks;
using Owin;
using Kayak;
namespace Gate.Hosts.Kayak
{
class DataProducer : IDataProducer
{
- readonly BodyDelegate del;
+ readonly Func<Stream, Task> del;
- public DataProducer(BodyDelegate del)
+ public DataProducer(Func<Stream, Task> del)
{
this.del = del;
}
@@ -35,9 +35,9 @@
<Reference Include="Kayak, Version=0.7.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Kayak.0.7.2\lib\Kayak.dll</HintPath>
</Reference>
- <Reference Include="Owin, Version=0.11.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -25,7 +25,6 @@ public GateRequestDelegate(AppDelegate appDelegate, IDictionary<string, object>
public void OnRequest(HttpRequestHead head, IDataProducer body, IHttpResponseDelegate response)
{
var request = new CallParameters();
- request.Completed = CancellationToken.None; // TODO:
request.Environment = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
var requestWrapper = new RequestEnvironment(request.Environment);
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Kayak" version="0.7.2" />
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.IO;
using System.Text;
using Owin;
using System.Threading.Tasks;
@@ -35,12 +36,12 @@ public static AppDelegate Middleware(AppDelegate app, Action<Exception> logError
{
if (result.Body != null)
{
- BodyDelegate nestedBody = result.Body;
- result.Body = (stream, cancel) =>
+ var nestedBody = result.Body;
+ result.Body = stream =>
{
try
{
- return nestedBody(stream, cancel)
+ return nestedBody(stream)
.Catch(errorInfo =>
{
logError(errorInfo.Exception);
@@ -83,7 +84,7 @@ private static ResultParameters CreateErrorResponse()
{
{ "Content-Type", new[] { "text/html" } }
},
- Body = (stream, cancel) =>
+ Body = stream =>
{
stream.Write(Body.Array, Body.Offset, Body.Count);
return TaskHelpers.Completed();
@@ -29,22 +29,19 @@ static ResultParameters WrapBodyDelegate(ResultParameters result)
{
if (result.Body != null)
{
- BodyDelegate nestedBody = result.Body;
- result.Body = (stream, cancel) =>
+ var nestedBody = result.Body;
+ result.Body = stream =>
{
TaskCompletionSource<object> tcs = new TaskCompletionSource<object>();
ExecutionContext.SuppressFlow();
ThreadPool.QueueUserWorkItem(
- _ =>
- {
- nestedBody(stream, cancel)
- .Then(() => { bool ignored = tcs.TrySetResult(null); })
- .Catch(errorInfo =>
- {
- bool ignored = tcs.TrySetException(errorInfo.Exception);
- return errorInfo.Handled();
- });
- },
+ _ => nestedBody(stream)
+ .Then(() => { bool ignored = tcs.TrySetResult(null); })
+ .Catch(errorInfo =>
+ {
+ bool ignored = tcs.TrySetException(errorInfo.Exception);
+ return errorInfo.Handled();
+ }),
null);
ExecutionContext.RestoreFlow();
return tcs.Task;
@@ -43,8 +43,9 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
- <Reference Include="Owin">
- <HintPath>..\..\..\packages\Owin.0.11\lib\net40\Owin.dll</HintPath>
+ <Reference Include="Owin, Version=0.12.0.0, Culture=neutral, PublicKeyToken=f585506a2da1fef4, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\..\..\packages\Owin.0.12-ctp4\lib\net40\Owin.dll</HintPath>
</Reference>
<Reference Include="System" />
</ItemGroup>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
- <package id="Owin" version="0.11" />
+ <package id="Owin" version="0.12-ctp4" />
<package id="TaskHelpers.Sources" version="0.1" />
</packages>
Oops, something went wrong.

0 comments on commit 6e2eb9a

Please sign in to comment.