diff --git a/Builder/IISMainHandler/build.txt b/Builder/IISMainHandler/build.txt index d1cbcfa..9cd72aa 100644 --- a/Builder/IISMainHandler/build.txt +++ b/Builder/IISMainHandler/build.txt @@ -1 +1 @@ -66 \ No newline at end of file +72 \ No newline at end of file diff --git a/Builder/IISMainHandler/postbuild.bat b/Builder/IISMainHandler/postbuild.bat index 99ea92c..52575db 100644 --- a/Builder/IISMainHandler/postbuild.bat +++ b/Builder/IISMainHandler/postbuild.bat @@ -1,4 +1,5 @@ @echo off del Templates.7z +del Static.7z ping localhost -n 2 >nul del 7z.exe \ No newline at end of file diff --git a/Builder/IISMainHandler/prebuild.bat b/Builder/IISMainHandler/prebuild.bat index e502560..03320e2 100644 --- a/Builder/IISMainHandler/prebuild.bat +++ b/Builder/IISMainHandler/prebuild.bat @@ -1,3 +1,4 @@ @echo off "C:\Program Files\7-Zip\7z.exe" a Templates.7z ..\..\templates\* -xr!.svn +"C:\Program Files\7-Zip\7z.exe" a Static.7z ..\..\static\* -xr!.svn copy "C:\Program Files\7-Zip\7z.exe" 7z.exe \ No newline at end of file diff --git a/Builder/IISMainHandler/product.wxs b/Builder/IISMainHandler/product.wxs index 79a5b3d..c51f2ad 100644 --- a/Builder/IISMainHandler/product.wxs +++ b/Builder/IISMainHandler/product.wxs @@ -60,6 +60,9 @@ + + + @@ -91,13 +94,20 @@ + + + + + + + diff --git a/IISMainHandler/handlers/StaticHandler.cs b/IISMainHandler/handlers/StaticHandler.cs new file mode 100644 index 0000000..0146ddc --- /dev/null +++ b/IISMainHandler/handlers/StaticHandler.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Web; +using System.Text.RegularExpressions; +using System.IO; +using Microsoft.Win32; + +namespace FLocal.IISHandler.handlers { + class StaticHandler : ISpecificHandler { + + private string[] requestParts; + + public StaticHandler(string[] requestParts) { + this.requestParts = requestParts; + } + + public void Handle(WebContext context) { + if(this.requestParts.Length < 2) { + throw new HttpException(403, "listing not allowed"); + } + + Regex checker = new Regex("^[a-z][0-9a-z]*(\\.[a-zA-Z]+)?$", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline); + string path = ""; + for(int i=1; i