ElMariachi.Http.Server 1.1.0

A lightweight HTTP server on top of TCP listener.
No admin rights required.

Install-Package ElMariachi.Http.Server -Version 1.1.0
dotnet add package ElMariachi.Http.Server --version 1.1.0
<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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ElMariachi.Http.Server, 1.1.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. 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
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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 😉

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 😉

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.1.0 261 12/9/2020
1.0.0 177 12/6/2020