All Projects → bonesoul → Uhttpsharp

bonesoul / Uhttpsharp

Licence: mit
A very lightweight & simple embedded http server for c#

Programming Languages

csharp
926 projects

Projects that are alternatives of or similar to Uhttpsharp

Docker
Directus Docker — The Official Docker Container for the Directus Suite
Stars: ✭ 93 (-38.41%)
Mutual labels:  webserver
Lophttpd
lots of performance (or lots of porn, if you prefer) httpd: Easy, chrooted, fast and simple to use HTTP server for static content. Runs on Linux, BSD, Android and OSX/Darwin. It's free but if you like it, consider donating to the EFF: https://supporters.eff.org/donate
Stars: ✭ 123 (-18.54%)
Mutual labels:  webserver
Pure Http
✨ The simple web framework for Node.js with zero dependencies.
Stars: ✭ 139 (-7.95%)
Mutual labels:  webserver
Facil.io
Your high performance web application C framework
Stars: ✭ 1,393 (+822.52%)
Mutual labels:  webserver
Php Server
Start a PHP server
Stars: ✭ 119 (-21.19%)
Mutual labels:  webserver
Agoo C
Agoo webserver in C.
Stars: ✭ 125 (-17.22%)
Mutual labels:  webserver
Ytdl Webserver
📻 Webserver for downloading youtube videos. Ready for docker.
Stars: ✭ 1,309 (+766.89%)
Mutual labels:  webserver
Piadvanced
This started as a custom install for my pihole!
Stars: ✭ 144 (-4.64%)
Mutual labels:  webserver
Microdot
The impossibly small web framework for MicroPython
Stars: ✭ 121 (-19.87%)
Mutual labels:  webserver
Webserver
A C++ Lightweight Web Server based on Linux epoll
Stars: ✭ 135 (-10.6%)
Mutual labels:  webserver
Ipfscloud Web
IpfsCloud: A Decentralized, Anonymous Cloud Storage web client on IPFS.
Stars: ✭ 105 (-30.46%)
Mutual labels:  webserver
Ansible Role Haproxy
Ansible Role - HAProxy
Stars: ✭ 112 (-25.83%)
Mutual labels:  webserver
Goserv
A lightweight toolkit for web applications in Go
Stars: ✭ 132 (-12.58%)
Mutual labels:  webserver
Twig
Twig - less is more's web server for golang
Stars: ✭ 98 (-35.1%)
Mutual labels:  webserver
Owasp Mth3l3m3nt Framework
OWASP Mth3l3m3nt Framework is a penetration testing aiding tool and exploitation framework. It fosters a principle of attack the web using the web as well as pentest on the go through its responsive interface.
Stars: ✭ 139 (-7.95%)
Mutual labels:  webserver
Evennia
Python MUD/MUX/MUSH/MU* development system
Stars: ✭ 1,309 (+766.89%)
Mutual labels:  webserver
Servez
A simple web server for local web development.
Stars: ✭ 124 (-17.88%)
Mutual labels:  webserver
Nginx
A fairly flexible and feature full Ansible role for the NGINX web server.
Stars: ✭ 151 (+0%)
Mutual labels:  webserver
Gofast
gofast is a FastCGI "client" library written purely in go
Stars: ✭ 140 (-7.28%)
Mutual labels:  webserver
Octane
A web server modeled after express in Rust.
Stars: ✭ 136 (-9.93%)
Mutual labels:  webserver

µHttpSharp

A very lightweight & simple embedded http server for c#

Master Provider
Build Status Windows CI Provided By JetBrains and CodeBetter
Build status Windows CI Provided By AppVeyor
Build Status Mono CI Provided by travis-ci

Usage

A NuGet Package is available, Install via NuGet Package Manager :

install-package uHttpSharp

A sample for usage :

using (var httpServer = new HttpServer(new HttpRequestProvider()))
{
	// Normal port 80 :
	httpServer.Use(new TcpListenerAdapter(new TcpListener(IPAddress.Loopback, 80)));
    
	// Ssl Support :
	var serverCertificate = X509Certificate.CreateFromCertFile(@"TempCert.cer");
	httpServer.Use(new ListenerSslDecorator(new TcpListenerAdapter(new TcpListener(IPAddress.Loopback, 443)), serverCertificate));

	// Request handling : 
	httpServer.Use((context, next) => {
		Console.WriteLine("Got Request!");
		return next();
	});

	// Handler classes : 
	httpServer.Use(new TimingHandler());
	httpServer.Use(new HttpRouter().With(string.Empty, new IndexHandler())
									.With("about", new AboutHandler()));
	httpServer.Use(new FileHandler());
	httpServer.Use(new ErrorHandler());
	
	httpServer.Start();
	
	Console.ReadLine();
}

Features

µHttpSharp is a simple http server inspired by koa, and has the following features :

  • RESTful controllers
  • Ssl Support
  • Easy Chain-Of-Responsibility architecture

Performance

µHttpSharp manages to handle 13000 requests a sec (With Keep-Alive support) on core i5 machine, cpu goes to 27%, memory consumption and number of threads is stable.

ab -n 10000 -c 50 -k -s 2 http://localhost:8000/

This is ApacheBench, Version 2.3 <$Revision: 1528965 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient)
Completed 1000 requests
Completed 2000 requests
Completed 3000 requests
Completed 4000 requests
Completed 5000 requests
Completed 6000 requests
Completed 7000 requests
Completed 8000 requests
Completed 9000 requests


Server Software:
Server Hostname:        localhost
Server Port:            8000

Document Path:          /
Document Length:        21 bytes

Concurrency Level:      50
Time taken for tests:   0.707 seconds
Complete requests:      9357
Failed requests:        0
Keep-Alive requests:    9363
Total transferred:      1507527 bytes
HTML transferred:       196644 bytes
Requests per second:    13245.36 [#/sec] (mean)
Time per request:       3.775 [ms] (mean)
Time per request:       0.075 [ms] (mean, across all concurrent requests)
Transfer rate:          2083.53 [Kbytes/sec] received

Connection Times (ms)
			  min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       1
Processing:     1    4   0.7      4      13
Waiting:        1    4   0.7      4      13
Total:          1    4   0.7      4      13

Percentage of the requests served within a certain time (ms)
  50%      4
  66%      4
  75%      4
  80%      4
  90%      4
  95%      4
  98%      5
  99%      9
 100%      4 (longest request)

How To Contribute?

  • Use it
  • Open Issues
  • Fork and Push requests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].