Skip to content

Commit

Permalink
v6.0.3890-Beta
Browse files Browse the repository at this point in the history
  • Loading branch information
ITHitBuild committed Oct 17, 2017
1 parent 371c077 commit 7e95e20
Show file tree
Hide file tree
Showing 238 changed files with 4,390 additions and 1,496 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>DDA95D93-DEBC-4F1D-AD89-D2734B79EF18</ProjectGuid>
<ProjectGuid>11BA861F-27F1-4AB5-9646-4652E86D582E</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand Down Expand Up @@ -123,10 +123,10 @@
</ItemGroup>
<ItemGroup>
<Reference Include="ITHit.WebDAV.Server">
<HintPath>..\packages\ITHit.WebDAV.Server.5.7.3670\lib\net451\ITHit.WebDAV.Server.dll</HintPath>
<HintPath>..\packages\ITHit.WebDAV.Server.6.0.3890-Beta\lib\net451\ITHit.WebDAV.Server.dll</HintPath>
</Reference>
<Reference Include="ITHit.WebDAV.Server.Web">
<HintPath>..\packages\ITHit.WebDAV.Server.Web.5.7.3670\lib\net451\ITHit.WebDAV.Server.Web.dll</HintPath>
<HintPath>..\packages\ITHit.WebDAV.Server.Web.6.0.3890-Beta\lib\net451\ITHit.WebDAV.Server.Web.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup>
Expand All @@ -144,7 +144,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>9658</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:41833/</IISUrl>
<IISUrl>http://localhost:25831/</IISUrl>
<NTLMAuthentication>True</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
Expand All @@ -154,6 +154,15 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="&quot;$(DevEnvDir)..\..\Web\External\npm.cmd&quot; install webdav.client --prefix wwwroot/js" ContinueOnError="true" StdOutEncoding="utf-8">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="npm install webdav.client --prefix wwwroot/js" ContinueOnError="true" Condition="'$(ErrorCode)' == '127' OR '$(ErrorCode)' == '3'" StdOutEncoding="utf-8">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Text="Node.js Package Manager (NPM) is required to download IT Hit WebDAV Ajax Library package. Install NPM from https://npmjs.com and run build again." Condition="'$(ErrorCode)' == '127' OR '$(ErrorCode)' == '9009'" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
51 changes: 51 additions & 0 deletions CS/CalDAVServer.FileSystemStorage.AspNet/MyCustomGetHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,63 @@ public async Task ProcessRequestAsync(DavContextBaseAsync context, IHierarchyIte
await Task.Factory.FromAsync(page.BeginProcessRequest, page.EndProcessRequest, HttpContext.Current, null);
}
}
else if (context.Request.RawUrl.StartsWith("/AjaxFileBrowser/") || context.Request.RawUrl.StartsWith("/wwwroot/"))
{
// The "/AjaxFileBrowser/" is not a WebDAV folder. It can be used to store client script files,
// images, static HTML files or any other files that does not require access via WebDAV.
// Any request to the files in this folder will just serve them to client.

await context.EnsureBeforeResponseWasCalledAsync();
string filePath = Path.Combine(htmlPath, context.Request.RawUrl.TrimStart('/').Replace('/', Path.DirectorySeparatorChar));

// Remove query string.
int queryIndex = filePath.LastIndexOf('?');
if (queryIndex > -1)
{
filePath = filePath.Remove(queryIndex);
}

if (!File.Exists(filePath))
{
throw new DavException("File not found: " + filePath, DavStatus.NOT_FOUND);
}

using (TextReader reader = File.OpenText(filePath))
{
string html = await reader.ReadToEndAsync();
await WriteFileContentAsync(context, html, filePath);
}
}
else
{
await OriginalHandler.ProcessRequestAsync(context, item);
}
}

/// <summary>
/// Writes HTML to the output stream in case of GET request using encoding specified in Engine.
/// Writes headers only in caes of HEAD request.
/// </summary>
/// <param name="context">Instace of <see cref="DavContextBaseAsync"/>.</param>
/// <param name="content">String representation of the content to write.</param>
/// <param name="filePath">Relative file path, which holds the content.</param>
private async Task WriteFileContentAsync(DavContextBaseAsync context, string content, string filePath)
{
string contentType = null;
Encoding encoding = context.Engine.ContentEncoding; // UTF-8 by default
context.Response.ContentLength = encoding.GetByteCount(content);
context.Response.ContentType = $"{MimeMapping.GetMimeMapping(filePath)}; charset={encoding.WebName}";

// Return file content in case of GET request, in case of HEAD just return headers.
if (context.Request.HttpMethod == "GET")
{
using (var writer = new StreamWriter(context.Response.OutputStream, encoding))
{
await writer.WriteAsync(content);
}
}
}

/// <summary>
/// This handler shall only be invoked for <see cref="IFolderAsync"/> items or if original handler (which
/// this handler substitutes) shall be called for the item.
Expand Down
4 changes: 2 additions & 2 deletions CS/CalDAVServer.FileSystemStorage.AspNet/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ITHit.WebDAV.Server" version="5.7.3670" targetFramework="net451" />
<package id="ITHit.WebDAV.Server.Web" version="5.7.3670" targetFramework="net451" />
<package id="ITHit.WebDAV.Server" version="6.0.3890-Beta" targetFramework="net451" />
<package id="ITHit.WebDAV.Server.Web" version="6.0.3890-Beta" targetFramework="net451" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net451" />
</packages>
Binary file modified CS/CalDAVServer.SqlStorage.AspNet/App_Data/WebDav/DB/WebDav.mdf
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>AD7A9B48-6D36-41B0-97C4-B04421A1D1D0</ProjectGuid>
<ProjectGuid>49AAD352-CE53-4590-9452-A6CAB9465CC1</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand Down Expand Up @@ -111,10 +111,10 @@
</ItemGroup>
<ItemGroup>
<Reference Include="ITHit.WebDAV.Server">
<HintPath>..\packages\ITHit.WebDAV.Server.5.7.3670\lib\net451\ITHit.WebDAV.Server.dll</HintPath>
<HintPath>..\packages\ITHit.WebDAV.Server.6.0.3890-Beta\lib\net451\ITHit.WebDAV.Server.dll</HintPath>
</Reference>
<Reference Include="ITHit.WebDAV.Server.Web">
<HintPath>..\packages\ITHit.WebDAV.Server.Web.5.7.3670\lib\net451\ITHit.WebDAV.Server.Web.dll</HintPath>
<HintPath>..\packages\ITHit.WebDAV.Server.Web.6.0.3890-Beta\lib\net451\ITHit.WebDAV.Server.Web.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup>
Expand All @@ -132,7 +132,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>9658</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:9296/</IISUrl>
<IISUrl>http://localhost:39897/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
Expand All @@ -142,6 +142,15 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="&quot;$(DevEnvDir)..\..\Web\External\npm.cmd&quot; install webdav.client --prefix wwwroot/js" ContinueOnError="true" StdOutEncoding="utf-8">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="npm install webdav.client --prefix wwwroot/js" ContinueOnError="true" Condition="'$(ErrorCode)' == '127' OR '$(ErrorCode)' == '3'" StdOutEncoding="utf-8">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Text="Node.js Package Manager (NPM) is required to download IT Hit WebDAV Ajax Library package. Install NPM from https://npmjs.com and run build again." Condition="'$(ErrorCode)' == '127' OR '$(ErrorCode)' == '9009'" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
51 changes: 51 additions & 0 deletions CS/CalDAVServer.SqlStorage.AspNet/MyCustomGetHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,63 @@ public async Task ProcessRequestAsync(DavContextBaseAsync context, IHierarchyIte
await Task.Factory.FromAsync(page.BeginProcessRequest, page.EndProcessRequest, HttpContext.Current, null);
}
}
else if (context.Request.RawUrl.StartsWith("/AjaxFileBrowser/") || context.Request.RawUrl.StartsWith("/wwwroot/"))
{
// The "/AjaxFileBrowser/" is not a WebDAV folder. It can be used to store client script files,
// images, static HTML files or any other files that does not require access via WebDAV.
// Any request to the files in this folder will just serve them to client.

await context.EnsureBeforeResponseWasCalledAsync();
string filePath = Path.Combine(htmlPath, context.Request.RawUrl.TrimStart('/').Replace('/', Path.DirectorySeparatorChar));

// Remove query string.
int queryIndex = filePath.LastIndexOf('?');
if (queryIndex > -1)
{
filePath = filePath.Remove(queryIndex);
}

if (!File.Exists(filePath))
{
throw new DavException("File not found: " + filePath, DavStatus.NOT_FOUND);
}

using (TextReader reader = File.OpenText(filePath))
{
string html = await reader.ReadToEndAsync();
await WriteFileContentAsync(context, html, filePath);
}
}
else
{
await OriginalHandler.ProcessRequestAsync(context, item);
}
}

