Skip to content
This repository was archived by the owner on Nov 20, 2018. It is now read-only.

Commit c62c2b3

Browse files
committed
Merge branch 'release' of github.com:aspnet/HttpAbstractions into release
2 parents 118fc73 + 15a51e4 commit c62c2b3

File tree

187 files changed

+13477
-790
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

187 files changed

+13477
-790
lines changed

HttpAbstractions.sln

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 14
4-
VisualStudioVersion = 14.0.21916.0
4+
VisualStudioVersion = 14.0.22513.0
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A5A15F1C-885A-452A-A731-B0173DDBD913}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{F31FF137-390C-49BF-A3BD-7C6ED3597C21}"
99
EndProject
10-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.PipelineCore", "src\Microsoft.AspNet.PipelineCore\Microsoft.AspNet.PipelineCore.kproj", "{BCF0F967-8753-4438-BD07-AADCA9CE509A}"
10+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Core", "src\Microsoft.AspNet.Http.Core\Microsoft.AspNet.Http.Core.kproj", "{BCF0F967-8753-4438-BD07-AADCA9CE509A}"
1111
EndProject
1212
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http", "src\Microsoft.AspNet.Http\Microsoft.AspNet.Http.kproj", "{22071333-15BA-4D16-A1D5-4D5B1A83FBDD}"
1313
EndProject
14-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.HttpFeature", "src\Microsoft.AspNet.HttpFeature\Microsoft.AspNet.HttpFeature.kproj", "{D9128247-8F97-48B8-A863-F1F21A029FCE}"
14+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Interfaces", "src\Microsoft.AspNet.Http.Interfaces\Microsoft.AspNet.Http.Interfaces.kproj", "{D9128247-8F97-48B8-A863-F1F21A029FCE}"
1515
EndProject
1616
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FeatureModel", "src\Microsoft.AspNet.FeatureModel\Microsoft.AspNet.FeatureModel.kproj", "{32A4C918-30EE-41DB-8E26-8A3BB88ED231}"
1717
EndProject
18-
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.PipelineCore.Tests", "test\Microsoft.AspNet.PipelineCore.Tests\Microsoft.AspNet.PipelineCore.Tests.kproj", "{AA99AF26-F7B1-4A6B-A922-5C25539F6391}"
18+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.Http.Core.Tests", "test\Microsoft.AspNet.Http.Core.Tests\Microsoft.AspNet.Http.Core.Tests.kproj", "{AA99AF26-F7B1-4A6B-A922-5C25539F6391}"
1919
EndProject
2020
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.FeatureModel.Tests", "test\Microsoft.AspNet.FeatureModel.Tests\Microsoft.AspNet.FeatureModel.Tests.kproj", "{C5D2BAE1-E182-48A0-AA74-1AF14B782BF7}"
2121
EndProject
@@ -33,6 +33,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.WebUtiliti
3333
EndProject
3434
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.WebUtilities.Tests", "test\Microsoft.AspNet.WebUtilities.Tests\Microsoft.AspNet.WebUtilities.Tests.kproj", "{93C10E50-BCBB-4D8E-9492-D46E1396225B}"
3535
EndProject
36+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Headers", "src\Microsoft.Net.Http.Headers\Microsoft.Net.Http.Headers.kproj", "{60AA2FDB-8121-4826-8D00-9A143FEFAF66}"
37+
EndProject
38+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.Net.Http.Headers.Tests", "test\Microsoft.Net.Http.Headers.Tests\Microsoft.Net.Http.Headers.Tests.kproj", "{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}"
39+
EndProject
3640
Global
3741
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3842
Debug|Any CPU = Debug|Any CPU
@@ -173,6 +177,30 @@ Global
173177
{93C10E50-BCBB-4D8E-9492-D46E1396225B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
174178
{93C10E50-BCBB-4D8E-9492-D46E1396225B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
175179
{93C10E50-BCBB-4D8E-9492-D46E1396225B}.Release|x86.ActiveCfg = Release|Any CPU
180+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
181+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Debug|Any CPU.Build.0 = Debug|Any CPU
182+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
183+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
184+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Debug|x86.ActiveCfg = Debug|Any CPU
185+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Debug|x86.Build.0 = Debug|Any CPU
186+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Release|Any CPU.ActiveCfg = Release|Any CPU
187+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Release|Any CPU.Build.0 = Release|Any CPU
188+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
189+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Release|Mixed Platforms.Build.0 = Release|Any CPU
190+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Release|x86.ActiveCfg = Release|Any CPU
191+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66}.Release|x86.Build.0 = Release|Any CPU
192+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
193+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Debug|Any CPU.Build.0 = Debug|Any CPU
194+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
195+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
196+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Debug|x86.ActiveCfg = Debug|Any CPU
197+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Debug|x86.Build.0 = Debug|Any CPU
198+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|Any CPU.ActiveCfg = Release|Any CPU
199+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|Any CPU.Build.0 = Release|Any CPU
200+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
201+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
202+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|x86.ActiveCfg = Release|Any CPU
203+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1}.Release|x86.Build.0 = Release|Any CPU
176204
EndGlobalSection
177205
GlobalSection(SolutionProperties) = preSolution
178206
HideSolutionNode = FALSE
@@ -191,5 +219,7 @@ Global
191219
{AE25EF21-7F91-4B86-B73E-AF746821D339} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21}
192220
{A2FB7838-0031-4FAD-BA3E-83C30B3AF406} = {A5A15F1C-885A-452A-A731-B0173DDBD913}
193221
{93C10E50-BCBB-4D8E-9492-D46E1396225B} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21}
222+
{60AA2FDB-8121-4826-8D00-9A143FEFAF66} = {A5A15F1C-885A-452A-A731-B0173DDBD913}
223+
{E6BB7AD1-BD10-4A23-B780-F4A86ADF00D1} = {F31FF137-390C-49BF-A3BD-7C6ED3597C21}
194224
EndGlobalSection
195225
EndGlobal

