Giter Site home page Giter Site logo

httpd's Introduction

Basic Evented Web Server

This is a project I've wanted to do for quite a long time now. It's a web server built around the single-thread event loop design. The C10k problem was solved a long time ago (see: nginx, lighttpd, Cherokee, etc.), so I am not blazing new trail here but that isn't the point anyway. I am a server geek and this stuff is interesting to me, so implementing it myself is a fun project that I will learn a lot from.

Implementation

I like C/C++ and plan on using mostly C but with basic C++ features where they makes sense. I don't want to go crazy with objects or templates or any of the esoteric features of C++, just enough to be easier than straight C.

Since I work on a Mac mainly, the initial implementation of the event loop is based on Kqueue. I hope to add a suitable Linux event interface as well, probably Epoll, but that will come later. I decided not to use a premade event loop library like libev because that is one of the most interesting parts of this project for me.

For HTTP request parsing, I am using Ryan Dahl's http-parser library since it is small, easy to use, and parsing HTTP is boring.

Roadmap

Features yet to be implemented, listed in order of importance (to me):

  • static file serving

    This includes all the basic web server machinery - connection handling, header processing, response generation, etc.

  • directory indexes

    This might seem like an obvious feature, but I think it will prove to be more complex than it seems, traversing directories and generating an HTML page representing their structure is a bit of work; I am also thinking that this may fit into a module once that API is in place, we'll see...

  • virtual hosts

    Being able to host multiple sites on one server is an essential and basic feature these days. Should be a pretty easy deal too, basically just need to correlate each Host with its own docroot.

  • configuration file

    At this point, there are enough features to warrant a method for configuring the server without requiring recompilation. I could have included this feature earlier, but I think it will be easier to implement once a base level of functionality is in place. Not sure what format configuration files will take at this point, might even use something like [Lua][8] if it's easy enough since that would add a great deal of power...

  • Epoll

    I am not interested in supporting every platform out there (Windows, older Linux, other *nix's are all well served by other software) so I think between Kqueue (FreeBSD & OS X) and Epoll (Linux 2.6+) I will be satisfied with multiplatform support. If others would like to contribute support for other systems, it may be easier once I have two implementations in place and I would be happy to accept contributions.

  • module API (for things like mod_fcgi etc.)

    Having never written a plugin API before, this part will definitely be tricky. I'm not sure if I'll want to (or be able to...) support loadable modules or if I'll stick to the model that requires modules to be compiled in a la nginx. This will require lots of research and will most definitely be modeled after other servers' module systems.

This list is very short, and there will likely be things that pop up in between implementing the things on the list so it's just a vague outline for now.

httpd's People

Contributors

ryanbarry avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.