Initial commit

This commit is contained in:
Michael Nolan 2022-08-22 12:30:32 -05:00
commit 3fee9b2c47
130 changed files with 6378 additions and 0 deletions

View File

@ -0,0 +1,25 @@
using System.Text;
using Tesses.Http;
internal class MainServer : ASPEndpointRequestHandler
{
public MainServer()
{
}
[HttpGet("/")]
public IResponse Index(int a)
{
return String($"{a} is 42");
}
[HttpGet("/form")]
public void SomePage(ServerContext ctx)
{
ctx.Response.StatusLine=200;
ctx.Response.SendStatusCodeHtml();
}
[HttpGet("/4ever4me")]
public IResponse ForEverForMe()
{
return File(System.IO.File.OpenRead("/home/mike/Music/Demi Lovato/Holy Fvck/16 4 EVER 4 ME.mp3"),"audio/mpeg","4Ever4Me.mp3",true);
}
}

View File

@ -0,0 +1,14 @@
using System.Net.Sockets;
using System.Text;
using Tesses.Http;
HTTPServer server = new HTTPServer(new MainServer(),new TcpListener(System.Net.IPAddress.Any,3222));
server.FirstTime = (e)=>{
Console.WriteLine("Connection Made");
return true;
};
server.CatchExceptions=false;
server.AllowMultipleRequestsOnOneConnection=true;
await server.ListenAsync();

View File