build.cmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ IF EXIST packages\KoreBuild goto run
1919
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
2020
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion
2121

22-
IF "%SKIP_KRE_INSTALL%"=="1" goto run
23-
CALL packages\KoreBuild\build\kvm upgrade -runtime CLR -x86
24-
CALL packages\KoreBuild\build\kvm install default -runtime CoreCLR -x86
22+
IF "%SKIP_DOTNET_INSTALL%"=="1" goto run
23+
CALL packages\KoreBuild\build\dotnetsdk upgrade -runtime CLR -x86
24+
CALL packages\KoreBuild\build\dotnetsdk install default -runtime CoreCLR -x86
2525

2626
:run
27-
CALL packages\KoreBuild\build\kvm use default -runtime CLR -x86
27+
CALL packages\KoreBuild\build\dotnetsdk use default -runtime CLR -x86
2828
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ if test ! -d packages/KoreBuild; then
2828
fi
2929

3030
if ! type k > /dev/null 2>&1; then
31-
source packages/KoreBuild/build/kvm.sh
31+
source packages/KoreBuild/build/dotnetsdk.sh
3232
fi
3333

3434
if ! type k > /dev/null 2>&1; then
35-
kvm upgrade
35+
dotnetsdk upgrade
3636
fi
3737

3838
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"

src/Microsoft.AspNet.FeatureModel/Microsoft.AspNet.FeatureModel.kproj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<PropertyGroup>
44
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
@@ -14,4 +14,9 @@
1414
<SchemaVersion>2.0</SchemaVersion>
1515
</PropertyGroup>
1616
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
17-
</Project>
17+
<ProjectExtensions>
18+
<VisualStudio>
19+
<UserProperties project_1json__JSONSchema="http://www.asp.net/media/4878834/project.json" />
20+
</VisualStudio>
21+
</ProjectExtensions>
22+
</Project>

src/Microsoft.AspNet.FeatureModel/project.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"version": "1.0.0-*",
33
"description": "ASP.NET 5 HTTP feature infrastructure.",
44
"dependencies": {
5-
"Microsoft.Framework.Runtime.Interfaces": "1.0.0-*"
65
},
76
"frameworks": {
87
"aspnet50": {},
@@ -14,7 +13,7 @@
1413
"System.Reflection.TypeExtensions": "4.0.0-beta-*",
1514
"System.Runtime": "4.0.20-beta-*",
1615
"System.Runtime.InteropServices": "4.0.20-beta-*",
17-
"System.Threading": "4.0.0-beta-*"
16+
"System.Threading": "4.0.10-beta-*"
1817
}
1918
}
2019
}
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System;
5+
using System.IO;
6+
using Microsoft.AspNet.Http;
7+
using Microsoft.AspNet.WebUtilities;
8+
9+
namespace Microsoft.AspNet.Http.Core
10+
{
11+
public static class BufferingHelper
12+
{
13+
internal const int DefaultBufferThreshold = 1024 * 30;
14+
15+
public static string TempDirectory
16+
{
17+
get
18+
{
19+
var temp = Environment.GetEnvironmentVariable("ASPNET_TEMP");
20+
if (string.IsNullOrEmpty(temp))
21+
{
22+
temp = Environment.GetEnvironmentVariable("TEMP");
23+
}
24+
25+
if (!Directory.Exists(temp))
26+
{
27+
// TODO: ???
28+
throw new DirectoryNotFoundException(temp);
29+
}
30+
31+
return temp;
32+
}
33+
}
34+
35+
public static HttpRequest EnableRewind([NotNull] this HttpRequest request, int bufferThreshold = DefaultBufferThreshold)
36+
{
37+
var body = request.Body;
38+
if (!body.CanSeek)
39+
{
40+
// TODO: Register this buffer for disposal at the end of the request to ensure the temp file is deleted.
41+
// Otherwise it won't get deleted until GC closes the stream.
42+
request.Body = new FileBufferingReadStream(body, bufferThreshold, TempDirectory);
43+
}
44+
return request;
45+
}
46+
}
47+
}
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,27 @@
11
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
33

