Browse files

Fixed bug with OwinRequest

  • Loading branch information...
1 parent 9e96a52 commit 7f6b2847effeeae12e1da3f6e3857983d5dd64a7 @markrendle committed Oct 10, 2012
View
4 CommonAssemblyInfo.cs
@@ -14,5 +14,5 @@
[assembly: ComVisible(false)]
-[assembly: AssemblyVersion("0.5.3.0")]
-[assembly: AssemblyFileVersion("0.5.3.0")]
+[assembly: AssemblyVersion("0.5.3.1")]
+[assembly: AssemblyFileVersion("0.5.3.1")]
View
4 Simple.Web.AspNet.nuspec
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.Web.AspNet</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<copyright>Mark Rendle</copyright>
@@ -12,7 +12,7 @@
<description>For hosting Simple.Web applications under ASP.NET.</description>
<tags>simple.web</tags>
<dependencies>
- <dependency id="Simple.Web" version="0.5.3" />
+ <dependency id="Simple.Web" version="0.5.3.1" />
<dependency id="Fix.AspNet" version="0.2" />
</dependencies>
</metadata>
View
4 Simple.Web.Autofac.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Simple.Web.Autofac</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle, Kevin Stout</authors>
<owners>Mark Rendle, Kevin Stout</owners>
<copyright>Mark Rendle, Kevin Stout</copyright>
@@ -12,7 +12,7 @@
<description>Autofac support for Simple.Web, a REST-focused, object-oriented Web Framework for .NET 4.</description>
<tags>simple.web</tags>
<dependencies>
- <dependency id="Simple.Web" version="0.5.3" />
+ <dependency id="Simple.Web" version="0.5.3.1" />
<dependency id="Autofac" version="2.6.2.859" />
</dependencies>
</metadata>
View
4 Simple.Web.JsonFx.nuspec
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.Web.JsonFx</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<copyright>Mark Rendle</copyright>
@@ -13,7 +13,7 @@
<tags>simple.web</tags>
<dependencies>
<dependency id="JsonFx" version="2.0" />
- <dependency id="Simple.Web" version="0.5.3" />
+ <dependency id="Simple.Web" version="0.5.3.1" />
</dependencies>
</metadata>
<files>
View
4 Simple.Web.NInject.nuspec
@@ -2,7 +2,7 @@
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>Simple.Web.Ninject</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<copyright>Mark Rendle</copyright>
@@ -12,7 +12,7 @@
<description>Ninject support for Simple.Web, a REST-focused, object-oriented Web Framework for .NET 4.</description>
<tags>simple.web</tags>
<dependencies>
- <dependency id="Simple.Web" version="0.5.3" />
+ <dependency id="Simple.Web" version="0.5.3.1" />
<dependency id="Ninject" version="3.0" />
</dependencies>
</metadata>
View
4 Simple.Web.Razor.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Simple.Web.Razor</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<copyright>Mark Rendle</copyright>
@@ -12,7 +12,7 @@
<description>A REST-focused, object-oriented Web Framework for .NET 4.</description>
<tags>simple.web</tags>
<dependencies>
- <dependency id="Simple.Web" version="0.5.3" />
+ <dependency id="Simple.Web" version="0.5.3.1" />
<dependency id="AspNetWebPages.Core" version="2.0" />
</dependencies>
</metadata>
View
4 Simple.Web.StructureMap.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Simple.Web.StructureMap</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle, Roy Jacobs</authors>
<owners>Mark Rendle, Roy Jacobs</owners>
<copyright>Mark Rendle, Roy Jacobs</copyright>
@@ -12,7 +12,7 @@
<description>StructureMap support for Simple.Web, a REST-focused, object-oriented Web Framework for .NET 4.</description>
<tags>simple.web</tags>
<dependencies>
- <dependency id="Simple.Web" version="0.5.3" />
+ <dependency id="Simple.Web" version="0.5.3.1" />
<dependency id="structuremap" version="2.6.3" />
</dependencies>
</metadata>
View
2 Simple.Web.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>Simple.Web</id>
- <version>0.5.3</version>
+ <version>0.5.3.1</version>
<authors>Mark Rendle</authors>
<owners>Mark Rendle</owners>
<copyright>Mark Rendle</copyright>
View
22 Simple.Web/Owin/OwinRequest.cs
@@ -57,11 +57,16 @@ public IEnumerable<IPostedFile> Files
private static string MakeUriString(IDictionary<string, object> env, IDictionary<string, string[]> requestHeaders)
{
- var host = requestHeaders["Host"][0];
+ string[] hostHeaders;
+ string host = "localhost";
+ if (requestHeaders.TryGetValue("Host", out hostHeaders) && hostHeaders.Length > 0)
+ {
+ host = hostHeaders[0];
+ }
if (string.IsNullOrWhiteSpace(host)) host = "localhost";
- var scheme = env[OwinKeys.Scheme];
- var pathBase = env[OwinKeys.PathBase];
- var path = env[OwinKeys.Path];
+ var scheme = env.GetValueOrDefault(OwinKeys.Scheme, "http");
+ var pathBase = env.GetValueOrDefault(OwinKeys.PathBase, string.Empty);
+ var path = env.GetValueOrDefault(OwinKeys.Path, "/");
var uri = string.Format("{0}://{1}{2}{3}", scheme, host, pathBase, path);
object queryString;
if (env.TryGetValue(OwinKeys.QueryString, out queryString))
@@ -74,4 +79,13 @@ private static string MakeUriString(IDictionary<string, object> env, IDictionary
return uri;
}
}
+
+ internal static class DictionaryEx
+ {
+ public static TValue GetValueOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dictionary, TKey key, TValue defaultValue)
+ {
+ TValue value;
+ return dictionary.TryGetValue(key, out value) ? value : defaultValue;
+ }
+ }
}

0 comments on commit 7f6b284

Please sign in to comment.