@ -0,0 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Tesses.Http\Tesses.Http.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="MimeTypesMap" Version="1.0.8" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,71 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Tesses.Http.Example/1.0.0": {
"dependencies": {
"MimeTypesMap": "1.0.8",
"Tesses.Http": "1.0.0"
},
"runtime": {
"Tesses.Http.Example.dll": {}
}
},
"MimeTypesMap/1.0.8": {
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {
"assemblyVersion": "1.0.8.0",
"fileVersion": "1.0.8.0"
}
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"Tesses.Http/1.0.0": {
"dependencies": {
"MimeTypesMap": "1.0.8",
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"Tesses.Http.dll": {}
}
}
}
},
"libraries": {
"Tesses.Http.Example/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"MimeTypesMap/1.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"path": "mimetypesmap/1.0.8",
"hashPath": "mimetypesmap.1.0.8.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"Tesses.Http/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

View File

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My fucking random form</title>
</head>
<body>
<form action="/form" method="POST" enctype="multipart/form-data">
<input type="file" name="somejim">
<input type="text" name="name">
<input type="password" name="password">
<input type="hidden" name="bloke" value="Demi Lovato">
<input type="submit" value="OK">
</form>
</body>
</html>

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Tesses.Http.Example")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Tesses.Http.Example")]
[assembly: System.Reflection.AssemblyTitleAttribute("Tesses.Http.Example")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
669e612f9f7f7dd7046fa4644507cb226ea518f5

View File

@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Tesses.Http.Example
build_property.ProjectDir = /home/mike/Documents/Tesses.Http/Tesses.Http.Example/

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1 @@
6363edc47200916f9b9c1a2d710f4dcb56cb3e38

View File

@ -0,0 +1,20 @@
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.Example
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.Example.deps.json
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.Example.runtimeconfig.json
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.Example.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.Example.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Newtonsoft.Json.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/Tesses.Http.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.csproj.AssemblyReference.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.GeneratedMSBuildEditorConfig.editorconfig
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.AssemblyInfoInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.AssemblyInfo.cs
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.csproj.CoreCompileInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.csproj.CopyComplete
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/refint/Tesses.Http.Example.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/Tesses.Http.Example.genruntimeconfig.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/Debug/net6.0/ref/Tesses.Http.Example.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.Example/bin/Debug/net6.0/MimeTypesMap.dll

View File

@ -0,0 +1 @@
99157670c863174d3ac2f8d212efc02e0f9034cc

Binary file not shown.

View File

@ -0,0 +1,135 @@
{
"format": 1,
"restore": {
"/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj": {}
},
"projects": {
"/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj",
"projectName": "Tesses.Http.Example",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"MimeTypesMap": {
"target": "Package",
"version": "[1.0.8, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
},
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj",
"projectName": "Tesses.Http",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"dependencies": {
"MimeTypesMap": {
"target": "Package",
"version": "[1.0.8, )"
},
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
},
"Newtonsoft.Json": {
"target": "Package",
"version": "[13.0.1, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/mike/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/mike/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.2.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/mike/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,159 @@
{
"version": 3,
"targets": {
"net6.0": {
"MimeTypesMap/1.0.8": {
"type": "package",
"compile": {
"lib/netstandard2.0/MimeTypesMap.dll": {}
},
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {}
}
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
}
},
"Tesses.Http/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v2.0",
"dependencies": {
"MimeTypesMap": "1.0.8",
"Newtonsoft.Json": "13.0.1"
},
"compile": {
"bin/placeholder/Tesses.Http.dll": {}
},
"runtime": {
"bin/placeholder/Tesses.Http.dll": {}
}
}
}
},
"libraries": {
"MimeTypesMap/1.0.8": {
"sha512": "iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"type": "package",
"path": "mimetypesmap/1.0.8",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net452/MimeTypesMap.dll",
"lib/netstandard1.1/MimeTypesMap.dll",
"lib/netstandard2.0/MimeTypesMap.dll",
"mimetypesmap.1.0.8.nupkg.sha512",
"mimetypesmap.nuspec"
]
},
"Newtonsoft.Json/13.0.1": {
"sha512": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"type": "package",
"path": "newtonsoft.json/13.0.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.md",
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
"lib/net35/Newtonsoft.Json.dll",
"lib/net35/Newtonsoft.Json.xml",
"lib/net40/Newtonsoft.Json.dll",
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/netstandard1.3/Newtonsoft.Json.dll",
"lib/netstandard1.3/Newtonsoft.Json.xml",
"lib/netstandard2.0/Newtonsoft.Json.dll",
"lib/netstandard2.0/Newtonsoft.Json.xml",
"newtonsoft.json.13.0.1.nupkg.sha512",
"newtonsoft.json.nuspec",
"packageIcon.png"
]
},
"Tesses.Http/1.0.0": {
"type": "project",
"path": "../Tesses.Http/Tesses.Http.csproj",
"msbuildProject": "../Tesses.Http/Tesses.Http.csproj"
}
},
"projectFileDependencyGroups": {
"net6.0": [
"MimeTypesMap >= 1.0.8",
"Tesses.Http >= 1.0.0"
]
},
"packageFolders": {
"/home/mike/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj",
"projectName": "Tesses.Http.Example",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"dependencies": {
"MimeTypesMap": {
"target": "Package",
"version": "[1.0.8, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,11 @@
{
"version": 2,
"dgSpecHash": "A8woRyUpBEU4D6Le2DtxwMxVTptzZORCoTf3qdNFIhnjolqjQ1PwH3yb6qegoOMCCGR84l4l+OBCQm87Yz4w6g==",
"success": true,
"projectFilePath": "/home/mike/Documents/Tesses.Http/Tesses.Http.Example/Tesses.Http.Example.csproj",
"expectedPackageFiles": [
"/home/mike/.nuget/packages/mimetypesmap/1.0.8/mimetypesmap.1.0.8.nupkg.sha512",
"/home/mike/.nuget/packages/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg.sha512"
],
"logs": []
}

View File

@ -0,0 +1,75 @@
using System.Net;
namespace Tesses.Http.KitchenSink;
class AspRouteStyle : ASPEndpointRequestHandler
{
[HttpGet]
public string Add(int a,int b)
{
return $"{a} + {b} = {a+b}";
}
[HttpGet]
public object Something(bool b,int i,double f,string sz)
{
return new {
Boolean = b,
Integer = i,
Double=f,
String=sz
};
}
}
class Program
{
public static async Task Main(string[] args)
{
MountableServer mountableServer=new MountableServer(RequestHandler.FromDirectory("WebSite"));
mountableServer.Mount("/SrcDl",RequestHandler.FromDelegateSync(e=>{
e.Response.SendFileAsDownload("Program.cs");
}));
mountableServer.Mount("/PasswordProtected",new BasicAuthRequestHandler((user,pass)=>{return user=="ddlovato" && pass=="somepassword";},RequestHandler.FromDelegateSync(e=>{
e.Response.WithContentType("text/plain").SendText("Password Protected Data");
})));
mountableServer.Mount("/4d",RequestHandler.FromDelegateSync(e=>{
HTTPClient client = HTTPClient.Open("GET","https://nextcloud.tesses.cf/apps/files_sharing/publicpreview/aYHgTAxNcAXNG3R?x=2258&y=727&a=true&file=celluloid-shot1007.jpg&scalingup=0");
client.SendToServer(e);
}));
mountableServer.Mount("/Endpoints/ASP",new AspRouteStyle());
mountableServer.Mount("/Endpoints/upload_data/",
RequestHandler.FromDelegateSync(e=>{
var parser=e.Request.GetMultipartParser();
parser.Parse((a,b,c)=>{
return File.Create(Path.Combine("WebSite","Endpoints","uploads",b));
},true).ToArray();
e.Response.WithContentType("text/plain").SendText("HELLO");
})
);
SendEvents evts=new SendEvents();
mountableServer.Mount("/counter/count",RequestHandler.FromDelegateSync(e=>{
e.Response.ServerSentEvents(evts);
}));
Thread t=new Thread(()=>{
for(long i =0;;i++){
evts.SendEvent($"Ran for {i} Seconds");
Thread.Sleep(1000);
}
});
t.Start();
HTTPServer server=new HTTPServer(mountableServer,new System.Net.Sockets.TcpListener(new IPEndPoint(0,3333)));
server.AllowMultipleRequestsOnOneConnection=true;
await server.ListenAsync();
}
}

View File

@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Tesses.Http\Tesses.Http.csproj" />
</ItemGroup>
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Upload a file</title>
</head>
<body>
<form method="post" action="./upload_data/" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit" value="Upload">
</form>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Counter</title>
</head>
<body>
<h1>Counter</h1>
<h3 id="txt"></h3>
<script>
const txt=document.getElementById('txt');
var source = new EventSource("/counter/count");
source.onmessage = function(event) {
txt.innerText = event.data;
};
</script>
</body>
</html>

View File

@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h1>Substance</h1>
</body>
</html>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,70 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v6.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v6.0": {
"Tesses.Http.KitchenSink/1.0.0": {
"dependencies": {
"Tesses.Http": "1.0.0"
},
"runtime": {
"Tesses.Http.KitchenSink.dll": {}
}
},
"MimeTypesMap/1.0.8": {
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {
"assemblyVersion": "1.0.8.0",
"fileVersion": "1.0.8.0"
}
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"Tesses.Http/1.0.0": {
"dependencies": {
"MimeTypesMap": "1.0.8",
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"Tesses.Http.dll": {}
}
}
}
},
"libraries": {
"Tesses.Http.KitchenSink/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"MimeTypesMap/1.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"path": "mimetypesmap/1.0.8",
"hashPath": "mimetypesmap.1.0.8.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"Tesses.Http/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

View File

@ -0,0 +1,9 @@
{
"runtimeOptions": {
"tfm": "net6.0",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "6.0.0"
}
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Tesses.Http.KitchenSink")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Tesses.Http.KitchenSink")]
[assembly: System.Reflection.AssemblyTitleAttribute("Tesses.Http.KitchenSink")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
e30a4ccd016835e1cef63b026d9deaeba2652d2f

View File

@ -0,0 +1,10 @@
is_global = true
build_property.TargetFramework = net6.0
build_property.TargetPlatformMinVersion =
build_property.UsingMicrosoftNETSdkWeb =
build_property.ProjectTypeGuids =
build_property.InvariantGlobalization =
build_property.PlatformNeutralAssembly =
build_property._SupportedPlatformList = Linux,macOS,Windows
build_property.RootNamespace = Tesses.Http.KitchenSink
build_property.ProjectDir = /home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/

View File

@ -0,0 +1,8 @@
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;

View File

@ -0,0 +1 @@
a746a4ef62ea153b4753b4a691f371551d06ef73

View File

@ -0,0 +1,20 @@
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.KitchenSink
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.KitchenSink.deps.json
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.KitchenSink.runtimeconfig.json
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.KitchenSink.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.KitchenSink.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/MimeTypesMap.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Newtonsoft.Json.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/bin/Debug/net6.0/Tesses.Http.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.csproj.AssemblyReference.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.GeneratedMSBuildEditorConfig.editorconfig
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.AssemblyInfoInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.AssemblyInfo.cs
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.csproj.CoreCompileInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.csproj.CopyComplete
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/refint/Tesses.Http.KitchenSink.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/Tesses.Http.KitchenSink.genruntimeconfig.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/Debug/net6.0/ref/Tesses.Http.KitchenSink.dll

View File

@ -0,0 +1 @@
fdff5d1ced5cbad40fd00269d754d3a7cf9b38cd

Binary file not shown.

View File

@ -0,0 +1,129 @@
{
"format": 1,
"restore": {
"/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj": {}
},
"projects": {
"/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj",
"projectName": "Tesses.Http.KitchenSink",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
},
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj",
"projectName": "Tesses.Http",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"dependencies": {
"MimeTypesMap": {
"target": "Package",
"version": "[1.0.8, )"
},
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
},
"Newtonsoft.Json": {
"target": "Package",
"version": "[13.0.1, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/mike/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/mike/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.2.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/mike/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,2 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />

View File

@ -0,0 +1,152 @@
{
"version": 3,
"targets": {
"net6.0": {
"MimeTypesMap/1.0.8": {
"type": "package",
"compile": {
"lib/netstandard2.0/MimeTypesMap.dll": {}
},
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {}
}
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
}
},
"Tesses.Http/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v2.0",
"dependencies": {
"MimeTypesMap": "1.0.8",
"Newtonsoft.Json": "13.0.1"
},
"compile": {
"bin/placeholder/Tesses.Http.dll": {}
},
"runtime": {
"bin/placeholder/Tesses.Http.dll": {}
}
}
}
},
"libraries": {
"MimeTypesMap/1.0.8": {
"sha512": "iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"type": "package",
"path": "mimetypesmap/1.0.8",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net452/MimeTypesMap.dll",
"lib/netstandard1.1/MimeTypesMap.dll",
"lib/netstandard2.0/MimeTypesMap.dll",
"mimetypesmap.1.0.8.nupkg.sha512",
"mimetypesmap.nuspec"
]
},
"Newtonsoft.Json/13.0.1": {
"sha512": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"type": "package",
"path": "newtonsoft.json/13.0.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.md",
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
"lib/net35/Newtonsoft.Json.dll",
"lib/net35/Newtonsoft.Json.xml",
"lib/net40/Newtonsoft.Json.dll",
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/netstandard1.3/Newtonsoft.Json.dll",
"lib/netstandard1.3/Newtonsoft.Json.xml",
"lib/netstandard2.0/Newtonsoft.Json.dll",
"lib/netstandard2.0/Newtonsoft.Json.xml",
"newtonsoft.json.13.0.1.nupkg.sha512",
"newtonsoft.json.nuspec",
"packageIcon.png"
]
},
"Tesses.Http/1.0.0": {
"type": "project",
"path": "../Tesses.Http/Tesses.Http.csproj",
"msbuildProject": "../Tesses.Http/Tesses.Http.csproj"
}
},
"projectFileDependencyGroups": {
"net6.0": [
"Tesses.Http >= 1.0.0"
]
},
"packageFolders": {
"/home/mike/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj",
"projectName": "Tesses.Http.KitchenSink",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"net6.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"projectReferences": {
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"net6.0": {
"targetAlias": "net6.0",
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"frameworkReferences": {
"Microsoft.NETCore.App": {
"privateAssets": "all"
}
},
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,11 @@
{
"version": 2,
"dgSpecHash": "V66VwZpW5UH8tYt+PlfbHAUTOj/+7/ZIV0E+qE9G+sD+0OWCrjem0xeUpchbVXkoPjrA3TP9s79jvfQpk0SVGQ==",
"success": true,
"projectFilePath": "/home/mike/Documents/Tesses.Http/Tesses.Http.KitchenSink/Tesses.Http.KitchenSink.csproj",
"expectedPackageFiles": [
"/home/mike/.nuget/packages/mimetypesmap/1.0.8/mimetypesmap.1.0.8.nupkg.sha512",
"/home/mike/.nuget/packages/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg.sha512"
],
"logs": []
}

View File

@ -0,0 +1,731 @@
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
namespace Tesses.Http.VFSCollection
{
public static class Extensions
{
public static void ExtractTessesArchive(this VirtualStorage storage,Stream strm,bool ownStream)
{
using(TArchiveReader reader=new TArchiveReader(strm,ownStream))
{
reader.ExtractEverything((t,n,len)=>{
if(t == EntryType.File)
{
string pardir = Path.GetDirectoryName(n.TrimStart('.').TrimStart('/'));
storage.CreateDirectory(pardir);
return storage.Open(pardir,FileMode.Create,FileAccess.Write,FileShare.None);
}
if(t == EntryType.Directory)
{
storage.CreateDirectory(n.TrimStart('.').TrimStart('/'));
}
return Stream.Null;
});
}
}
}
public enum EntryType : byte
{
File=0b00000000,
Directory=0b00000001,
Symlink=0b00000010
}
public class TArchiveReader : IDisposable
{
public delegate Stream ExtractEverythingDelegate(EntryType type,string name,long entLen);
public delegate void DoneWriting(Stream strm,string name);
public delegate void Symlink(string linkPath,string linkDest);
Stream strm;
bool own;
public TArchiveReader(Stream strm,bool ownStream=false)
{
this.strm=strm;
own=ownStream;
}
public TArchiveReader(string filename)
{
this.strm = File.OpenRead(filename);
own =true;
}
private void ReadLittleEndian(byte[] arrayToFill)
{
strm.Read(arrayToFill,0,arrayToFill.Length);
if(!BitConverter.IsLittleEndian)
{
Array.Reverse(arrayToFill);
}
}
private bool ReadEntryAttributes(out EntryType type, out string name,out long len)
{
// strm.WriteByte((byte)type);
//WriteString(name);
//WriteLittleEndian(BitConverter.GetBytes(len));
int t=strm.ReadByte();
if(t == -1)
{
type=EntryType.File;
name="ENDOFSTREAM.BIN";
len=0;
return false;
}
type=(EntryType)t;
name=ReadString();
byte[] len0 = new byte[8];
ReadLittleEndian(len0);
len=BitConverter.ToInt64(len0,0);
return true;
}
private string ReadString()
{
byte[] len = new byte[4];
ReadLittleEndian(len);
byte[] strdat=new byte[BitConverter.ToInt32(len,0)];
strm.Read(strdat,0,strdat.Length);
return System.Text.Encoding.UTF8.GetString(strdat);
}
private void ReadAndDiscard(long l)
{
if(strm.CanSeek)
{
strm.Seek(l,SeekOrigin.Current);
}else{
_copyTo(Stream.Null,l);
}
}
private void _copyTo(Stream strm,long len)
{
byte[] buff=new byte[1024];
long pos=0;
int read=0;
do{
read=(int)Math.Min(1024,len-pos);
if(read == 0) return;
read=this.strm.Read(buff,0,read);
strm.Write(buff,0,read);
pos+=read;
}while(read != 0);
}
public void ExtractStartingWith(string archivePath,string outputDir,Symlink symlink=null)
{
Dictionary<string,List<string>> _f=new Dictionary<string, List<string>>();
ExtractEverything((type,name,len)=>{
if(name.StartsWith(archivePath)){
switch(type)
{
case EntryType.File:
string fname=Path.Combine(outputDir,name);
string dirname = Path.GetDirectoryName(fname);
if(!string.IsNullOrWhiteSpace(dirname))
{
Directory.CreateDirectory(dirname);
}
return File.Create(fname);
case EntryType.Directory:
string fname0=Path.Combine(outputDir,name);
Directory.CreateDirectory(fname0);
break;
}
}
return Stream.Null;
},(strm0,name)=>{strm0.Dispose();},symlink);
}
public void Extract(string archivePath,Stream strm)
{
bool hasGone=false;;
ExtractEverything((type,name,len)=>{
if(hasGone) return null;
if(type == EntryType.File && name==archivePath){
hasGone=true;
return strm;
}
return Stream.Null;
});
}
public void ExtractEverything(string outputDir,Symlink symlink=null)
{
Dictionary<string,List<string>> _f=new Dictionary<string, List<string>>();
ExtractEverything((type,name,len)=>{
switch(type)
{
case EntryType.File:
string fname=Path.Combine(outputDir,name);
string dirname = Path.GetDirectoryName(fname);
if(!string.IsNullOrWhiteSpace(dirname))
{
Directory.CreateDirectory(dirname);
}
return File.Create(fname);
case EntryType.Directory:
string fname0=Path.Combine(outputDir,name);
Directory.CreateDirectory(fname0);
break;
}
return Stream.Null;
},(strm0,name)=>{strm0.Dispose();},symlink);
}
public void ExtractEverything(ExtractEverythingDelegate del,DoneWriting doneWriting=null,Symlink symlink=null)
{
if(del == null) return;
if(hasRead && strm.CanSeek)
{
strm.Seek(0,SeekOrigin.Begin);
}
if(hasRead && !strm.CanSeek)
{
throw new Exception("Can't Seek Stream");
}else{
bool read=false;
do{
EntryType type;
string name;
long len;
read=ReadEntryAttributes(out type,out name,out len);
if(read)
{
if(type == EntryType.Symlink)
{
MemoryStream strm=new MemoryStream();
_copyTo(strm,len);
using(StreamReader rdr=new StreamReader(strm))
{
string res= rdr.ReadToEnd();
symlink?.Invoke(name,res);
}
}else{
Stream strm=del(type,name,len);
if(strm == Stream.Null)
{
if(len>0)
ReadAndDiscard(len);
}
else if(strm != null)
{
_copyTo(strm,len);
if(doneWriting != null)
{
doneWriting(strm,name);
}else{
strm.Close();
}
}else{
hasRead=true;
return;
}
}}
}while(read);
hasRead=true;
}
}
bool hasRead=false;
public void Dispose()
{
if(own) strm.Dispose();
}
}
public class MemoryStorage : VirtualStorage
{
protected override void DeleteEmptyDirectory(string dir)
{
string[] _p=dir.Split('/');
if(_p.Length < 1) return;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
if(!(dir0.Entries[_p[_p.Length-1]].IsFile))
dir0.Entries.Remove(_p[_p.Length-1]);
}
}
public override string ActualPath => "mem:///";
public override void SetCreationTime(string filename, DateTime time)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
dir0.Entries[_p[_p.Length]].Created=time;
}
}
public override void SetLastAccessTime(string filename, DateTime time)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
dir0.Entries[_p[_p.Length]].LastAccess=time;
}
}
public override void SetLastWriteTime(string filename, DateTime time)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
dir0.Entries[_p[_p.Length]].LastWrite=time;
}
}
public override DateTime GetCreationTime(string filename)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return DateTime.Now;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
return dir0.Entries[_p[_p.Length]].Created;
}else{
return DateTime.Now;
}
}
public override DateTime GetLastWriteTime(string filename)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return DateTime.Now;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
return dir0.Entries[_p[_p.Length]].LastWrite;
}else{
return DateTime.Now;
}
}
public override DateTime GetLastAccessTime(string filename)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return DateTime.Now;
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir0.Entries.ContainsKey(_p[_p.Length-1]))
{
return dir0.Entries[_p[_p.Length]].LastAccess;
}else{
return DateTime.Now;
}
}
private abstract class MemoryEntry
{
public abstract bool IsFile {get;}
public DateTime Created {get;set;}
public DateTime LastWrite {get;set;}
public DateTime LastAccess {get;set;}
}
private class MemoryFile : MemoryEntry
{
public MemoryFile()
{
LastAccess=DateTime.Now;
LastWrite=DateTime.Now;
Created=DateTime.Now;
}
public bool HasWriteAccess=false;
public override bool IsFile => true;
public byte[] Data=new byte[0];
public void Overwrite(byte[] data)
{
lock(this)
{
Data=data;
LastWrite = DateTime.Now;
}
}
}
private class MemoryStream2 : MemoryStream
{
MemoryFile _f;
bool _canWrite;
public MemoryStream2(MemoryFile file,bool canWrite) : base(file.Data.ToArray(),canWrite) //copies data into file
{
file.LastAccess = DateTime.Now;
_f=file;
_canWrite=canWrite;
if(file.HasWriteAccess && _canWrite)
{
throw new IOException("MemoryStorage doesn't support simulatious writers");
}
if(!file.HasWriteAccess)
file.HasWriteAccess=_canWrite;
}
public override void Close()
{
if(_canWrite)
{
_f.Overwrite(this.ToArray());
_f.HasWriteAccess=false;
}
base.Close();
}
}
private class MemoryDirectory : MemoryEntry
{
public MemoryDirectory()
{
Created = DateTime.Now;
LastWrite=DateTime.Now;
LastAccess=DateTime.Now;
Entries=new Dictionary<string, MemoryEntry>();
}
public override bool IsFile => false;
public Dictionary<string,MemoryEntry> Entries {get;set;}
}
MemoryDirectory root=new MemoryDirectory();
public static MemoryStorage FromTessesArchive(Stream strm,bool ownStream)
{
MemoryStorage storage=new MemoryStorage();
storage.ExtractTessesArchive(strm,ownStream);
//public delegate Stream ExtractEverythingDelegate(EntryType type,string name,long entLen);
return storage;
}
private MemoryDirectory _create(MemoryDirectory dir,string p)
{
if(!dir.Entries.ContainsKey(p))
{
dir.Entries.Add(p,new MemoryDirectory());
}
var dir2= dir.Entries[p] as MemoryDirectory;
return dir2;
}
private MemoryEntry _get(MemoryDirectory dir,string p)
{
if(!dir.Entries.ContainsKey(p))
{
return null;
}
return dir.Entries[p];
}
public override void CreateDirectory(string path)
{
string[] _p=path.Split('/');
var dir = root;
List<string> __c=new List<string>();
foreach(var item in _p)
{
dir= _create(root,item);
__c.Add(item);
if(dir == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
}
public override void Delete(string file)
{
string[] _p=file.Split('/');
if(_p.Length < 1) return;
List<string> __c=new List<string>();
MemoryDirectory dir=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir=_get(dir,item) as MemoryDirectory;
__c.Add(item);
if(dir == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir.Entries.ContainsKey(_p[_p.Length-1]))
{
if(dir.Entries[_p[_p.Length-1]].IsFile)
dir.Entries.Remove(_p[_p.Length-1]);
}
}
public override bool DirectoryExists(string filename)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return false;
List<string> __c=new List<string>();
MemoryDirectory dir=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir=_get(dir,item) as MemoryDirectory;
__c.Add(item);
if(dir == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir.Entries.ContainsKey(_p[_p.Length-1]))
{
return !(dir.Entries[_p[_p.Length-1]].IsFile);
}
return false;
}
public override IEnumerable<string> EnumerateDirectories(string dir)
{
string[] _p=dir.Split('/');
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p)
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
foreach(var items in dir0.Entries)
{
if(!items.Value.IsFile)
yield return items.Key;
}
}
public override IEnumerable<string> EnumerateFiles(string dir)
{
string[] _p=dir.Split('/');
List<string> __c=new List<string>();
MemoryDirectory dir0=root;
foreach(var item in _p)
{
dir0=_get(dir0,item) as MemoryDirectory;
__c.Add(item);
if(dir0 == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
foreach(var items in dir0.Entries)
{
if(items.Value.IsFile)
yield return items.Key;
}
}
public override bool FileExists(string filename)
{
string[] _p=filename.Split('/');
if(_p.Length < 1) return false;
List<string> __c=new List<string>();
MemoryDirectory dir=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir=_get(dir,item) as MemoryDirectory;
__c.Add(item);
if(dir == null)
{
throw new Exception($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
if(dir.Entries.ContainsKey(_p[_p.Length-1]))
{
return (dir.Entries[_p[_p.Length-1]].IsFile);
}
return false;
}
public override Stream Open(string file, FileMode mode, FileAccess access, FileShare share)
{
string[] _p=file.Split('/');
if(_p.Length < 1) throw new IOException("Path empty");
List<string> __c=new List<string>();
MemoryDirectory dir=root;
foreach(var item in _p.Take(_p.Length -1))
{
dir=_get(dir,item) as MemoryDirectory;
__c.Add(item);
if(dir == null)
{
throw new IOException($"The path {PathCombine(__c)} is a file, should be a directory");
}
}
//we will now try to get the file
string filename=_p[_p.Length -1];
if(dir.Entries.ContainsKey(filename))
{
if(!dir.Entries[filename].IsFile) throw new IOException("Not a file");
//the file exists
if(mode == FileMode.CreateNew) throw new IOException("File Exists");
var _file= dir.Entries[filename] as MemoryFile;
lock(_file)
{
if(mode == FileMode.Create) {
_file.Data=new byte[0];
}
//we need to open file
MemoryStream2 strm=new MemoryStream2(_file,access != FileAccess.Read);
if(mode != FileMode.Truncate)
{
strm.Position=0;
}else{
strm.Position=strm.Length;
}
return strm;
}
}else{
if(mode == FileMode.Open) throw new IOException("File Doesn't Exist");
MemoryFile _file=new MemoryFile();
dir.Entries.Add(filename,_file);
lock(_file)
{
MemoryStream2 strm=new MemoryStream2(_file,access != FileAccess.Read);
return strm;
}
//the file doesnt exist
}
}
}
public class SSHStorage : VirtualStorage
{
public override void CreateDirectory(string path)
{
throw new NotImplementedException();
}
public override void Delete(string file)
{
throw new NotImplementedException();
}
public override bool DirectoryExists(string filename)
{
throw new NotImplementedException();
}
public override IEnumerable<string> EnumerateDirectories(string dir)
{
throw new NotImplementedException();
}
public override IEnumerable<string> EnumerateFiles(string dir)
{
throw new NotImplementedException();
}
public override bool FileExists(string filename)
{
throw new NotImplementedException();
}
public override Stream Open(string file, FileMode mode, FileAccess access, FileShare share)
{
throw new NotImplementedException();
}
}
}

View File

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<ProjectReference Include="..\Tesses.Http\Tesses.Http.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="SSH.NET" Version="2020.0.2" />
</ItemGroup>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,92 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"Tesses.Http.VFSCollection/1.0.0": {
"dependencies": {
"NETStandard.Library": "2.0.3",
"Tesses.Http": "1.0.0"
},
"runtime": {
"Tesses.Http.VFSCollection.dll": {}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"MimeTypesMap/1.0.8": {
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {
"assemblyVersion": "1.0.8.0",
"fileVersion": "1.0.8.0"
}
}
},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
},
"Newtonsoft.Json/13.0.1": {
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {
"assemblyVersion": "13.0.0.0",
"fileVersion": "13.0.1.25517"
}
}
},
"Tesses.Http/1.0.0": {
"dependencies": {
"MimeTypesMap": "1.0.8",
"Newtonsoft.Json": "13.0.1"
},
"runtime": {
"Tesses.Http.dll": {}
}
}
}
},
"libraries": {
"Tesses.Http.VFSCollection/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"MimeTypesMap/1.0.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"path": "mimetypesmap/1.0.8",
"hashPath": "mimetypesmap.1.0.8.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"path": "newtonsoft.json/13.0.1",
"hashPath": "newtonsoft.json.13.0.1.nupkg.sha512"
},
"Tesses.Http/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
}
}
}

