Tntnet is a web application server for web applications written in C++.

Overview
Tntnet
======

Tntnet is a web application server for web applications written in C++.

You can write a Web-page with HTML and with special tags you embed
C++-code into the page for active contents. These pages, called components are
compiled into C++-classes with the ecpp-compilier "ecppc", then compiled into
objectcode and linked into a process or shared library.

This shared library is loaded by the webserver "tntnet" on request and
executed.

The ecpp-compiler can create also C++-classes from static files of any
type, e.g. you can compile a jpeg-image into the library. So the
whole webapplication is a single library.

The application runs native, so they are very fast and compact.

Features supported include: cookies, HTTP-upload, automatic request-parameter
parsing and conversion, automatic sessionmanagement, scoped variables
(application, request and session), internationalisation, keep-alive.

Logging is done through cxxtools.

Tntnet is fully multithreaded, so it scales well on multiprocessor machines.
It uses a dynamic pool of workerthreads, which answers requests from
http-clients.

Installation 
============

To install tntnet, you need cxxtools (http://www.tntnet.org/).

You can find generic installation instructions in the file INSTALL.

Quick start
===========

To create a simple application run "tntnet-project hello".
This creates a directory "hello" with a simple project and prints
a short message, how to run the application.

There are some demo-applications you can try in _demos_. To run the demos
without installing tntnet, change to the directory of the demo and run tntnet
from the directory framework/runtime:
    cd hello
    ../../framework/runtime/tntnet

Tntnet listens on port 8000. Start your browser and navigate to:
    http://localhost:8000/

Documentation is provided in man pages and some documents found in the doc
directory.

Ssl
===

Tntnet supports ssl. It must be configured in tntnet.xml or using the api.
For ssl a certificate is needed. To create a self signed certificate run:

    openssl req -x509 -nodes -days 1095 -utf8 -subj "/C=DE/L=Your Town/CN=$(hostname -f)/O=Your Organization/OU=Your unit" -newkey rsa:2048 -keyout tntnet.pem -out tntnet.pem

Client side certificates can be used to restrict access to tntnet.
Comments
  • tntnet.worker requesttime exceeded

    tntnet.worker requesttime exceeded

    Hello,

    We regularly encounter a problem with unsuccessful Ajax requests in an application using tntnet. For example on our component Login.ecpp. This component does not do any complex actions.

    tntnet.worker returns this message to us:

    FATAL tntnet.worker - requesttime 600s seconds in thread 139743169820416 exceeded - exit process

    tntnet is completely blocked for a while. If we wait, everything works again.

    We used the latest tntnet.

    How do we debug this problem?

    opened by jm130794 11
  • added compression handling for already compressed files in mbcomponent

    added compression handling for already compressed files in mbcomponent

    This commit changes the behavior of files in the mbcomponent: If enableCompression is set and client supports compression, mbcomponent is looking for the requested filename with the extension .gz at first, if this file is found, this already compressed file would be sent to the client. if there is no file with the extension .gz than the current file would be compressed on the fly (as it was before) and sent to the client.

    Example: client wants favicon.svg, with compression enabled. server looks for favicon.svg.gz ==> if found, server sends this compressed file. (this is the new behavior) if favicon.svg.gz not found, server will compress favicon.svg and send it compressed to the client. (this is the old behavior, now the fallback)

    opened by mwuehrer 6
  • Generated code for application-wide variables has unused typedef

    Generated code for application-wide variables has unused typedef

    This bit of ECPP

    <%application scope="shared">
        GlobalConf a_conf;
    </%application>
    

    results is this generated C++

      typedef GlobalConf a_conf_type;
      TNT_APPLICATION_SHARED_VAR(GlobalConf, a_conf, ());   // <%application> GlobalConf a_conf
    

    where the typedef isn't actually used. I suppose it's meant to be used as the first argument for TNT_APPLICATION_SHARED_VAR?

    opened by jplatte 5
  • Hosting static files

    Hosting static files

    Ok, I've got a (hopefully) dumb question.

    I checked the docs, and it says: http://www.tntnet.org/howto/static-howto.html

    In tntnet.xml, I put the lines:

    <mapping>
      <url>^/(.*)</url>
      <target>[email protected]</target>
      <pathinfo>/var/www/htdocs/$1</pathinfo>
    </mapping>
    
    

    I'm using the basic sample:

    int main(int argc, char* argv[])
    {
    	std::cerr << "Starting up CLabs webserver" << std::endl;
    	try
    	{
    		tnt::Tntnet app;
    		app.listen(8000);
    		app.mapUrl("^/(.*)", "$1");
    		app.mapUrl("^/([^.]+)(\\..+)?", "$1"); 
    
    		app.run();
    	}
    	catch (const std::exception& e)
    	{
    		std::cerr << e.what() << std::endl;
    	}
    	std::cerr << "Shutting down webserver" << std::endl;
    }
    
    

    Yet, I get 404 errors for any of the files I have loaded in /var/www/htdocs/

    I've tried slightly different versions of the files to make sure I didn't have a typo or something.

    Do we have to do something in the code to enable static files? Do I need a different app.mapURL statement? Does that bypass tntnet.xml? Do you need a statement to read tntnet.xml?

    Thank you,

    == John ==

    opened by jgwinner 3
  • config.h isn't installed

    config.h isn't installed

    The (generated) file config.h currently isn't installed as part of the tntnet library, but is included in several headers: ssl.h, listener.h, pollerimpl.h, and on my fork's v3.0 branch tntconfig.has well (that's how I found out). I would suggest moving it from framework/common to framework/common/tnt.

    If you think it shouldn't be installed, IMHO the headers including it shouldn't be installed either, and moved from framework/common/tnt to framework/common (and from _HEADERS to _SOURCES).

    I will fix this on my fork and include it in the v3.0 branch. Here is what I use config.h for in tntconfig.h.

    By the way, I would be happy discussion this and the other changes on there with you on IRC, or maybe gitter.im? It's pretty similar to IRC (in fact it allows connecting to it via IRC) but has a log / history so users don't have to be online simultaneously or use a bouncer.

    opened by jplatte 3
  • Doxygen Kommentare

    Doxygen Kommentare

    Danke für deine Mail. Leider reicht die Info noch nicht um damit zu arbeiten. Soweit wie ich es verstanden habe, habe ich das im Code dokumentiert. Bitte noch mal ansehen und ergänzen. Am besten mit kurzem Beispiel. Danke !

    Viele Grüße

    Olaf

    update

    I added the systemd config in my fork.

    Greetings

    Olaf

    opened by OlafRadicke 3
  • Standalone tntnet-project templates require libtool

    Standalone tntnet-project templates require libtool

    libtool is only needed when building libraries and including it (through LT_INIT) adds an additional build dependency as well as resulting in a bigger configure script that checks for things that aren't used.

    I'll create a PR for this soon, just don't release tntnet 2.3 yet, please :)

    opened by jplatte 2
  • test/tntnet-test fails on arm platform

    test/tntnet-test fails on arm platform

    i tried again compilation with your changes. test/tntnet-test fails on arm platform see logs of the fedora build server: https://kojipkgs.fedoraproject.org//work/tasks/9563/10369563/build.log

    opened by martinkg 2
  • configure.ac is a bit messy

    configure.ac is a bit messy

    Reading through configure.ac, I found several things done in multiple different ways throughout the file:

    • Option testing with test "$enable_option" = "yes" and test x$enable_option = xyes (e.g. line 135 and line 149)
    • Conditional code paths with AS_IF and the shell's if ... then ... endif (e.g. line 152 and line 196)

    Also, the options -Wall and -pedantic are enabled (only) for the IBM C++ compiler. Why?

    opened by jplatte 1
  • configure.ac: autoconf-2.70 fixes

    configure.ac: autoconf-2.70 fixes

    =autoconf-2.70 is more strict with quoting and thus produces broken configure files without these fixes

    Gentoo-bug: https://bugs.gentoo.org/775479 Signed-off-by: Lars Wendler [email protected]

    opened by Polynomial-C 0
  • set openssl options : Cipher, Protocols and temp ECDH key

    set openssl options : Cipher, Protocols and temp ECDH key

    Problem : openssl behaves with default weak protocol(SSL3) and weak cipher(RC4) Solution : add sslProtocols and sslCipherList tag in tntnet.xml to allow user to configuration it.

    Problem : some recent browser likes Chrome reports that “Your connection to tntnet server is encrypted with obsolete cryptography.” To avoid this kind of message, it is good to allow openssl using ECDHE cipher suite. Solution : create a temp ECDH keys.

    opened by geraldguillaume 0
  • warning message: tntnet.service: Supervising process which is not our child ...

    warning message: tntnet.service: Supervising process which is not our child ...

    Debian Bullseye 11.3 tntnet 2.2.1-4

    Note: this is a completely fresh Debian 11 installation with tntnet, the exact same configuration works fine on Deb 10.

    When running command: systemctl status tntnet

    I see this warning (hostname is dev0).

    ● tntnet.service - Tntnet web server Loaded: loaded (/lib/systemd/system/tntnet.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2022-04-10 18:35:37 PDT; 19h ago Process: 2711879 ExecStart=/usr/bin/tntnet (code=exited, status=0/SUCCESS) Main PID: 2711881 (tntnet) Tasks: 9 (limit: 154413) Memory: 1.3M CPU: 211ms CGroup: /system.slice/tntnet.service ├─2711880 /usr/bin/tntnet └─2711881 /usr/bin/tntnet

    Apr 10 18:35:37 dev0 systemd[1]: Starting Tntnet web server... Apr 10 18:35:37 dev0 tntnet[2711879]: tntnet 2.2.1 Apr 10 18:35:37 dev0 systemd[1]: tntnet.service: Supervising process 2711881 which is not our child. We'll most likely not notice when it exits.

    Something is wrong with the way systemd is being used. I posted another issue about the default startup file /etc/default/tntnet is not being read on startup, the issue with systemd may be a related.

    opened by RobT2012 0
  • tntnet no longer reads startup args from /etc/default/tntnet

    tntnet no longer reads startup args from /etc/default/tntnet

    Debian Linux Bullseye 11.3 Tntnet version 2.2.1-4

    This is a completely new Debian Bulleye installation with freshly installed tntnet, the same setup works perfectly on Debian Buster (edit correction: my last known working tntnet version was on Debian 9 "Stretch").

    I use the default startup file to specify an alternative configuration .xml file, but noticed it behaved as if using the default configs from /etc/tntnet.xml.

    Contents of /etc/default/tntnet :

    DAEMON_OPTS="--logall -c /usr/local/etc/tntnet.xml"

    Nothing seems to be read on startup because there are no errors even when jibberish is typed into the startup config file.

    opened by RobT2012 1
  • demo hello missing cxxtools lib

    demo hello missing cxxtools lib

    inside makefile of hello the cxxtools lib is not define and so the compilation has an error of link in the history of demo/hello/Makefile.am it seems that it was perhaps correct in the past

    opened by bdebel 0
  • error 1 in function setgroups

    error 1 in function setgroups

    I am starting tntnet with a systemd service unit, see attached configuration file: [email protected] I am starting multiple instances, for example systemctl start [email protected] and systemctl start [email protected].

    This systemd service sets the user and group to www-data. If user and group are also configured in the configuration file tntnet.xml (<user>www-data</user><group>www-data</group>), tntnet throws an exception: error 1 in function setgroups: Operation not permitted

    Maybe tntnet should check user and group before calling the setgroups function?

    It would be nice, if tntnet provides a special daemon mode for systemd services. systemd could be used for controlling the tntnet process.

    My system is a Debian 9.6 (Stretch) and tntnet is compiled from master branch. The April 2018 version did not show this behavior.

    opened by ska67 2
  • unnamed QueryParams

    unnamed QueryParams

    With tntnet version 2.1 from the Debian repositories you can create tnt::QueryParams objects with unnamed parameters. tnt::QueryParams tnt_qp; tnt_qp.add("value");

    With the latest version from GitHub this only works with the class cxxtools::QueryParams from the cxxtools library. For now I am using a workaround: cxxtools::QueryParams cxx_qp; cxx_qp.add("value"); tnt_qp.add(cxx_qp)

    opened by ska67 0
Owner
Tommi Mäkitalo
Tommi Mäkitalo
🌱Light and powerful C++ web framework for highly scalable and resource-efficient web application. It's zero-dependency and easy-portable.

Oat++ News Hey, meet the new oatpp version 1.2.5! See the changelog for details. Check out the new oatpp ORM - read more here. Oat++ is a modern Web F

Oat++ 5.9k Nov 25, 2022
C++ application development framework, to help developers create and deploy applications quickly and simply

ULib - C++ library Travis CI: Coverity Scan: ULib is a highly optimized class framework for writing C++ applications. I wrote this framework as my too

stefano casazza 949 Nov 22, 2022
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.9k Nov 19, 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 8.3k Nov 20, 2022
Your high performance web application C framework

facil.io is a C micro-framework for web applications. facil.io includes: A fast HTTP/1.1 and Websocket static file + application server. Support for c

Bo 1.7k Nov 22, 2022
TreeFrog Framework : High-speed C++ MVC Framework for Web Application

Small but Powerful and Efficient TreeFrog Framework is a high-speed and full-stack web application framework based on C++ and Qt, which supports HTTP

TreeFrog Framework 1.1k Nov 24, 2022
Embedded C/C++ web server

CivetWeb The official home of CivetWeb is https://github.com/civetweb/civetweb Continuous integration for Linux and macOS (Travis CI): Continuous inte

null 2.2k Nov 24, 2022
A C++11 RESTful web server library

Served Overview Served is a C++ library for building high performance RESTful web servers. Served builds upon Boost.ASIO to provide a simple API for d

Meltwater 695 Oct 12, 2022
cserv is an event-driven and non-blocking web server

cserv is an event-driven and non-blocking web server. It ideally has one worker process per cpu or processor core, and each one is capable of handling thousands of incoming network connections per worker. There is no need to create new threads or processes for each connection.

null 43 Nov 6, 2022
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.

Restbed Restbed is a comprehensive and consistent programming model for building applications that require seamless and secure communication over HTTP

Corvusoft 1.7k Nov 22, 2022
A Zig binding to the webview library. Make Zig applications with a nice HTML5 frontend a reality!

A Zig binding to the webview library. Make Zig applications with a nice HTML5 frontend a reality!

ZigLibs 50 Nov 23, 2022
The application framework for developer module of EdgeGallery platform

crane-framework crane-framework将可复用的计算和软件功能抽象成插件,APP开发者面向使用插件进行MEC APP开发。这样屏蔽了和MEC平台交互的细节,实现MCE APP和MEC平台的松耦合。而且插件框架基础能力可裁剪,按需提供最小的APP系统。 特性介绍 为了方便开发者

EdgeGallery 21 Aug 30, 2021
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 7.1k Nov 22, 2022
Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)

Crow is C++ microframework for web. (inspired by Python Flask) #include "crow.h" int main() { crow::SimpleApp app; CROW_ROUTE(app, "/")([]()

Jaeseung Ha 7k Nov 28, 2022
A C++ Web Framework built on top of Qt, using the simple approach of Catalyst (Perl) framework.

Cutelyst - The Qt Web Framework A Web Framework built on top of Qt, using the simple and elegant approach of Catalyst (Perl) framework. Qt's meta obje

Cutelyst 804 Nov 25, 2022
Experimental, scalable, high performance HTTP server

Lwan Web Server Lwan is a high-performance & scalable web server. The project web site contains more details. Build status OS Arch Release Debug Stati

Leandro A. F. Pereira 5.7k Nov 26, 2022
QDjango, a Qt-based C++ web framework

QDjango - a Qt-based C++ web framework Copyright (c) 2010-2015 Jeremy Lainé About QDjango is a web framework written in C++ and built on top of the Qt

Jeremy Lainé 247 Nov 14, 2022
Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++

libasyncd Embeddable Event-based Asynchronous Message/HTTP Server library for C/C++. What is libasyncd? Libasyncd is an embeddable event-driven asynch

Seungyoung 165 May 25, 2022
A lightweight Bedorck Dedicated Server Plugin Loader

LiteLoader 简体中文 A lightweight Bedorck Dedicated Server Plugin Loader Based on BedrockX Install Download LiteLoader from Releases or Actions, unzip it

null 529 Nov 28, 2022