4-
using Microsoft.AspNet.Http;
54
using System.Collections.Generic;
5+
using Microsoft.AspNet.Http;
66

7-
namespace Microsoft.AspNet.WebUtilities.Collections
7+
namespace Microsoft.AspNet.Http.Core.Collections
88
{
99
/// <summary>
1010
/// Contains the parsed form values.
1111
/// </summary>
1212
public class FormCollection : ReadableStringCollection, IFormCollection
1313
{
14-
/// <summary>
15-
/// Initializes a new instance of the <see cref="T:Microsoft.AspNet.WebUtilities.FormCollection" /> class.
16-
/// </summary>
17-
/// <param name="store">The store for the form.</param>
18-
public FormCollection(IDictionary<string, string[]> store)
14+
public FormCollection([NotNull] IDictionary<string, string[]> store)
15+
: this(store, new FormFileCollection())
16+
{
17+
}
18+
19+
public FormCollection([NotNull] IDictionary<string, string[]> store, [NotNull] IFormFileCollection files)
1920
: base(store)
2021
{
22+
Files = files;
2123
}
24+
25+
public IFormFileCollection Files { get; private set; }
2226
}
2327
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
2+
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3+
4+
using System.Collections.Generic;
5+
using Microsoft.AspNet.Http;
6+
using Microsoft.Net.Http.Headers;
7+
8+
namespace Microsoft.AspNet.Http.Core.Collections
9+
{
10+
public class FormFileCollection : List<IFormFile>, IFormFileCollection
11+
{
12+
public IFormFile this[string name]
13+
{
14+
get { return GetFile(name); }
15+
}
16+
17+
public IFormFile GetFile(string name)
18+
{
19+
return Find(file => string.Equals(name, GetName(file.ContentDisposition)));
20+
}
21+
22+
public IList<IFormFile> GetFiles(string name)
23+
{
24+
return FindAll(file => string.Equals(name, GetName(file.ContentDisposition)));
25+
}
26+
27+
private static string GetName(string contentDisposition)
28+
{
29+
// Content-Disposition: form-data; name="myfile1"; filename="Misc 002.jpg"
30+
ContentDispositionHeaderValue cd;
31+
ContentDispositionHeaderValue.TryParse(contentDisposition, out cd);
32+
return HeaderUtilities.RemoveQuotes(cd?.Name);
33+
}
34+
}
35+
}

src/Microsoft.AspNet.PipelineCore/Collections/HeaderDictionary.cs renamed to src/Microsoft.AspNet.Http.Core/Collections/HeaderDictionary.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,25 @@
77
using System.Linq;
88
using Microsoft.AspNet.Http.Infrastructure;
99
using Microsoft.AspNet.Http;
10-
using Microsoft.AspNet.PipelineCore.Infrastructure;
10+
using Microsoft.AspNet.Http.Core.Infrastructure;
1111

12-
namespace Microsoft.AspNet.PipelineCore.Collections
12+
namespace Microsoft.AspNet.Http.Core.Collections
1313
{
1414
/// <summary>
1515
/// Represents a wrapper for owin.RequestHeaders and owin.ResponseHeaders.
1616
/// </summary>
1717
public class HeaderDictionary : IHeaderDictionary
1818
{
19+
public HeaderDictionary() : this(new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase))
20+
{
21+
}
22+
1923
/// <summary>
2024
/// Initializes a new instance of the <see cref="T:Microsoft.Owin.HeaderDictionary" /> class.
2125
/// </summary>
2226
/// <param name="store">The underlying data store.</param>
23-
public HeaderDictionary(IDictionary<string, string[]> store)
27+
public HeaderDictionary([NotNull] IDictionary<string, string[]> store)
2428
{
25-
if (store == null)
26-
{
27-
throw new ArgumentNullException("store");
28-
}
29-
3029
Store = store;
3130
}
3231

0 commit comments

Comments
 (0)