ElMariachi.Http.Server 1.1.0

dotnet add package ElMariachi.Http.Server --version 1.1.0                
NuGet\Install-Package ElMariachi.Http.Server -Version 1.1.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ElMariachi.Http.Server" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ElMariachi.Http.Server --version 1.1.0                
#r "nuget: ElMariachi.Http.Server, 1.1.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ElMariachi.Http.Server as a Cake Addin
#addin nuget:?package=ElMariachi.Http.Server&version=1.1.0

// Install ElMariachi.Http.Server as a Cake Tool
#tool nuget:?package=ElMariachi.Http.Server&version=1.1.0                

ElMariachi.Http.Server

Description

This project is a .NET Core HTTP server library written in C#.

Why ?

I decided to create my own HTTP server implementation for at least 3 reasons:

  1. The native «System.Net.HttpListener» can't be run immediately without administrative privileges
  2. The native «System.Net.HttpListener» is not really user friendly and quite old
  3. I wanted to improve my skills on HTTP protocol

Key features

  • No administrative privileges required
  • Simple
  • Fast
  • Lightweight
  • Extensible
  • Abstraction for all classes
  • Non destructive header parsing
  • Transfer Encoding Support (gzip, chunked, deflate)
  • Unit tested

Quick start

async void Main(string[] args)
{

    var serviceProvider = new ServiceCollection()
        .AddHttpServer() // Injects the HTTP server implementation in the ServiceCollection
        .BuildServiceProvider();

    // Create a new server
    var httpServer = serviceProvider.GetRequiredService<IHttpServer>();
    httpServer.IPAddress = IPAddress.Any;
    httpServer.Port = 80;
    await httpServer.Start(OnRequest);
}

void OnRequest(IHttpRequest request)
{
    request.SendResponse(new HttpResponse(HttpStatus.Ok)
    {
        Content = new StringResponseContent("Hello World!", "text/plain")
    });
}

Additional notes

There are probably plenty of things to do to improve this library, some feel free to contribute.

I spent a lot of my free time to develop this library, so if you like it, feel free to buy me <s>a beer</s> some vegetables 😉

alternate text is missing from this package README image

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 821 12/9/2020
1.0.0 432 12/6/2020