Giter Club home page Giter Club logo

breeze's Introduction

Breeze

This is a simple HTTP server inspired by Tornado Web Server, for practising my Linux programming skills. No third-party libraries are used, only glibc.

This project is still a work-on-progress. But several features are already implemented:

  • ioloop/iostream: Async IO module inspired by Tornado
  • buffer: Simple ring-buffer module
  • http: Core HTTP related features like protocol parser, handler architecture, etc.
  • virtual host: Simple virtual host support.
  • location config: Simple location configuration mechanism based on URI prefix and regex.
  • module architecture: An simple module architecture to easily add new modules
  • mod_static: A module that could serve static files and support basic MIME mapping, cache-control, welcome files, directory listing, ranged request (partially).

A lot work needs to be done, but it won't stop you from trying the features already implemented. Please refer to the following sections for instructions on how to run it.

Build

Run make in the src dir:

cd src
make

The target executable files will appear in the same directory. There are several unit test cases and a main program breeze.

Usage

Run breeze based on config file

Run the following command in src directory:

./breeze [-c configfile] [-t]

If -c is not specified, then /etc/breeze.conf is used. If -t is specified, the program will print the details of the config and exits.

Please refer to the following sections for details about the config file.

Run breeze on specified root directory

Run the following command in src directory:

./breeze [-r root_dir] [-p port]

This mode is activated with the -r option. When activated, breeze will not read config file. Instead, breeze will setup a simple server serving content in the root_dir. In this mode, the directory listing feature is enabled. Therefore this is a perfect replacement of Python SimpleHTTPServer. Use -p to specify the port, by default 8000 is used.

Hello world HTTP server

Run the following command in src directory:

./test_http_server

A server on port 8000 will be started. It will return a short HTML for any request on port 8000.

Config File

Please refer to the sample config file for an example. Please note that some config options are not implemented yet.

TODO

  • Automatically close keep-alive connection on server side
  • HTTP chunked encoding, gzip compression
  • FastCGI support
  • File upload module
  • Master-worker multi-process architecture

Known Bugs

  • The server stops responding to any request on high load (>2000 concurrent connections)

Lisence

GPLv3

breeze's People

Contributors

jerrypnz avatar

Stargazers

wajika avatar

Watchers

James Cloos avatar wajika 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.