Skip to content

San7o/chttps

Repository files navigation

chttps

/*======================================================*
 *                    CHTTPS v0.0.1                     *
 *======================================================*/
Usage:
  chttpsd [args...]

Accepted args:
    --port,-p
            select port to listen to (default is 1234)
    --ip,-i
            select ip to listen to (default is 0.0.0.0)
    --certs-dir,-cd
            directory of cert.pem and key.pem certificates
    --log-level,-ll
            select the output log level. Options are:
            - DEBUG
            - INFO (DEFAULT)
            - WARNING
            - ERROR
            - OUTPUT
            - DISABLED
    --no-banner,-np
            do not show banner at startup (default true)
    --help,-h
            show this message

Chttps is an implementation of a TCP/IP + TLS server accepting the http/1.0 protocol as defined in RFC 1945. A secondary goal for the project is to implement a server-side rendering engine.

The server uses UNIX sockets to handle multiple TCP connections, using the OpenSSH library for TLS: the server creates a new UNIX thread for each connection. While this is a simple and straight forward approach, It does not scale to a high number of sessions as an UNIX thread Is an expensive resource. Nginx uses a master-slave architecture via a signal oriented design, however the implementation is more involved. The first version of this server will leverage on threads alone to handle sessions.

Chttps is designed with modularity in mind. A request from a client goes through multiple configurable passes to allow greater modularity and customizability.

SSR

The server-side-rendering module will parse .ssr files, where code is delimited by the characters “%{” to open and “}%” to close, as shown in the following example:

<body>
    %{ for(int i = 0; i < 10; ++i) { }%
        <p> Iteration No. %{ INT(i) }% </p>
    %{ } }%
</body>

Build

The library depends on the following:

  • OpenSSL for SSL support
  • Autotools for building

This project uses autotools for building. Run the following to build both the library and the daemon:

./autogen.sh &&
./configure &&
make

To run self tests, run the following:

make check

You can play around with the test_server, via

make test_server

or look at the testcases to have a feel on how the API work.

The project is still in early developement, the following is a priority list with upcoming features:

  • request / response body: correctly read the body of a request
  • config file: parse the configs from a file
  • server-side rendering: implement the SSR engine

About

Chttps is an implementation of a TCP/IP + TLS server accepting the http/1.0 protocol as defined in RFC 1945.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages