C Hypertext Library - A library for writing web applications in C

Overview

CHL

C Hypertext Library - A library for writing web applications in C

#include <chl/chl.h>

int main() {
 chl_set_default_headers();
 chl_print_headers();
 
 printf("Hello world");
 
 return 0;
}

(Simple Hello World in CHL)

See examples
Tutorial, Setup, API, Contribute
FastCGI

Website

What is CHL?

CHL, short for C Hypertext Library, is a library used to write web applications of all sorts in the C programming language. CHL provides you with a lot of useful features:

  • FastCGI implementation
  • MySQL library
  • Parsing and fetching HTTP data, such as POST and GET.
  • Creating and deleting HTTP headers.
  • A dedicated API for creating and deleting cookies.
  • The ability to execute CHL functions within HTML files

and a lot more...

Why CHL?

What makes CHL uniqe is the support for executing functions inside HTML files, much like PHP using the syntax, though CHL uses the <{ }> syntax.

Example

<body>
 <{ import("header.vw"); }>
</body>

How does it work?

Web applications written in C must somehow be executed by the Web server since C is a compiled language. To make this possible CHL is based on CGI (Common Gateway Interface), which in short means that the server executes your program and passes it data through environment variables. CHL does all the parsing and handling of CGI in the background, and provides you with some easy to use functions instead. CHL also provides an interface for FastCGI.

API

The Application Programming Interface is written with Github Wikis: API.

Setup

For a proper guide on how to install and configure CHL on your system, read the following document: https://github.com/it4e/CHL/wiki/Setup.

As of now, CHL is only officially available on Linux, but I am planning to port it to other operating systems as well if the interest is big enough. Otherwise you could of course make a port of it yourself, see contribute.

Tutorial

To read an in depth tutorial on the structure of CHL web applications, and a walk through on how to get started and how to use the CHL API properly see https://github.com/it4e/CHL/wiki/Tutorial.

The tutorial is divided into various sections. The first section is a quick introduction to let you know what CHL is all about and what it can do for you. We will then dig deeper and deeper into the CHL API.

Before you start reading this tutorial, make sure you have CHL installed and that everything is properly set up. Setting up CHL.

Contribute

There are several ways you can contribute to CHL. Take a look at the issues page for an overview of what you can contribute to. If you have any ideas of your own for new features to implement, feel free to contribute with a pull request.

For a detailed guide on contribution to CHL, see contribute.

Examples

See examples, for a page with detailed examples of CHL in use.

Issues
  • CHL MySQL API

    CHL MySQL API

    CHL is in need of a MySQL API written especially for CHL. This API should make use of the standard MySQL API and work as nothing but a wrapper to make functions easier and more efficient to use.

    Why not use the official MySQL API already provided by MySQL?

    The standard MySQL API is very tedious and abstract to use, therefore we aim to implement a version of the API which is much more user friendly. If you have ever seen the PHP implementation of MySQL then you know what I am talking about.

    If you feel like this is a task you can tackle, take a look at the contribute page to get started.

    new feature 
    opened by it4e 2
  • Integer and float forms of post, get and args

    Integer and float forms of post, get and args

    Need to define functions for fetching integer and float forms of post, get and args. Should do automatic conversion of text to integer and float values.

    • chl_post -> chl_posti(), chl_postf()
    • chl_get -> chl_geti(), chl_getf()
    • chl_next_arg -> chl_next_argi(), chl_next_argf()
    enhancement new feature 
    opened by it4e 1
  • test server needed

    test server needed

    I would use something like mongoose to add test server for development and testing purposes. It'll reduce installation process to something like:

    1. git clone
    2. cd CHL
    3. make
    4. make run_server (stop_sever, restart_server) and will not force to install new libs in system path and install and configure Apache, git pull enough for updates, and mongoose is cross platform, header only library (under GPL as well).
    enhancement 
    opened by ghost 1
  • Indentation not aligned properly

    Indentation not aligned properly

    When importing a view component from another view, the text is not aligned properly.

    For instance, let's assume we have the view component viewc.vc.

    <header>
        Hello
    </header>
    

    and we import it from view.vw

    <html>
        <head>
        </head>
        <body>
            <{ import("viewc.vc"); }>
        </body>
    </html>
    

    the end result might look something like this:

    <html>
        <head>
        </head>
        <body>
            <header>
    Hello
    </header>
        </body>
    </html>
    

    instead of

    <html>
        <head>
        </head>
        <body>
            <header>
                 Hello
            </header>
        </body>
    </html>
    
    bug enhancement 
    opened by it4e 0
  • CHL Session Implementation

    CHL Session Implementation

    As of now CHL only supports standard HTTP cookies, which of course can be used for most purposes. However, when it comes to security and creating user-login pages, the more safe way would be to implement sessions.

    Get started

    If you can think of a smart and efficient way of implementing sessions in CHL (see PHP implementation), feel free to take your ideas to the test and create an implementation of it yourself: see contribute.

    help wanted new feature 
    opened by it4e 0
  • Improve const-correctness

    Improve const-correctness

    I suggest to add the key word "const" to the type specifiers for parameters like the following.

    Would you like to apply the advices from an article to more places in your source files?

    opened by elfring 1
  • Addition of a build system generator

    Addition of a build system generator

    opened by elfring 0
Releases(v2.0-beta)
C library to create simple HTTP servers and Web Applications.

Onion http server library Travis status Coverity status Onion is a C library to create simple HTTP servers and Web Applications. master the developmen

David Moreno Montero 1.8k Jun 21, 2022
Simple, secure & standards compliant web server for the most demanding of applications

Simple, secure[1] & standards compliant[2] web server for the most demanding[3] of applications. Read more... ?? Optimized security Being meticulously

uNetworking AB 13.9k Jun 27, 2022
A WiFi-enabled microcontroller capable of communicating with web-based service APIs for fast prototyping applications.

A WiFi-enabled microcontroller capable of communicating with web-based service APIs for fast prototyping applications.

Mark Hofmeister 2 Mar 9, 2022
Header only library for writing build recipes in C.

nobuild Header only library for writing build recipes in C. Main idea The idea is that you should not need anything but a C compiler to build a C proj

Tsoding 100 Jun 28, 2022
Mongoose Embedded Web Server Library - a multi-protocol embedded networking library with TCP/UDP, HTTP, WebSocket, MQTT built-in protocols, async DNS resolver, and non-blocking API.

Mongoose - Embedded Web Server / Embedded Networking Library Mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs

Cesanta Software 8.5k Jun 29, 2022
An asynchronous web framework for C++ built on top of Qt

!!! I can no longer maintain this project. If you're interessed, please contact me and I can move the projetct to you !!! Tufão - an asynchronous web

Vinícius dos Santos Oliveira 542 Jun 14, 2022
Drogon: A C++14/17 based HTTP web application framework running on Linux/macOS/Unix/Windows

English | 简体中文 | 繁體中文 Overview Drogon is a C++14/17-based HTTP application framework. Drogon can be used to easily build various types of web applicat

An Tao 7.5k Jun 29, 2022
When you need a web server in a hurry.

darkhttpd https://unix4lyfe.org/darkhttpd/ When you need a web server in a hurry. Features: Simple to set up: Single binary, no other files, no instal

Emil Mikulic 800 Jun 24, 2022
web server that will print hello world on the screen only for linux users

a simple http server side lib only for linux users Note: This lib is currently under development you can check the source code and even use it but dn'

notaweeb 11 Mar 14, 2021
Ultra-lightweight web browser based on Qt Ultralight webview, powered by Ultralight HTML renderer

Qt Ultralight Browser This is an ultra-lightweight web browser powered by the Ultralight web engine embedded in Qt 5 app as a custom webview widget -

niu tech 30 Jun 14, 2022
A webserver hosting a bank system for Minecraft, able to be used from web browser or from CC/OC if you're playing modded.

CCash A webserver hosting a bank system for Minecraft, able to be used from web browser or from CC/OC if you're playing modded. Description the curren

William Katz 24 Dec 10, 2021
A simple web browser written for learning purposes in C++

AWB: Abbix's web browser pls send help AWB is a simple web browser written for learning purposes in C++, it features a custom engine named orca render

null 9 Jul 8, 2021
Abaco: lame web browser for Plan 9

Abaco: lame web browser for Plan 9, eternally a work in progress.

Fazlul Shahriar 7 Mar 7, 2022
DOS Web browser for 8088 class machines

MicroWeb MicroWeb is a web browser for DOS! It is a 16-bit real mode application, designed to run on minimal hardware. Minimum requirements To run you

null 223 Jun 14, 2022
ESP8266 WiFi Connection manager with fallback web configuration portal

ESP8266 WiFi Connection manager with fallback web configuration portal

null 5.3k Jun 24, 2022
Angband on the web

Shelob: Angband on the Web This is Angband 3.4.1 running on the web, in your browser. Play it now! Features Save files via IndexedDB Fonts Graphics Th

null 18 Jun 4, 2022
A Fast and Easy to use microframework for the web.

A Fast and Easy to use microframework for the web. Description Crow is a C++ microframework for running web services. It uses routing similar to Pytho

Crow 1k Jun 26, 2022
cServe : mean and lean web server written in c

cServe =========== cServe is a web server written in c for POXIS compliant operating systems cServe is planned to be [ ] Supporting HTTP/1.x and HTTP/

Ayush Kumar 1 Dec 21, 2021
JavaScript runtime for Web of Things

WoT.js 基于 libuv 和 QuickJS 的嵌入式物联网开发框架 Overview wot.js (basque): small, tiny. wot.js is a small and powerful JavaScript runtime. It's built on the shou

成真 1 Dec 13, 2021