/// <summary>
/// Writes HTML to the output stream in case of GET request using encoding specified in Engine.
/// Writes headers only in caes of HEAD request.
/// </summary>
/// <param name="context">Instace of <see cref="DavContextBaseAsync"/>.</param>
/// <param name="content">String representation of the content to write.</param>
/// <param name="filePath">Relative file path, which holds the content.</param>
private async Task WriteFileContentAsync(DavContextBaseAsync context, string content, string filePath)
{
string contentType = null;
Encoding encoding = context.Engine.ContentEncoding; // UTF-8 by default
context.Response.ContentLength = encoding.GetByteCount(content);
context.Response.ContentType = $"{MimeMapping.GetMimeMapping(filePath)}; charset={encoding.WebName}";

// Return file content in case of GET request, in case of HEAD just return headers.
if (context.Request.HttpMethod == "GET")
{
using (var writer = new StreamWriter(context.Response.OutputStream, encoding))
{
await writer.WriteAsync(content);
}
}
}

/// <summary>
/// This handler shall only be invoked for <see cref="IFolderAsync"/> items or if original handler (which
/// this handler substitutes) shall be called for the item.
Expand Down
4 changes: 2 additions & 2 deletions CS/CalDAVServer.SqlStorage.AspNet/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ITHit.WebDAV.Server" version="5.7.3670" targetFramework="net451" />
<package id="ITHit.WebDAV.Server.Web" version="5.7.3670" targetFramework="net451" />
<package id="ITHit.WebDAV.Server" version="6.0.3890-Beta" targetFramework="net451" />
<package id="ITHit.WebDAV.Server.Web" version="6.0.3890-Beta" targetFramework="net451" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net451" />
</packages>
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://www.ajaxbrowser.com/ITHitService/WebDAVAJAXLibrary/Tests/ITHitTests.js" type="text/javascript"></script>
<script src="https://www.ajaxbrowser.com/ITHitService/WebDAVAJAXLibrary/ITHitWebDAVClient.js" type="text/javascript"></script>
<script src="/wwwroot/js/node_modules/webdav.client/Tests/ITHitTests.js" type="text/javascript"></script>
<script src="/wwwroot/js/node_modules/webdav.client/ITHitWebDAVClient.js" type="text/javascript"></script>
</head>
<body>
</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>AC412114-493A-4080-A005-BA7861EE24D7</ProjectGuid>
<ProjectGuid>A3F5DECE-C5E3-49A2-BD02-6AC641F0E927</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
Expand Down Expand Up @@ -120,10 +120,10 @@
</ItemGroup>
<ItemGroup>
<Reference Include="ITHit.WebDAV.Server">
<HintPath>..\packages\ITHit.WebDAV.Server.5.7.3670\lib\net451\ITHit.WebDAV.Server.dll</HintPath>
<HintPath>..\packages\ITHit.WebDAV.Server.6.0.3890-Beta\lib\net451\ITHit.WebDAV.Server.dll</HintPath>
</Reference>
<Reference Include="ITHit.WebDAV.Server.Web">
<HintPath>..\packages\ITHit.WebDAV.Server.Web.5.7.3670\lib\net451\ITHit.WebDAV.Server.Web.dll</HintPath>
<HintPath>..\packages\ITHit.WebDAV.Server.Web.6.0.3890-Beta\lib\net451\ITHit.WebDAV.Server.Web.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup>
Expand All @@ -141,7 +141,7 @@
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>9658</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:16383/</IISUrl>
<IISUrl>http://localhost:15129/</IISUrl>
<NTLMAuthentication>True</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
Expand All @@ -151,6 +151,15 @@
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="&quot;$(DevEnvDir)..\..\Web\External\npm.cmd&quot; install webdav.client --prefix wwwroot/js" ContinueOnError="true" StdOutEncoding="utf-8">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Exec Command="npm install webdav.client --prefix wwwroot/js" ContinueOnError="true" Condition="'$(ErrorCode)' == '127' OR '$(ErrorCode)' == '3'" StdOutEncoding="utf-8">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Text="Node.js Package Manager (NPM) is required to download IT Hit WebDAV Ajax Library package. Install NPM from https://npmjs.com and run build again." Condition="'$(ErrorCode)' == '127' OR '$(ErrorCode)' == '9009'" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
Expand Down
51 changes: 51 additions & 0 deletions CS/CardDAVServer.FileSystemStorage.AspNet/MyCustomGetHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,63 @@ public async Task ProcessRequestAsync(DavContextBaseAsync context, IHierarchyIte
await Task.Factory.FromAsync(page.BeginProcessRequest, page.EndProcessRequest, HttpContext.Current, null);
}
}
else if (context.Request.RawUrl.StartsWith("/AjaxFileBrowser/") || context.Request.RawUrl.StartsWith("/wwwroot/"))
{
// The "/AjaxFileBrowser/" is not a WebDAV folder. It can be used to store client script files,
// images, static HTML files or any other files that does not require access via WebDAV.
// Any request to the files in this folder will just serve them to client.

await context.EnsureBeforeResponseWasCalledAsync();
string filePath = Path.Combine(htmlPath, context.Request.RawUrl.TrimStart('/').Replace('/', Path.DirectorySeparatorChar));

// Remove query string.
int queryIndex = filePath.LastIndexOf('?');
if (queryIndex > -1)
{
filePath = filePath.Remove(queryIndex);
}

if (!File.Exists(filePath))
{
throw new DavException("File not found: " + filePath, DavStatus.NOT_FOUND);
}

using (TextReader reader = File.OpenText(filePath))
{
string html = await reader.ReadToEndAsync();
await WriteFileContentAsync(context, html, filePath);
}
}
else
{
await OriginalHandler.ProcessRequestAsync(context, item);
}
}

