Clean up and update to post RTM
This commit is contained in:
parent
a14bb69d6a
commit
1628d42b43
|
|
@ -2,7 +2,6 @@
|
|||
[Bb]in/
|
||||
TestResults/
|
||||
.nuget/
|
||||
*.sln.ide/
|
||||
_ReSharper.*/
|
||||
packages/
|
||||
artifacts/
|
||||
|
|
@ -24,4 +23,8 @@ nuget.exe
|
|||
*.ncrunchsolution
|
||||
*.*sdf
|
||||
*.ipch
|
||||
project.lock.json
|
||||
*.sln.ide
|
||||
project.lock.json
|
||||
/.vs/
|
||||
.build/
|
||||
.testPublish/
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
language: csharp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- gettext
|
||||
- libcurl4-openssl-dev
|
||||
- libicu-dev
|
||||
- libssl-dev
|
||||
- libunwind8
|
||||
- zlib1g
|
||||
mono:
|
||||
- 4.0.5
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
osx_image: xcode7.1
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- release
|
||||
- dev
|
||||
- /^(.*\/)?ci-.*$/
|
||||
before_install:
|
||||
- if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; brew link --force openssl; fi
|
||||
script:
|
||||
- ./build.sh verify
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetvnext/api/v2" />
|
||||
<add key="NuGet" value="https://nuget.org/api/v2/" />
|
||||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetcidev/api/v3/index.json" />
|
||||
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="NuGet" value="https://nuget.org/api/v2/" />
|
||||
<add key="AspNetMaster" value="https://www.myget.org/F/aspnetmaster/api/v2" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<add key="AspNetVNext" value="https://www.myget.org/F/aspnetrelease/api/v2" />
|
||||
<add key="NuGet" value="https://nuget.org/api/v2/" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"adx": { // Packages written by the ADX team and that ship on NuGet.org
|
||||
"rules": [
|
||||
"AdxVerificationCompositeRule"
|
||||
],
|
||||
"packages": {
|
||||
"Microsoft.AspNetCore.ResponseCaching": { },
|
||||
}
|
||||
},
|
||||
"Default": { // Rules to run for packages not listed in any other set.
|
||||
"rules": [
|
||||
"DefaultCompositeRule"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
ASP.NET Response Caching
|
||||
ASP.NET Core Response Caching
|
||||
========
|
||||
|
||||
This repo hosts the ASP.NET Core middleware for response caching.
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 14
|
||||
VisualStudioVersion = 14.0.22823.1
|
||||
VisualStudioVersion = 14.0.25420.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.ResponseCaching", "src\Microsoft.AspNet.ResponseCaching\Microsoft.AspNet.ResponseCaching.xproj", "{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{367AABAF-E03C-4491-A9A7-BDDE8903D1B4}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{C51DF5BD-B53D-4795-BC01-A9AB066BF286}"
|
||||
|
|
@ -18,7 +16,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
|
|||
global.json = global.json
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNet.ResponseCaching.Tests", "test\Microsoft.AspNet.ResponseCaching.Tests\Microsoft.AspNet.ResponseCaching.Tests.xproj", "{151B2027-3936-44B9-A4A0-E1E5902125AB}"
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.ResponseCaching.Tests", "test\Microsoft.AspNetCore.ResponseCaching.Tests\Microsoft.AspNetCore.ResponseCaching.Tests.xproj", "{151B2027-3936-44B9-A4A0-E1E5902125AB}"
|
||||
EndProject
|
||||
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Microsoft.AspNetCore.ResponseCaching", "src\Microsoft.AspNetCore.ResponseCaching\Microsoft.AspNetCore.ResponseCaching.xproj", "{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
@ -26,10 +26,6 @@ Global
|
|||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1139BDEE-FA15-474D-8855-0AB91F23CF26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1139BDEE-FA15-474D-8855-0AB91F23CF26}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1139BDEE-FA15-474D-8855-0AB91F23CF26}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
|
|
@ -38,13 +34,17 @@ Global
|
|||
{151B2027-3936-44B9-A4A0-E1E5902125AB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{151B2027-3936-44B9-A4A0-E1E5902125AB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{151B2027-3936-44B9-A4A0-E1E5902125AB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6} = {367AABAF-E03C-4491-A9A7-BDDE8903D1B4}
|
||||
{1139BDEE-FA15-474D-8855-0AB91F23CF26} = {C51DF5BD-B53D-4795-BC01-A9AB066BF286}
|
||||
{151B2027-3936-44B9-A4A0-E1E5902125AB} = {89A50974-E9D4-4F87-ACF2-6A6005E64931}
|
||||
{D1031270-DBD3-4F02-A3DC-3E7DADE8EBE6} = {367AABAF-E03C-4491-A9A7-BDDE8903D1B4}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
init:
|
||||
- git config --global core.autocrlf true
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- release
|
||||
- dev
|
||||
- /^(.*\/)?ci-.*$/
|
||||
build_script:
|
||||
- build.cmd verify
|
||||
clone_depth: 1
|
||||
test: off
|
||||
deploy: off
|
||||
30
build.cmd
30
build.cmd
|
|
@ -1,28 +1,2 @@
|
|||
@echo off
|
||||
cd %~dp0
|
||||
|
||||
SETLOCAL
|
||||
SET CACHED_NUGET=%LocalAppData%\NuGet\NuGet.exe
|
||||
|
||||
IF EXIST %CACHED_NUGET% goto copynuget
|
||||
echo Downloading latest version of NuGet.exe...
|
||||
IF NOT EXIST %LocalAppData%\NuGet md %LocalAppData%\NuGet
|
||||
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "$ProgressPreference = 'SilentlyContinue'; Invoke-WebRequest 'https://www.nuget.org/nuget.exe' -OutFile '%CACHED_NUGET%'"
|
||||
|
||||
:copynuget
|
||||
IF EXIST .nuget\nuget.exe goto restore
|
||||
md .nuget
|
||||
copy %CACHED_NUGET% .nuget\nuget.exe > nul
|
||||
|
||||
:restore
|
||||
IF EXIST packages\KoreBuild goto run
|
||||
.nuget\NuGet.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
|
||||
.nuget\NuGet.exe install Sake -version 0.2 -o packages -ExcludeVersion
|
||||
|
||||
IF "%SKIP_DNX_INSTALL%"=="1" goto run
|
||||
CALL packages\KoreBuild\build\dnvm upgrade -runtime CLR -arch x86
|
||||
CALL packages\KoreBuild\build\dnvm install default -runtime CoreCLR -arch x86
|
||||
|
||||
:run
|
||||
CALL packages\KoreBuild\build\dnvm use default -runtime CLR -arch x86
|
||||
packages\Sake\tools\Sake.exe -I packages\KoreBuild\build -f makefile.shade %*
|
||||
@ECHO OFF
|
||||
PowerShell -NoProfile -NoLogo -ExecutionPolicy unrestricted -Command "[System.Threading.Thread]::CurrentThread.CurrentCulture = ''; [System.Threading.Thread]::CurrentThread.CurrentUICulture = '';& '%~dp0build.ps1' %*; exit $LASTEXITCODE"
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
$ErrorActionPreference = "Stop"
|
||||
|
||||
function DownloadWithRetry([string] $url, [string] $downloadLocation, [int] $retries)
|
||||
{
|
||||
while($true)
|
||||
{
|
||||
try
|
||||
{
|
||||
Invoke-WebRequest $url -OutFile $downloadLocation
|
||||
break
|
||||
}
|
||||
catch
|
||||
{
|
||||
$exceptionMessage = $_.Exception.Message
|
||||
Write-Host "Failed to download '$url': $exceptionMessage"
|
||||
if ($retries -gt 0) {
|
||||
$retries--
|
||||
Write-Host "Waiting 10 seconds before retrying. Retries left: $retries"
|
||||
Start-Sleep -Seconds 10
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$exception = $_.Exception
|
||||
throw $exception
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cd $PSScriptRoot
|
||||
|
||||
$repoFolder = $PSScriptRoot
|
||||
$env:REPO_FOLDER = $repoFolder
|
||||
|
||||
$koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
|
||||
if ($env:KOREBUILD_ZIP)
|
||||
{
|
||||
$koreBuildZip=$env:KOREBUILD_ZIP
|
||||
}
|
||||
|
||||
$buildFolder = ".build"
|
||||
$buildFile="$buildFolder\KoreBuild.ps1"
|
||||
|
||||
if (!(Test-Path $buildFolder)) {
|
||||
Write-Host "Downloading KoreBuild from $koreBuildZip"
|
||||
|
||||
$tempFolder=$env:TEMP + "\KoreBuild-" + [guid]::NewGuid()
|
||||
New-Item -Path "$tempFolder" -Type directory | Out-Null
|
||||
|
||||
$localZipFile="$tempFolder\korebuild.zip"
|
||||
|
||||
DownloadWithRetry -url $koreBuildZip -downloadLocation $localZipFile -retries 6
|
||||
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory($localZipFile, $tempFolder)
|
||||
|
||||
New-Item -Path "$buildFolder" -Type directory | Out-Null
|
||||
copy-item "$tempFolder\**\build\*" $buildFolder -Recurse
|
||||
|
||||
# Cleanup
|
||||
if (Test-Path $tempFolder) {
|
||||
Remove-Item -Recurse -Force $tempFolder
|
||||
}
|
||||
}
|
||||
|
||||
&"$buildFile" $args
|
||||
|
|
@ -1,38 +1,46 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
repoFolder="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $repoFolder
|
||||
|
||||
if test `uname` = Darwin; then
|
||||
cachedir=~/Library/Caches/KBuild
|
||||
else
|
||||
if [ -z $XDG_DATA_HOME ]; then
|
||||
cachedir=$HOME/.local/share
|
||||
else
|
||||
cachedir=$XDG_DATA_HOME;
|
||||
koreBuildZip="https://github.com/aspnet/KoreBuild/archive/dev.zip"
|
||||
if [ ! -z $KOREBUILD_ZIP ]; then
|
||||
koreBuildZip=$KOREBUILD_ZIP
|
||||
fi
|
||||
|
||||
buildFolder=".build"
|
||||
buildFile="$buildFolder/KoreBuild.sh"
|
||||
|
||||
if test ! -d $buildFolder; then
|
||||
echo "Downloading KoreBuild from $koreBuildZip"
|
||||
|
||||
tempFolder="/tmp/KoreBuild-$(uuidgen)"
|
||||
mkdir $tempFolder
|
||||
|
||||
localZipFile="$tempFolder/korebuild.zip"
|
||||
|
||||
retries=6
|
||||
until (wget -O $localZipFile $koreBuildZip 2>/dev/null || curl -o $localZipFile --location $koreBuildZip 2>/dev/null)
|
||||
do
|
||||
echo "Failed to download '$koreBuildZip'"
|
||||
if [ "$retries" -le 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
retries=$((retries - 1))
|
||||
echo "Waiting 10 seconds before retrying. Retries left: $retries"
|
||||
sleep 10s
|
||||
done
|
||||
|
||||
unzip -q -d $tempFolder $localZipFile
|
||||
|
||||
mkdir $buildFolder
|
||||
cp -r $tempFolder/**/build/** $buildFolder
|
||||
|
||||
chmod +x $buildFile
|
||||
|
||||
# Cleanup
|
||||
if test ! -d $tempFolder; then
|
||||
rm -rf $tempFolder
|
||||
fi
|
||||
fi
|
||||
mkdir -p $cachedir
|
||||
|
||||
url=https://www.nuget.org/nuget.exe
|
||||
|
||||
if test ! -f $cachedir/nuget.exe; then
|
||||
wget -O $cachedir/nuget.exe $url 2>/dev/null || curl -o $cachedir/nuget.exe --location $url /dev/null
|
||||
fi
|
||||
|
||||
if test ! -e .nuget; then
|
||||
mkdir .nuget
|
||||
cp $cachedir/nuget.exe .nuget/nuget.exe
|
||||
fi
|
||||
|
||||
if test ! -d packages/KoreBuild; then
|
||||
mono .nuget/nuget.exe install KoreBuild -ExcludeVersion -o packages -nocache -pre
|
||||
mono .nuget/nuget.exe install Sake -version 0.2 -o packages -ExcludeVersion
|
||||
fi
|
||||
|
||||
if ! type dnvm > /dev/null 2>&1; then
|
||||
source packages/KoreBuild/build/dnvm.sh
|
||||
fi
|
||||
|
||||
if ! type dnx > /dev/null 2>&1; then
|
||||
dnvm upgrade
|
||||
fi
|
||||
|
||||
mono packages/Sake/tools/Sake.exe -I packages/KoreBuild/build -f makefile.shade "$@"
|
||||
$buildFile -r $repoFolder "$@"
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"projects": ["src"]
|
||||
"projects": ["src"]
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
|
||||
var VERSION='0.1'
|
||||
var FULL_VERSION='0.1'
|
||||
var AUTHORS='Microsoft Open Technologies, Inc.'
|
||||
|
||||
use-standard-lifecycle
|
||||
k-standard-goals
|
||||
|
|
@ -4,16 +4,16 @@
|
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>1139bdee-fa15-474d-8855-0ab91f23cf26</ProjectGuid>
|
||||
<RootNamespace>ResponseCachingSample</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<DevelopmentServerPort>2931</DevelopmentServerPort>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet.Web\Microsoft.DotNet.Web.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
|
|
@ -2,9 +2,11 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.DependencyInjection;
|
||||
using System.IO;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Net.Http.Headers;
|
||||
|
||||
namespace ResponseCachingSample
|
||||
|
|
@ -13,7 +15,7 @@ namespace ResponseCachingSample
|
|||
{
|
||||
public void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddCaching();
|
||||
services.AddMemoryCache();
|
||||
}
|
||||
|
||||
public void Configure(IApplicationBuilder app)
|
||||
|
|
@ -29,5 +31,17 @@ namespace ResponseCachingSample
|
|||
await context.Response.WriteAsync("Hello World! " + DateTime.UtcNow);
|
||||
});
|
||||
}
|
||||
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
var host = new WebHostBuilder()
|
||||
.UseKestrel()
|
||||
.UseContentRoot(Directory.GetCurrentDirectory())
|
||||
.UseIISIntegration()
|
||||
.UseStartup<Startup>()
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,33 +1,34 @@
|
|||
{
|
||||
"webroot": "wwwroot",
|
||||
"version": "1.0.0-*",
|
||||
|
||||
"version": "1.1.0-*",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.ResponseCaching": "1.0.0-*",
|
||||
"Microsoft.AspNet.Server.IIS": "1.0.0-*",
|
||||
"Microsoft.AspNet.Server.WebListener": "1.0.0-*",
|
||||
"Microsoft.Framework.Caching.Memory": "1.0.0-*"
|
||||
"Microsoft.AspNetCore.ResponseCaching": "0.1.0-*",
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0-*",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0-*",
|
||||
"Microsoft.Extensions.Caching.Memory": "1.1.0-*"
|
||||
},
|
||||
|
||||
"commands": {
|
||||
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000"
|
||||
"buildOptions": {
|
||||
"emitEntryPoint": true
|
||||
},
|
||||
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
"net451": {},
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "platform"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
"publishExclude": [
|
||||
"node_modules",
|
||||
"bower_components",
|
||||
"**.xproj",
|
||||
"**.user",
|
||||
"**.vspscc"
|
||||
],
|
||||
"exclude": [
|
||||
"wwwroot",
|
||||
"node_modules",
|
||||
"bower_components"
|
||||
]
|
||||
"publishOptions": {
|
||||
"include": [
|
||||
"web.config"
|
||||
]
|
||||
},
|
||||
"tools": {
|
||||
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-*"
|
||||
},
|
||||
"scripts": {
|
||||
"postpublish": "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0"?>
|
||||
<configuration>
|
||||
<system.webServer>
|
||||
<handlers>
|
||||
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified" />
|
||||
</handlers>
|
||||
<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="false" />
|
||||
</system.webServer>
|
||||
</configuration>
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("Microsoft.AspNet.ResponseCaching.Tests")]
|
||||
[assembly: AssemblyMetadata("Serviceable", "True")]
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"version": "1.0.0-*",
|
||||
"description": "Middleare that automatically caches HTTP responses on the server.",
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.Http.Abstractions": "1.0.0-*",
|
||||
"Microsoft.Framework.Caching.Abstractions": "1.0.0-*"
|
||||
},
|
||||
"frameworks" : {
|
||||
"dnx451": { },
|
||||
"dnxcore50" : {
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,17 +4,16 @@
|
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>d1031270-dbd3-4f02-a3dc-3e7dade8ebe6</ProjectGuid>
|
||||
<RootNamespace>Microsoft.AspNet.ResponseCaching</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<RootNamespace>
|
||||
</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Reflection;
|
||||
using System.Resources;
|
||||
|
||||
[assembly: AssemblyMetadata("Serviceable", "True")]
|
||||
[assembly: NeutralResourcesLanguage("en-us")]
|
||||
[assembly: AssemblyCompany("Microsoft Corporation.")]
|
||||
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
|
||||
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]
|
||||
|
|
@ -3,18 +3,17 @@
|
|||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.Caching.Memory;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Microsoft.AspNet.ResponseCaching
|
||||
namespace Microsoft.AspNetCore.ResponseCaching
|
||||
{
|
||||
internal class CachingContext
|
||||
public class ResponseCachingContext
|
||||
{
|
||||
private string _cacheKey;
|
||||
|
||||
public CachingContext(HttpContext httpContext, IMemoryCache cache)
|
||||
public ResponseCachingContext(HttpContext httpContext, IMemoryCache cache)
|
||||
{
|
||||
HttpContext = httpContext;
|
||||
Cache = cache;
|
||||
|
|
@ -32,7 +31,7 @@ namespace Microsoft.AspNet.ResponseCaching
|
|||
|
||||
private bool CacheResponse { get; set; }
|
||||
|
||||
internal bool CheckRequestAllowsCaching()
|
||||
public bool CheckRequestAllowsCaching()
|
||||
{
|
||||
// Verify the method
|
||||
// TODO: What other methods should be supported?
|
||||
|
|
@ -64,7 +63,7 @@ namespace Microsoft.AspNet.ResponseCaching
|
|||
internal async Task<bool> TryServeFromCacheAsync()
|
||||
{
|
||||
_cacheKey = CreateCacheKey();
|
||||
ResponseCacheEntry cacheEntry;
|
||||
ResponseCachingEntry cacheEntry;
|
||||
if (Cache.TryGetValue(_cacheKey, out cacheEntry))
|
||||
{
|
||||
// TODO: Compare cached request headers
|
||||
|
|
@ -80,7 +79,7 @@ namespace Microsoft.AspNet.ResponseCaching
|
|||
response.StatusCode = cacheEntry.StatusCode;
|
||||
foreach (var pair in cacheEntry.Headers)
|
||||
{
|
||||
response.Headers.SetValues(pair.Key, pair.Value);
|
||||
response.Headers[pair.Key] = pair.Value;
|
||||
}
|
||||
|
||||
// TODO: Update cache headers (Age)
|
||||
|
|
@ -122,9 +121,12 @@ namespace Microsoft.AspNet.ResponseCaching
|
|||
if (CacheResponse)
|
||||
{
|
||||
// Store the buffer to cache
|
||||
var cacheEntry = new ResponseCacheEntry();
|
||||
var cacheEntry = new ResponseCachingEntry();
|
||||
cacheEntry.StatusCode = HttpContext.Response.StatusCode;
|
||||
cacheEntry.Headers = HttpContext.Response.Headers.ToList();
|
||||
foreach (var pair in HttpContext.Response.Headers)
|
||||
{
|
||||
cacheEntry.Headers[pair.Key] = pair.Value;
|
||||
}
|
||||
cacheEntry.Body = Buffer.ToArray();
|
||||
Cache.Set(_cacheKey, cacheEntry); // TODO: Timeouts
|
||||
}
|
||||
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
|
||||
namespace Microsoft.AspNet.ResponseCaching
|
||||
namespace Microsoft.AspNetCore.ResponseCaching
|
||||
{
|
||||
internal class ResponseCacheEntry
|
||||
internal class ResponseCachingEntry
|
||||
{
|
||||
public int StatusCode { get; set; }
|
||||
internal IEnumerable<KeyValuePair<string, string[]>> Headers { get; set; }
|
||||
internal IHeaderDictionary Headers { get; set; } = new HeaderDictionary();
|
||||
internal byte[] Body { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.ResponseCaching;
|
||||
using Microsoft.AspNetCore.ResponseCaching;
|
||||
|
||||
namespace Microsoft.AspNet.Builder
|
||||
namespace Microsoft.AspNetCore.Builder
|
||||
{
|
||||
public static class ResponseCachingExtensions
|
||||
{
|
||||
|
|
@ -2,11 +2,10 @@
|
|||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNet.Builder;
|
||||
using Microsoft.AspNet.Http;
|
||||
using Microsoft.Framework.Caching.Memory;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace Microsoft.AspNet.ResponseCaching
|
||||
namespace Microsoft.AspNetCore.ResponseCaching
|
||||
{
|
||||
// http://tools.ietf.org/html/rfc7234
|
||||
public class ResponseCachingMiddleware
|
||||
|
|
@ -22,7 +21,7 @@ namespace Microsoft.AspNet.ResponseCaching
|
|||
|
||||
public async Task Invoke(HttpContext context)
|
||||
{
|
||||
var cachingContext = new CachingContext(context, _cache);
|
||||
var cachingContext = new ResponseCachingContext(context, _cache);
|
||||
// Should we attempt any caching logic?
|
||||
if (cachingContext.CheckRequestAllowsCaching())
|
||||
{
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"version": "0.1.0-*",
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
"nowarn": [
|
||||
"CS1591"
|
||||
],
|
||||
"xmlDoc": true
|
||||
},
|
||||
"description": "ASP.NET Core middleware for caching HTTP responses on the server.",
|
||||
"packOptions": {
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/aspnet/ResponseCaching"
|
||||
},
|
||||
"tags": [
|
||||
"aspnetcore",
|
||||
"cache",
|
||||
"caching"
|
||||
]
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Http": "1.1.0-*",
|
||||
"Microsoft.Extensions.Caching.Abstractions": "1.1.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"netstandard1.3": {}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
{
|
||||
"dependencies": {
|
||||
"Microsoft.AspNet.ResponseCaching": "1.0.0-*",
|
||||
"xunit.runner.aspnet": "2.0.0-aspnet-*",
|
||||
"Microsoft.AspNet.Http": "1.0.0-beta5-11528",
|
||||
"Microsoft.Framework.Caching.Memory": "1.0.0-beta5-11395"
|
||||
},
|
||||
"commands": {
|
||||
"test": "xunit.runner.aspnet"
|
||||
},
|
||||
"frameworks": {
|
||||
"dnx451": { },
|
||||
"dnxcore50": { }
|
||||
}
|
||||
}
|
||||
|
|
@ -4,17 +4,15 @@
|
|||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>151b2027-3936-44b9-a4a0-e1e5902125ab</ProjectGuid>
|
||||
<RootNamespace>Microsoft.AspNet.ResponseCaching.Tests</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
|
|
@ -1,20 +1,20 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
using Microsoft.AspNet.Http.Internal;
|
||||
using Microsoft.Framework.Caching.Memory;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Xunit;
|
||||
|
||||
namespace Microsoft.AspNet.ResponseCaching
|
||||
namespace Microsoft.AspNetCore.ResponseCaching
|
||||
{
|
||||
public class CachingContextTests
|
||||
public class ResponseCachingContextTests
|
||||
{
|
||||
[Fact]
|
||||
public void CheckRequestAllowsCaching_Method_GET_Allowed()
|
||||
{
|
||||
var httpContext = new DefaultHttpContext();
|
||||
httpContext.Request.Method = "GET";
|
||||
var context = new CachingContext(httpContext, new MemoryCache(new MemoryCacheOptions()));
|
||||
var context = new ResponseCachingContext(httpContext, new MemoryCache(new MemoryCacheOptions()));
|
||||
|
||||
Assert.True(context.CheckRequestAllowsCaching());
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ namespace Microsoft.AspNet.ResponseCaching
|
|||
{
|
||||
var httpContext = new DefaultHttpContext();
|
||||
httpContext.Request.Method = method;
|
||||
var context = new CachingContext(httpContext, new MemoryCache(new MemoryCacheOptions()));
|
||||
var context = new ResponseCachingContext(httpContext, new MemoryCache(new MemoryCacheOptions()));
|
||||
|
||||
Assert.False(context.CheckRequestAllowsCaching());
|
||||
}
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
{
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"keyFile": "../../tools/Key.snk"
|
||||
},
|
||||
"dependencies": {
|
||||
"dotnet-test-xunit": "2.2.0-*",
|
||||
"Microsoft.AspNetCore.Http": "1.1.0-*",
|
||||
"Microsoft.AspNetCore.ResponseCaching": "0.1.0-*",
|
||||
"Microsoft.Extensions.Caching.Memory": "1.1.0-*",
|
||||
"xunit": "2.2.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {
|
||||
"dependencies": {
|
||||
"Microsoft.NETCore.App": {
|
||||
"version": "1.0.0-*",
|
||||
"type": "platform"
|
||||
}
|
||||
}
|
||||
},
|
||||
"net451": {}
|
||||
},
|
||||
"testRunner": "xunit"
|
||||
}
|
||||
Binary file not shown.
Loading…
Reference in New Issue