View File

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]

View File

@ -0,0 +1,22 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("Tesses.Http.VFSCollection")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
[assembly: System.Reflection.AssemblyProductAttribute("Tesses.Http.VFSCollection")]
[assembly: System.Reflection.AssemblyTitleAttribute("Tesses.Http.VFSCollection")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
// Generated by the MSBuild WriteCodeFragment class.

View File

@ -0,0 +1 @@
e923dcb2a108173e8b86fc6ff1172ab495aac9d0

View File

@ -0,0 +1,3 @@
is_global = true
build_property.RootNamespace = Tesses.Http.VFSCollection
build_property.ProjectDir = /home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/

View File

@ -0,0 +1 @@
a592453a8b5bace07babb87dbe5b1e4bf71dead9

View File

@ -0,0 +1,13 @@
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/bin/Debug/netstandard2.0/Tesses.Http.VFSCollection.deps.json
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/bin/Debug/netstandard2.0/Tesses.Http.VFSCollection.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/bin/Debug/netstandard2.0/Tesses.Http.VFSCollection.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/bin/Debug/netstandard2.0/Tesses.Http.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/bin/Debug/netstandard2.0/Tesses.Http.pdb
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.csproj.AssemblyReference.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.GeneratedMSBuildEditorConfig.editorconfig
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.AssemblyInfoInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.AssemblyInfo.cs
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.csproj.CoreCompileInputs.cache
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.csproj.CopyComplete
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.dll
/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/Debug/netstandard2.0/Tesses.Http.VFSCollection.pdb

View File

@ -0,0 +1,136 @@
{
"format": 1,
"restore": {
"/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj": {}
},
"projects": {
"/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj",
"projectName": "Tesses.Http.VFSCollection",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"dependencies": {
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
},
"SSH.NET": {
"target": "Package",
"version": "[2020.0.2, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
},
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj",
"projectName": "Tesses.Http",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"dependencies": {
"MimeTypesMap": {
"target": "Package",
"version": "[1.0.8, )"
},
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
},
"Newtonsoft.Json": {
"target": "Package",
"version": "[13.0.1, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
}
}
}

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/mike/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/mike/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.2.1</NuGetToolVersion>
</PropertyGroup>
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<SourceRoot Include="/home/mike/.nuget/packages/" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<Import Project="$(NuGetPackageRoot)netstandard.library/2.0.3/build/netstandard2.0/NETStandard.Library.targets" Condition="Exists('$(NuGetPackageRoot)netstandard.library/2.0.3/build/netstandard2.0/NETStandard.Library.targets')" />
</ImportGroup>
</Project>

View File

@ -0,0 +1,414 @@
{
"version": 3,
"targets": {
".NETStandard,Version=v2.0": {
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"compile": {
"lib/netstandard1.0/_._": {}
},
"runtime": {
"lib/netstandard1.0/_._": {}
}
},
"MimeTypesMap/1.0.8": {
"type": "package",
"compile": {
"lib/netstandard2.0/MimeTypesMap.dll": {}
},
"runtime": {
"lib/netstandard2.0/MimeTypesMap.dll": {}
}
},
"NETStandard.Library/2.0.3": {
"type": "package",
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
},
"compile": {
"lib/netstandard1.0/_._": {}
},
"runtime": {
"lib/netstandard1.0/_._": {}
},
"build": {
"build/netstandard2.0/NETStandard.Library.targets": {}
}
},
"Newtonsoft.Json/13.0.1": {
"type": "package",
"compile": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
},
"runtime": {
"lib/netstandard2.0/Newtonsoft.Json.dll": {}
}
},
"SSH.NET/2020.0.2": {
"type": "package",
"dependencies": {
"SshNet.Security.Cryptography": "[1.3.0]"
},
"compile": {
"lib/netstandard2.0/Renci.SshNet.dll": {}
},
"runtime": {
"lib/netstandard2.0/Renci.SshNet.dll": {}
}
},
"SshNet.Security.Cryptography/1.3.0": {
"type": "package",
"compile": {
"lib/netstandard2.0/SshNet.Security.Cryptography.dll": {}
},
"runtime": {
"lib/netstandard2.0/SshNet.Security.Cryptography.dll": {}
}
},
"Tesses.Http/1.0.0": {
"type": "project",
"framework": ".NETStandard,Version=v2.0",
"dependencies": {
"MimeTypesMap": "1.0.8",
"Newtonsoft.Json": "13.0.1"
},
"compile": {
"bin/placeholder/Tesses.Http.dll": {}
},
"runtime": {
"bin/placeholder/Tesses.Http.dll": {}
}
}
}
},
"libraries": {
"Microsoft.NETCore.Platforms/1.1.0": {
"sha512": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"type": "package",
"path": "microsoft.netcore.platforms/1.1.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"ThirdPartyNotices.txt",
"dotnet_library_license.txt",
"lib/netstandard1.0/_._",
"microsoft.netcore.platforms.1.1.0.nupkg.sha512",
"microsoft.netcore.platforms.nuspec",
"runtime.json"
]
},
"MimeTypesMap/1.0.8": {
"sha512": "iOm6Zar+yVROhlyrGGSJTfThvNoHLUeYeQQND9YD/ot/nA2qsWUp9kP2MHTdF9P7I8afW6eCf8vdELLZjDFdSQ==",
"type": "package",
"path": "mimetypesmap/1.0.8",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net452/MimeTypesMap.dll",
"lib/netstandard1.1/MimeTypesMap.dll",
"lib/netstandard2.0/MimeTypesMap.dll",
"mimetypesmap.1.0.8.nupkg.sha512",
"mimetypesmap.nuspec"
]
},
"NETStandard.Library/2.0.3": {
"sha512": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"type": "package",
"path": "netstandard.library/2.0.3",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.TXT",
"THIRD-PARTY-NOTICES.TXT",
"build/netstandard2.0/NETStandard.Library.targets",
"build/netstandard2.0/ref/Microsoft.Win32.Primitives.dll",
"build/netstandard2.0/ref/System.AppContext.dll",
"build/netstandard2.0/ref/System.Collections.Concurrent.dll",
"build/netstandard2.0/ref/System.Collections.NonGeneric.dll",
"build/netstandard2.0/ref/System.Collections.Specialized.dll",
"build/netstandard2.0/ref/System.Collections.dll",
"build/netstandard2.0/ref/System.ComponentModel.Composition.dll",
"build/netstandard2.0/ref/System.ComponentModel.EventBasedAsync.dll",
"build/netstandard2.0/ref/System.ComponentModel.Primitives.dll",
"build/netstandard2.0/ref/System.ComponentModel.TypeConverter.dll",
"build/netstandard2.0/ref/System.ComponentModel.dll",
"build/netstandard2.0/ref/System.Console.dll",
"build/netstandard2.0/ref/System.Core.dll",
"build/netstandard2.0/ref/System.Data.Common.dll",
"build/netstandard2.0/ref/System.Data.dll",
"build/netstandard2.0/ref/System.Diagnostics.Contracts.dll",
"build/netstandard2.0/ref/System.Diagnostics.Debug.dll",
"build/netstandard2.0/ref/System.Diagnostics.FileVersionInfo.dll",
"build/netstandard2.0/ref/System.Diagnostics.Process.dll",
"build/netstandard2.0/ref/System.Diagnostics.StackTrace.dll",
"build/netstandard2.0/ref/System.Diagnostics.TextWriterTraceListener.dll",
"build/netstandard2.0/ref/System.Diagnostics.Tools.dll",
"build/netstandard2.0/ref/System.Diagnostics.TraceSource.dll",
"build/netstandard2.0/ref/System.Diagnostics.Tracing.dll",
"build/netstandard2.0/ref/System.Drawing.Primitives.dll",
"build/netstandard2.0/ref/System.Drawing.dll",
"build/netstandard2.0/ref/System.Dynamic.Runtime.dll",
"build/netstandard2.0/ref/System.Globalization.Calendars.dll",
"build/netstandard2.0/ref/System.Globalization.Extensions.dll",
"build/netstandard2.0/ref/System.Globalization.dll",
"build/netstandard2.0/ref/System.IO.Compression.FileSystem.dll",
"build/netstandard2.0/ref/System.IO.Compression.ZipFile.dll",
"build/netstandard2.0/ref/System.IO.Compression.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.DriveInfo.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.Primitives.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.Watcher.dll",
"build/netstandard2.0/ref/System.IO.FileSystem.dll",
"build/netstandard2.0/ref/System.IO.IsolatedStorage.dll",
"build/netstandard2.0/ref/System.IO.MemoryMappedFiles.dll",
"build/netstandard2.0/ref/System.IO.Pipes.dll",
"build/netstandard2.0/ref/System.IO.UnmanagedMemoryStream.dll",
"build/netstandard2.0/ref/System.IO.dll",
"build/netstandard2.0/ref/System.Linq.Expressions.dll",
"build/netstandard2.0/ref/System.Linq.Parallel.dll",
"build/netstandard2.0/ref/System.Linq.Queryable.dll",
"build/netstandard2.0/ref/System.Linq.dll",
"build/netstandard2.0/ref/System.Net.Http.dll",
"build/netstandard2.0/ref/System.Net.NameResolution.dll",
"build/netstandard2.0/ref/System.Net.NetworkInformation.dll",
"build/netstandard2.0/ref/System.Net.Ping.dll",
"build/netstandard2.0/ref/System.Net.Primitives.dll",
"build/netstandard2.0/ref/System.Net.Requests.dll",
"build/netstandard2.0/ref/System.Net.Security.dll",
"build/netstandard2.0/ref/System.Net.Sockets.dll",
"build/netstandard2.0/ref/System.Net.WebHeaderCollection.dll",
"build/netstandard2.0/ref/System.Net.WebSockets.Client.dll",
"build/netstandard2.0/ref/System.Net.WebSockets.dll",
"build/netstandard2.0/ref/System.Net.dll",
"build/netstandard2.0/ref/System.Numerics.dll",
"build/netstandard2.0/ref/System.ObjectModel.dll",
"build/netstandard2.0/ref/System.Reflection.Extensions.dll",
"build/netstandard2.0/ref/System.Reflection.Primitives.dll",
"build/netstandard2.0/ref/System.Reflection.dll",
"build/netstandard2.0/ref/System.Resources.Reader.dll",
"build/netstandard2.0/ref/System.Resources.ResourceManager.dll",
"build/netstandard2.0/ref/System.Resources.Writer.dll",
"build/netstandard2.0/ref/System.Runtime.CompilerServices.VisualC.dll",
"build/netstandard2.0/ref/System.Runtime.Extensions.dll",
"build/netstandard2.0/ref/System.Runtime.Handles.dll",
"build/netstandard2.0/ref/System.Runtime.InteropServices.RuntimeInformation.dll",
"build/netstandard2.0/ref/System.Runtime.InteropServices.dll",
"build/netstandard2.0/ref/System.Runtime.Numerics.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Formatters.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Json.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Primitives.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.Xml.dll",
"build/netstandard2.0/ref/System.Runtime.Serialization.dll",
"build/netstandard2.0/ref/System.Runtime.dll",
"build/netstandard2.0/ref/System.Security.Claims.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Algorithms.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Csp.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Encoding.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.Primitives.dll",
"build/netstandard2.0/ref/System.Security.Cryptography.X509Certificates.dll",
"build/netstandard2.0/ref/System.Security.Principal.dll",
"build/netstandard2.0/ref/System.Security.SecureString.dll",
"build/netstandard2.0/ref/System.ServiceModel.Web.dll",
"build/netstandard2.0/ref/System.Text.Encoding.Extensions.dll",
"build/netstandard2.0/ref/System.Text.Encoding.dll",
"build/netstandard2.0/ref/System.Text.RegularExpressions.dll",
"build/netstandard2.0/ref/System.Threading.Overlapped.dll",
"build/netstandard2.0/ref/System.Threading.Tasks.Parallel.dll",
"build/netstandard2.0/ref/System.Threading.Tasks.dll",
"build/netstandard2.0/ref/System.Threading.Thread.dll",
"build/netstandard2.0/ref/System.Threading.ThreadPool.dll",
"build/netstandard2.0/ref/System.Threading.Timer.dll",
"build/netstandard2.0/ref/System.Threading.dll",
"build/netstandard2.0/ref/System.Transactions.dll",
"build/netstandard2.0/ref/System.ValueTuple.dll",
"build/netstandard2.0/ref/System.Web.dll",
"build/netstandard2.0/ref/System.Windows.dll",
"build/netstandard2.0/ref/System.Xml.Linq.dll",
"build/netstandard2.0/ref/System.Xml.ReaderWriter.dll",
"build/netstandard2.0/ref/System.Xml.Serialization.dll",
"build/netstandard2.0/ref/System.Xml.XDocument.dll",
"build/netstandard2.0/ref/System.Xml.XPath.XDocument.dll",
"build/netstandard2.0/ref/System.Xml.XPath.dll",
"build/netstandard2.0/ref/System.Xml.XmlDocument.dll",
"build/netstandard2.0/ref/System.Xml.XmlSerializer.dll",
"build/netstandard2.0/ref/System.Xml.dll",
"build/netstandard2.0/ref/System.dll",
"build/netstandard2.0/ref/mscorlib.dll",
"build/netstandard2.0/ref/netstandard.dll",
"build/netstandard2.0/ref/netstandard.xml",
"lib/netstandard1.0/_._",
"netstandard.library.2.0.3.nupkg.sha512",
"netstandard.library.nuspec"
]
},
"Newtonsoft.Json/13.0.1": {
"sha512": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A==",
"type": "package",
"path": "newtonsoft.json/13.0.1",
"files": [
".nupkg.metadata",
".signature.p7s",
"LICENSE.md",
"lib/net20/Newtonsoft.Json.dll",
"lib/net20/Newtonsoft.Json.xml",
"lib/net35/Newtonsoft.Json.dll",
"lib/net35/Newtonsoft.Json.xml",
"lib/net40/Newtonsoft.Json.dll",
"lib/net40/Newtonsoft.Json.xml",
"lib/net45/Newtonsoft.Json.dll",
"lib/net45/Newtonsoft.Json.xml",
"lib/netstandard1.0/Newtonsoft.Json.dll",
"lib/netstandard1.0/Newtonsoft.Json.xml",
"lib/netstandard1.3/Newtonsoft.Json.dll",
"lib/netstandard1.3/Newtonsoft.Json.xml",
"lib/netstandard2.0/Newtonsoft.Json.dll",
"lib/netstandard2.0/Newtonsoft.Json.xml",
"newtonsoft.json.13.0.1.nupkg.sha512",
"newtonsoft.json.nuspec",
"packageIcon.png"
]
},
"SSH.NET/2020.0.2": {
"sha512": "G0dNlTBAM00KZXv1wWVwgg26d9/METcM6qWBpNQwllzQmmbu+Zu+FS1L1X4fFgGdPu3e8k9mmTBu6SwtQ0614g==",
"type": "package",
"path": "ssh.net/2020.0.2",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net35/Renci.SshNet.dll",
"lib/net35/Renci.SshNet.xml",
"lib/net40/Renci.SshNet.dll",
"lib/net40/Renci.SshNet.xml",
"lib/netstandard1.3/Renci.SshNet.dll",
"lib/netstandard1.3/Renci.SshNet.xml",
"lib/netstandard2.0/Renci.SshNet.dll",
"lib/netstandard2.0/Renci.SshNet.xml",
"lib/sl4/Renci.SshNet.dll",
"lib/sl4/Renci.SshNet.xml",
"lib/sl5/Renci.SshNet.dll",
"lib/sl5/Renci.SshNet.xml",
"lib/uap10/Renci.SshNet.dll",
"lib/uap10/Renci.SshNet.xml",
"lib/wp71/Renci.SshNet.dll",
"lib/wp71/Renci.SshNet.xml",
"lib/wp8/Renci.SshNet.dll",
"lib/wp8/Renci.SshNet.xml",
"ssh.net.2020.0.2.nupkg.sha512",
"ssh.net.nuspec"
]
},
"SshNet.Security.Cryptography/1.3.0": {
"sha512": "5pBIXRjcSO/amY8WztpmNOhaaCNHY/B6CcYDI7FSTgqSyo/ZUojlLiKcsl+YGbxQuLX439qIkMfP0PHqxqJi/Q==",
"type": "package",
"path": "sshnet.security.cryptography/1.3.0",
"files": [
".nupkg.metadata",
".signature.p7s",
"lib/net20/SshNet.Security.Cryptography.dll",
"lib/net20/SshNet.Security.Cryptography.xml",
"lib/net40/SshNet.Security.Cryptography.dll",
"lib/net40/SshNet.Security.Cryptography.xml",
"lib/net45/SshNet.Security.Cryptography.dll",
"lib/net45/SshNet.Security.Cryptography.xml",
"lib/netstandard1.0/SshNet.Security.Cryptography.dll",
"lib/netstandard1.0/SshNet.Security.Cryptography.xml",
"lib/netstandard1.3/SshNet.Security.Cryptography.dll",
"lib/netstandard1.3/SshNet.Security.Cryptography.xml",
"lib/netstandard2.0/SshNet.Security.Cryptography.dll",
"lib/netstandard2.0/SshNet.Security.Cryptography.xml",
"lib/portable-net45+win8+wpa81/SshNet.Security.Cryptography.dll",
"lib/portable-net45+win8+wpa81/SshNet.Security.Cryptography.xml",
"lib/sl4/SshNet.Security.Cryptography.dll",
"lib/sl4/SshNet.Security.Cryptography.xml",
"lib/sl5/SshNet.Security.Cryptography.dll",
"lib/sl5/SshNet.Security.Cryptography.xml",
"lib/uap10.0/SshNet.Security.Cryptography.dll",
"lib/uap10.0/SshNet.Security.Cryptography.xml",
"lib/wp71/SshNet.Security.Cryptography.dll",
"lib/wp71/SshNet.Security.Cryptography.xml",
"lib/wp8/SshNet.Security.Cryptography.dll",
"lib/wp8/SshNet.Security.Cryptography.xml",
"sshnet.security.cryptography.1.3.0.nupkg.sha512",
"sshnet.security.cryptography.nuspec"
]
},
"Tesses.Http/1.0.0": {
"type": "project",
"path": "../Tesses.Http/Tesses.Http.csproj",
"msbuildProject": "../Tesses.Http/Tesses.Http.csproj"
}
},
"projectFileDependencyGroups": {
".NETStandard,Version=v2.0": [
"NETStandard.Library >= 2.0.3",
"SSH.NET >= 2020.0.2",
"Tesses.Http >= 1.0.0"
]
},
"packageFolders": {
"/home/mike/.nuget/packages/": {}
},
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj",
"projectName": "Tesses.Http.VFSCollection",
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj",
"packagesPath": "/home/mike/.nuget/packages/",
"outputPath": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/obj/",
"projectStyle": "PackageReference",
"configFilePaths": [
"/home/mike/.nuget/NuGet/NuGet.Config"
],
"originalTargetFrameworks": [
"netstandard2.0"
],
"sources": {
"/usr/share/dotnet/library-packs": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"projectReferences": {
"/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj": {
"projectPath": "/home/mike/Documents/Tesses.Http/Tesses.Http/Tesses.Http.csproj"
}
}
}
},
"warningProperties": {
"warnAsError": [
"NU1605"
]
}
},
"frameworks": {
"netstandard2.0": {
"targetAlias": "netstandard2.0",
"dependencies": {
"NETStandard.Library": {
"suppressParent": "All",
"target": "Package",
"version": "[2.0.3, )",
"autoReferenced": true
},
"SSH.NET": {
"target": "Package",
"version": "[2020.0.2, )"
}
},
"imports": [
"net461",
"net462",
"net47",
"net471",
"net472",
"net48"
],
"assetTargetFallback": true,
"warn": true,
"runtimeIdentifierGraphPath": "/usr/share/dotnet/sdk/6.0.302/RuntimeIdentifierGraph.json"
}
}
}
}

