Embedthis Appweb 3.0A.0
Home > Overview

Quick Nav 

Why Embed a Web Server?
Who Embeds a Web Server?
Web Server Differences
Appweb Components
Appweb Architecture
Appweb Modes of Operation
Stand-alone HTTP Server
Embedding the HTTP Server
Security

See Also

Appweb Features
Release Notes

Embedthis Appweb™ Overview

Embedthis Appweb is the industry's first embeddable HTTP web server that has been designed from the start with security in mind. It is a fast, high functionality, small-footprint, standards based embedded web server specifically designed for use by embedded applications and devices.

Why Embed a Web Server?

There are two ways to implement a HTTP web server.
Conventional wisdom has stressed the separation of presentation from logic and this is a good axiom. However, it should be a logical separation and not necessarily a physical separation. In some cases, a physical separation is ideal and it can often help to scale-out a large site when used with load balancing. In other cases, the simplicity and performance gains from embedding a web server directly in an application or device make direct embedding the preferred choice. Both approaches are legitimate. Embedthis Appweb aims to be the best embeddable HTTP server.

There are many reasons to embed a Web Server. Some examples are:

Who Embeds Web Servers?

There are two classes of users for Appweb: Enterprise application developers and Device builders and they are riding two key trends:
Should embedding a HTTP server be the right option for you, there are numerous benefits in doing so:

A Web Server is a Web Server, Right?

An embedded web server has a different set of design goals compared with those of an enterprise web server such as Apache. While both servers receive and respond to the standard HTTP protocol, the design goals and core processing architectures choices are considerably different. Furthermore, the resource demands these web servers impose on a system may be very different.

Enterprise web servers typically assume that they are the most important application on the system and often run on a dedicated system. It is acceptable for them to scale to consume available resources to serve incoming requests. In contrast, Embedded web servers assume they are secondary to the essential functions an application or device must perform. As such, embedded web servers must minimize their resource demands and must be deterministic in the load they place on a system.

The key design goals of embedded web servers and Appweb in particular are to be:

Appweb Components

The Appweb product includes the following components:

Appweb Architecture

The core Appweb HTTP server has been carefully designed to be deterministic in its use of system resources while retaining high performance and minimal footprint. It does this leveraging the following features:

And for those who wish to rebuild Appweb from source code, Appweb can be highly optimized by using an an extensive set of compile time options to control what features are included.

Modes of Operation

The Embedthis Appweb product is more than just a stand-alone HTTP server. The product includes this base functionality, but it also exposes components so that you may embed the core HTTP server and HTTP client functionality directly in your applications.

For applications, embedding the HTTP server in the application greatly simplifies deployment as there is no separate web application to deploy. For devices, either running a stand-alone server or embedding the server in the device application will work effectively.

Stand-alone HTTP Server

When using Appweb as a stand-alone server or when embedding, you can create web user interfaces using several innovative Appweb technologies and existing standard technologies
The Appweb server runs as a stand-alone program. On Windows, it runs as a system service and on Linux/Unix it runs as a system daemon.

Server-side JavaScript

JavaScript or ECMAScript (ECMA-262) has typically been implemented in the client. However, it is ideally suited for embedded use on the server. Appweb supports a subset of ECMAScript called EJScript that is fast and compact.

Embedded Server Pages (ESP)

Embedded Server Pages are server side JavaScripted HTML pages that allow direct binding between the JavaScript procedures and logic routines in your application.

The Embedded Server Pages technology remedies these shortcomings by allowing you to use page layout programs such as Dreamweaver while still retaining the ability to generate dynamic content within the page via server-side JavaScripting.

Embedded Gateway Interface (EGI)

The Embedded Gateway Interface is a modern replacement for the Common Gateway Interface (CGI). Using CGI for form data suffers from many of the same deficiencies it exhibits when it is used to generate page data. In addition, it provides a very low level interface that does not assist the developer when decoding query or posted data.

The Embedded Gateway Interface is one of a set of modern replacements for the venerable Common Gateway Interface (CGI). CGI suffers from several deficiencies that make it a poor choice for creating dynamic user interfaces in embedded applications:

The Embedded Gateway Interface remedies these shortcomings by allowing an equivalent of in-process CGI. Form URLs may be bound directly to EGI code routines that will be called when the form is posted. Appweb further assists by decoding query arguments and providing hashed lookup to all environment data variables.

Open Modular Architecture

Appweb supports dynamically loadable modules so that new content handlers, scripting engines and page generation environments can be easily added. The existing mechanisms: ESP and EGI have been developed as loadable modules so that they are only loaded if required. Scripting engines such as PHP have also been created as loadable modules.

Common Gateway Interface (CGI)

Should you need to support existing code bases that use CGI, Appweb provides a high performance CGI implementation.

Embedding the HTTP Server

When embedding the Appweb HTTP server in a device or application, all the features of the stand alone Appweb server are available. The required SSL, Authentication, Embedded Server Pages, Embedded Gateway Interface, CGI and other dynamic modules will be loaded into the application as required.

To embed the Appweb HTTP server or client in an application is easy and requires from 10 lines of code to integrate and activate. Because Appweb is configured primarily by using an Apache style ASCII configuration file, initialization by code is not necessary. This also eases administration as the server configuration may be modified in the field if required.

To make Appweb easy to embed, it supports a wide variety of Programming Paradigms. This includes support for C and C++, single and multithreaded programs and a variety of different event mechanisms.

Threading Model

The Appweb HTTP server can run either single threaded or multithreaded and the threading mode can be selected at run-time by your application. Further, you can set the number of threads to be used by Appweb depending on the anticipated scale of your application.

Appweb can fully expose its event loop if needed so that it can be integrated with existing application event mechanisms. It supports the following event processing mechanisms:
Debugging Support
The Appweb HTTP server includes a powerful debug logging facility and is fully instrumented to log trace information. This can be invaluable in debugging ESP code logic or new Appweb handlers that you may have written.

Samples

An extensive suite of samples is provided. See the Programming Samples document for details..

Security

Most HTTP servers have become more secure by a painful process of discovery. While it is no guarantee, developing a HTTP server to be secure by design is easier than trying to engineer security in after the fact. Securing embedded HTTP servers is even more difficult as it must be done without increasing memory footprint or damaging performance.

Embedthis Portable Runtime (MPR)

Appweb has been designed to be secure from the foundation by using the Embedthis Portable Runtime (MPR). The MPR is a cross-platform layer that permits over 97% of the Appweb code to be portable. It includes a safe string and buffer handling module to help the eliminate buffer overflows that have plagued so many products. It also warns when any unsafe (traditional) C API functions are used.

Sandboxing

The Appweb HTTP server closely controls its use of system resources via a technique known as "sandboxing". This means running the web-server within tightly controlled limits so that script errors or web server bugs will not compromise system operation. Appweb has also been hardened against several common denial of service attacks.

Appweb can be configured to:
To build on this foundation, Appweb provides Secure Sockets Layer and Digest authentication.



© Embedthis Software LLC, 2003-2009. All rights reserved. Embedthis, Ejscript and Appweb are trademarks of Embedthis Software LLC.