/// <summary>
/// Writes HTML to the output stream in case of GET request using encoding specified in Engine.
/// Writes headers only in caes of HEAD request.
/// </summary>
/// <param name="context">Instace of <see cref="DavContextBaseAsync"/>.</param>
/// <param name="content">String representation of the content to write.</param>
/// <param name="filePath">Relative file path, which holds the content.</param>
private async Task WriteFileContentAsync(DavContextBaseAsync context, string content, string filePath)
{
string contentType = null;
Encoding encoding = context.Engine.ContentEncoding; // UTF-8 by default
context.Response.ContentLength = encoding.GetByteCount(content);
context.Response.ContentType = $"{MimeMapping.GetMimeMapping(filePath)}; charset={encoding.WebName}";

// Return file content in case of GET request, in case of HEAD just return headers.
if (context.Request.HttpMethod == "GET")
{
using (var writer = new StreamWriter(context.Response.OutputStream, encoding))
{
await writer.WriteAsync(content);
}
}
}

/// <summary>
/// This handler shall only be invoked for <see cref="IFolderAsync"/> items or if original handler (which
/// this handler substitutes) shall be called for the item.
Expand Down
4 changes: 2 additions & 2 deletions CS/CardDAVServer.FileSystemStorage.AspNet/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="ITHit.WebDAV.Server" version="5.7.3670" targetFramework="net451" />
<package id="ITHit.WebDAV.Server.Web" version="5.7.3670" targetFramework="net451" />
<package id="ITHit.WebDAV.Server" version="6.0.3890-Beta" targetFramework="net451" />
<package id="ITHit.WebDAV.Server.Web" version="6.0.3890-Beta" targetFramework="net451" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net451" />
</packages>
Loading

0 comments on commit 7e95e20

Please sign in to comment.