View File

@ -0,0 +1,15 @@
{
"version": 2,
"dgSpecHash": "Tpviiwao27yHwlw/jaZfgfslyiUqqYM9sFSMDY5pwqTbFMinid1RpT1ua6/ecBv6/fhW5NjAwUYtdS24ZyhdDA==",
"success": true,
"projectFilePath": "/home/mike/Documents/Tesses.Http/Tesses.Http.VFSCollection/Tesses.Http.VFSCollection.csproj",
"expectedPackageFiles": [
"/home/mike/.nuget/packages/microsoft.netcore.platforms/1.1.0/microsoft.netcore.platforms.1.1.0.nupkg.sha512",
"/home/mike/.nuget/packages/mimetypesmap/1.0.8/mimetypesmap.1.0.8.nupkg.sha512",
"/home/mike/.nuget/packages/netstandard.library/2.0.3/netstandard.library.2.0.3.nupkg.sha512",
"/home/mike/.nuget/packages/newtonsoft.json/13.0.1/newtonsoft.json.13.0.1.nupkg.sha512",
"/home/mike/.nuget/packages/ssh.net/2020.0.2/ssh.net.2020.0.2.nupkg.sha512",
"/home/mike/.nuget/packages/sshnet.security.cryptography/1.3.0/sshnet.security.cryptography.1.3.0.nupkg.sha512"
],
"logs": []
}

