Project Description
A fast and lightweight HTTP stack for building HTTP server and client with total control and no dependency on .Net Http or Web client.

This HTTP stack is written from scratch with zero architecture dependencies to spark enthusiasts with the lost art of writing custom server as well as to foster and facilitate the development of server libraries.

Included in the source-code is a demo of how to write your own HTTP server that returns the current time. (Yes, this is exciting, imagine you can build SkyNet from these tiny blocks)


  • Automatic management of memory: one of the bigger issues with writing server software is memory leak and quick memory depletion. By using this stack, memory consumption is automatically repooled and managed behind the scene.
  • Zero architecture dependency: common HTTP server examples found on the internet are involved with .NET Http client or web client. These are not optimized for server. Their architecture induces developer to write bad codes easily. By writing from scratch, this HTTP stack does not depend on such baggages. But the sweetest thing is, we didn't even design this stack to be dependent on sockets technology. Yes, you heard it right. The stack can and does work with sockets, but it can work without socket as well. This opens up exciting opportunities such as simulated server, tunneled HTTP, etc.
  • Fast and lightweight
  • Asynchronous everywhere without cumbersome API: take a look at the example codes. You will see that writing a HTTP request handler is a piece of cake. The code looks like it is synchronous but in fact it is asynchronous. If need to, you can easily change it to synchronous calls. (yes, that is also the meaning of zero architecture dependency)
  • Low memory consumption: thanks to automatic memory management, the server by itself runs with minimal memory consumption. If you uses the tools provided in this HTTP stack and don't go crazy with custom buffering and memory allocations, your codes shall consume little memory as well.
  • Friendly API: HTTP Request, HTTP Response and HTTP Context are designed to be intuitive. No more remembering which goes where.
  • Friendly writer / reader: One of the scarier things with doing networking or low level I/O is the binary formatting and encoding. THN HTTP Stack takes care of this for you. Writing and reading stuff is fun again. (If you have to ask, the writing/reading stuff is independent of networking and HTTP as well. The I/O writing / reading is designed to be usable on files, stream, byte[], etc. )
  • Concurrency: unlike other architecture, a request can be read and a response can be written at the same time. This is great for scenarios such as media streaming. The best part, your code doesn't have to know about concurrency.
  • Extensible architecture: the HTTP Stack by itself is developer-friendly for writing extensions. In fact, see the recommended projects section below for proof.


THN HTTP Stack is a side product resulted from many redesigns of THN Solutions LLC.'s Communication Foundation by software architect Nguyễn, M. Hải. At first, we wanted a communication abstraction layer that allows cross-domain, cross-layer, cross-tier communication with zero dependency on actual networking technologies or topologies. Furthermore, we didn't even want to be tied down by one protocol or even one messaging mechanism. After so many revisions, we achieved what we wanted and decided to test if our communication layer can be easily extended for HTTP protocol, which looks deceptively simple enough. We did do so and here is the HTTP Stack you can use.

In 2014, THN decided to opensource version 6.5 of the library for educational purposes and for contributing back to the community.

If you wish to explore more about how our communication layer can make you code faster, you might want to check out the next design called Neuron Network Communication Layer from this productive programming framework.

Recommended projects

Last edited May 15, 2014 at 5:00 AM by minh_hai, version 7