View File

@ -0,0 +1,441 @@
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading;
using System.Text;
using Newtonsoft.Json;
using System.Reflection;
using System.Linq;
using HeyRed.Mime;
namespace Tesses.Http
{
public abstract class ASPEndpointRequestHandler : IRequestHandler
{
protected virtual Stream GetPostFileStream(string name,string filename,string contentType)
{
return new MemoryStream();
}
List<___RouteMethod> ___RouteMethods=new List<___RouteMethod>();
private class ___RouteMethod
{
public string Method;
public bool ContainsServerCtx;
public bool ContainsMultipart;
public bool ReturnsVoid;
public string Name;
public MethodInfo info;
public ASPEndpointRequestHandler _instance;
public void Call(ServerContext ctx,MultipartParser p,Dictionary<string,List<string>> args)
{
if(!ContainsMultipart && p != null)
{
foreach(var item in p.Parse(_instance.GetPostFileStream,true))
{
if(!item.HasFileName)
{
args.Add(item.Name,item.GetStringData());
}
}
}
object[] ar_= _args.Select<___Arg,object>((e)=>{
return e.GetArgument(ctx,p,args);
}).ToArray();
object o=info.Invoke(_instance,ar_);
if(!ReturnsVoid)
{
IResponse r = o as IResponse;
Stream s = o as Stream;
string r2 = o as string;
StringBuilder b=o as StringBuilder;
if(r!=null)
{
r.Handle(ctx);
}else if(s != null)
{
FileResponse resp=new FileResponse(s,"application/octet-stream",true);
resp.Handle(ctx);
}else if(b != null)
{
TextResponse resp=new TextResponse(b.ToString(),"text/plain");
resp.Handle(ctx);
}
else if(!string.IsNullOrEmpty(r2))
{
TextResponse resp=new TextResponse(r2,"text/plain");
resp.Handle(ctx);
}else{
TextResponse resp=new TextResponse(JsonConvert.SerializeObject(o),"application/json");
resp.Handle(ctx);
}
}
}
public List<___Arg> _args=new List<___Arg>();
}
private class ___Arg
{
public bool _isServerCtx;
public bool _isMultipart;
public string name;
public Type type;
private object Default()
{
if(type.GetTypeInfo().IsValueType)
{
return Activator.CreateInstance(type);
}
return null;
}
private object ___to_type_ar(Type t,List<string> items)
{
object o;
if(t.IsArray)
{
var t0=t.MakeArrayType();
object[] items2=new object[items.Count];
foreach(var item in items)
{
___to_type(t0,item);
}
o=items;
}else{
o=___to_type(t,items.FirstOrDefault());
}
return o;
}
private object ___to_type(Type t,string value)
{
try{
if(t == typeof(String))
{
return value;
}
foreach(var item in t.GetMethods())
{
var _params = item.GetParameters();
if(_params.Length != 1)
{
continue;
}
if(_params[0].ParameterType != typeof(String)) continue;
if(item.IsStatic && !item.IsConstructor && item.Name == "Parse")
{
return item.Invoke(null,new object[]{value});
}
if(item.IsConstructor)
{
return Activator.CreateInstance(t,value);
}
}
MethodInfo method = typeof(JsonConvert).GetMethod(nameof(JsonConvert.SerializeObject));
MethodInfo generic = method.MakeGenericMethod(t);
return generic.Invoke(null,new object[]{value});
}catch(Exception ex)
{
_=ex;
return Default();
}
}
public object GetArgument(ServerContext ctx,MultipartParser p,Dictionary<string,List<string>> args)
{
if(_isServerCtx)
{
return ctx;
}
if(_isMultipart)
{
return p;
}
foreach(var item in args)
{
if(item.Key.ToLower() == name)
{
return ___to_type_ar(type,item.Value);
}
}
return Default();
}
}
public TextResponse String(string text,string mimeType="text/html")
{
return new TextResponse(text,mimeType);
}
public FileResponse File(Stream strm,string mimeType,bool ownStream=true)
{
return new FileResponse(strm,mimeType,ownStream);
}
public FileResponse File(string filename,bool inline=true)
{
return new FileResponse(filename,inline);
}
public FileResponse File(Stream strm,string mimeType,string filename,bool inline=false,bool ownStream=false)
{
return new FileResponse(strm,mimeType,filename,inline,ownStream);
}
bool ___has_loaded=false;
private void ___lazy_load_everything()
{
if(!___has_loaded)
{
Type t=GetType();
foreach(var item in t.GetMethods())
{
IHttpRoute route = new HttpGetAttribute($"/{item.Name}");
foreach(var r in item.GetCustomAttributes())
{
var rte=r as IHttpRoute;
if(rte != null)
{
route=rte;
if(string.IsNullOrWhiteSpace(rte.RouteName))
{
route.RouteName = $"/{item.Name}";
}
break;
}
}
___RouteMethod m=new ___RouteMethod();
var __props = item.GetParameters();
m.ContainsServerCtx = __props.Any(e=>e.ParameterType == typeof(ServerContext));
m.ContainsMultipart = __props.Any(e=>e.ParameterType == typeof(MultipartParser));
m.ReturnsVoid = item.ReturnType == typeof(void);
m.info=item;
m.Name = route.RouteName;
m.Method=route.Method;
m._instance = this;
m._args=new List<___Arg>();
if(m.ContainsServerCtx || !m.ReturnsVoid)
{
//add route to
foreach(var args in __props)
{
___Arg a=new ___Arg();
a._isServerCtx = args.ParameterType == typeof(ServerContext);
a._isMultipart = args.ParameterType == typeof(MultipartParser);
a.name = args.Name.ToLower();
a.type = args.ParameterType;
m._args.Add(a);
}
___RouteMethods.Add(m);
}
}
}
___has_loaded=true;
}
public async Task Handle(ServerContext ctx)
{
___lazy_load_everything();
Dictionary<string,List<string>> args=new Dictionary<string, List<string>>();
MultipartParser parser=null;
foreach(var m in ___RouteMethods)
{
args.Clear();
string p=ctx.Request.GetQueryParameters(ctx.Request.CurrentUrl,args);
if(m.Method == ctx.Request.RequestLine.Method && m.Name ==p)
{
//want to check for method
if(m.Method == "POST")
{
string _ctt;
if(ctx.Request.Headers.TryGetFirst("Content-Type",out _ctt))
{
if(_ctt.StartsWith("multipart/form-data"))
{
parser = ctx.Request.GetMultipartParser();
}
if(_ctt == "application/x-www-form-urlencoded")
{
ctx.Request.GetUrlEncodedPost(args);
}
}
}
m.Call(ctx,parser,args);
break;
}
}
await Task.CompletedTask;
}
}
public class FileResponse : IResponse
{
bool inline;
public FileResponse(Stream strm,string mimeType,bool ownStream)
{
this.ownStream=ownStream;
Stream = strm;
MimeType=mimeType;
FileName="";
}
public FileResponse(Stream strm,string mimeType,string filename,bool inline,bool ownStream)
{
this.ownStream=ownStream;
Stream =strm;
MimeType = mimeType;
FileName=filename;
this.inline=inline;
}
bool ownStream;
public FileResponse(string filename,bool inline)
{
ownStream=true;
MimeType=MimeTypesMap.GetMimeType(filename);
Stream=File.OpenRead(filename);
FileName = Path.GetFileName(filename);
this.inline=inline;
}
public Stream Stream {get;set;}
public string MimeType {get;set;}
public string FileName {get;set;}
public void Handle(ServerContext ctx)
{
if(string.IsNullOrWhiteSpace(FileName))
{
ctx.Response.WithContentType(MimeType).SendRangableResponseStream(Stream);
}else{
ctx.Response.WithContentType(MimeType).WithFileName(FileName,inline).SendRangableResponseStream(Stream);
}
if(ownStream)
Stream.Dispose();
}
}
public class TextResponse : IResponse
{
public TextResponse(string text,string mime)
{
Text=text;
MimeType=mime;
}
public string Text {get;set;}
public string MimeType {get;set;}
public void Handle(ServerContext ctx)
{
ctx.Response.WithContentType(MimeType).SendText(Text);
}
}
public interface IResponse
{
void Handle(ServerContext ctx);
}
public interface IHttpRoute
{
string RouteName {get;set;}
string Method {get;}
}
[AttributeUsage(AttributeTargets.Method)]
public sealed class HttpGetAttribute :Attribute, IHttpRoute
{
public string Method {get{return "GET";}}
public string RouteName {get;set;}
public HttpGetAttribute(string name)
{
RouteName=name;
}
public HttpGetAttribute()
{
RouteName = "";
}
}
[AttributeUsage(AttributeTargets.Method)]
public sealed class HttpPostAttribute :Attribute, IHttpRoute
{
public string Method {get{return "POST";}}
public string RouteName {get;set;}
public HttpPostAttribute(string name)
{
RouteName=name;
}
public HttpPostAttribute()
{
RouteName = "";
}
}
public sealed class HttpMethodAttribute : Attribute, IHttpRoute
{
string _meth;
public string Method {get{return _meth;}}
public string RouteName {get;set;}
public HttpMethodAttribute(string method)
{
_meth=method;
RouteName="";
}
public HttpMethodAttribute(string method,string route)
{
_meth = method;
RouteName = route;
}
}
}

View File

@ -0,0 +1,138 @@
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading;
using System.Text;
using Newtonsoft.Json;
using System.Reflection;
using System.Linq;
using HeyRed.Mime;
namespace Tesses.Http
{/// <summary>
/// Check username and password are correct or if request can be anonymous
/// </summary>
/// <param name="username">Username, can and will be "" on first request for resource</param>
/// <param name="password">Password, can and will be "" on first request for resource</param>
/// <returns>true for authorized, false for unauthorized</returns>
public delegate bool Authenticate(string username, string password);
/// <summary>
/// Check username and password are correct or if request can be anonymous
/// </summary>
/// <param name="context">Server Context</param>
/// <param name="username">Username, can and will be "" on first request for resource</param>
/// <param name="password">Password, can and will be "" on first request for resource</param>
/// <returns>true for authorized, false for unauthorized</returns>
public delegate bool AuthenticateWithContext(ServerContext context,string username,string password);
/// <summary>
/// Protect server with password
/// </summary>
public class BasicAuthRequestHandler : IRequestHandler
{
/// <summary>
/// Construct server for user authorization
/// </summary>
/// <param name="auth">callback for authorization</param>
/// <param name="inner">server to protect</param>
/// <param name="realm">realm parameter in WWW-Auhenticate Header</param>
public BasicAuthRequestHandler(Authenticate auth,IRequestHandler inner,string realm="SampleRealm")
{
Authenticate = auth;
InnerServer = inner;
Realm = realm;
}
/// <summary>
/// Construct server for user authorization (With ServerContext in callback)
/// </summary>
/// <param name="auth">callback for authorization</param>
/// <param name="inner">server to protect</param>
/// <param name="realm">realm parameter in WWW-Auhenticate Header</param>
public BasicAuthRequestHandler(AuthenticateWithContext auth,IRequestHandler inner,string realm = "SampleRealm")
{
AuthenticateWithContext=auth;
InnerServer=inner;
Realm = realm;
}
public async Task Handle(ServerContext ctx)
{
if(await Authorize(ctx))
{
await RequestHandler.Guaranteed(ctx,InnerServer).Handle(ctx);
}
}
/// <summary>
/// Server to protect
/// </summary>
public IRequestHandler InnerServer { get; set; }
/// <summary>
/// Authentication callback without ServerContext
/// </summary>
public Authenticate Authenticate { get; set; }
/// <summary>
/// Authentication callback with ServerContext
/// </summary>
public AuthenticateWithContext AuthenticateWithContext {get;set;}
/// <summary>
/// Realm parameter in WWW-Authenticate header
/// </summary>
public string Realm { get; set; }
private bool ValidAuth(ServerContext ctx)
{
string auth;
if(Authenticate == null && AuthenticateWithContext == null) return true;
if (ctx.Request.Headers.TryGetFirst("Authorization", out auth))
{
string[] authorization = auth.Split(' ');
//authorization_basic
if (authorization[0] == "Basic")
{
string[] userPass = Encoding.UTF8.GetString(Convert.FromBase64String(authorization[1])).Split(new char[] { ':' },2);
//return userPass.Equals($"{config.UserName}:{config.Password}", StringComparison.Ordinal);
if(Authenticate != null)
return Authenticate(userPass[0], userPass[1]);
if(AuthenticateWithContext != null)
return AuthenticateWithContext(ctx,userPass[0],userPass[2]);
}
}else{
if(Authenticate != null)
return Authenticate("", "");
if(AuthenticateWithContext != null)
return AuthenticateWithContext(ctx,"","");
}
return false;
}
private async Task<bool> Authorize(ServerContext ctx)
{
if (Authenticate == null && AuthenticateWithContext == null)
return true;
if (ValidAuth(ctx))
return true;
ctx.Response.Headers.Add("WWW-Authenticate", $"Basic realm=\"{Realm}\"");
ctx.Response.StatusLine = 401;
await UnauthorizedPage(ctx);
return false;
}
protected virtual async Task UnauthorizedPage(ServerContext ctx)
{
ctx.Response.SendStatusCodeHtml();
await Task.CompletedTask;
}
}
}

View File

@ -0,0 +1,23 @@
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.Threading;
using System.Text;
using Newtonsoft.Json;
using System.Reflection;
using System.Linq;
using HeyRed.Mime;
namespace Tesses.Http
{
public class ChangableRequestHandler : IRequestHandler
{
public IRequestHandler Handler {get;set;}
public async Task Handle(ServerContext ctx)
{
await RequestHandler.Guaranteed(ctx,Handler).Handle(ctx);
}
}
}

View File

@ -0,0 +1,13 @@
using System.Threading.Tasks;
namespace Tesses.Http
{
public class ErrorRequestHandler : IRequestHandler
{
public async Task Handle(ServerContext ctx)
{
ctx.Response.SendStatusCodeHtml();
await Task.CompletedTask;
}
}
}

Some files were not shown because too many files have changed in this diff Show More