123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Architecture</title>
- <!-- Copyright Embedthis Software. All Rights Reserved. -->
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <meta charset="utf-8" />
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
- <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
- <meta name="description" content="Simple, fast, secure embedded web server" />
- <link href='https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Open+Sans:300italic,400,300,700'
- rel='stylesheet' type='text/css'>
- <link href='https://fonts.googleapis.com/css?family=Julius+Sans+One' rel='stylesheet' type='text/css'>
-
- <link href="../images/favicon.ico" rel="shortcut icon" />
- <link href="../lib/semantic-ui/semantic.min.css" rel="stylesheet" type="text/css" />
- <link href="../css/all.min.css" rel="stylesheet" type="text/css" />
- <link href="../css/api.min.css" rel="stylesheet" type="text/css" />
-
- </head>
- <body class="show-sidebar">
- <div class="sidebar">
- <div class="ui large left vertical inverted labeled menu">
- <div class="item">
- <a href="../" class="logo">GoAhead Docs</a>
- </div>
- <div class="item">
- <a href="../">
- <b>General</b>
- </a>
- <div class="menu">
- <a class="item" href="../">GoAhead Overview</a>
- <a class="item" href="../users/features.html">GoAhead Features</a>
- <a class="item" href="https://embedthis.com/goahead/download.html">Download</a>
- <a class="item" href="../licensing/">Licensing</a>
- </div>
- </div>
- <div class="item">
- <a href="../start/">
- <b>Getting Started</b>
- </a>
- <div class="menu">
- <a class="item" href="../start/quick.html">Quick Start</a>
- <a class="item" href="../start/installing.html">Installing GoAhead</a>
- <a class="item" href="../start/running.html">Running GoAhead</a>
- <a class="item" href="../start/releaseNotes.html">Release Notes</a>
- <a class="item" href="../start/faq.html">GoAhead FAQ</a>
- <a class="item" href="../start/source.html">Building from Source</a>
- </div>
- </div>
- <div class="item">
- <a href="../users/"><b>User's Guide</b></a>
- <div class="menu">
- <a class="item" href="../users/ports.html">Ports and Binding</a>
- <a class="item" href="../users/routing.html">Routing Requests</a>
- <a class="item" href="../users/handlers.html">Request Handlers</a>
- <a class="item" href="../users/js.html">Embedded Javascript</a>
- <a class="item" href="../users/jst.html">Javascript Templates</a>
- <a class="item" href="../users/goactions.html">GoActions</a>
- <a class="item" href="../users/cgi.html">CGI Programs</a>
- <a class="item" href="../users/authentication.html">User Authentication</a>
- <a class="item" href="../users/logFiles.html">Log Files</a>
- <a class="item" href="../users/ssl.html">Secure Sockets (SSL)</a>
- <a class="item" href="../users/security.html">Security Considerations</a>
- <a class="item" href="../users/man.html">Man Pages</a>
- </div>
- </div>
- <div class="item">
- <a href="../developers/">Developer's Guide</a>
- <div class="menu">
- <a class="item" href="../developers/embedding.html">Embedding GoAhead</a>
- <a class="item" href="../developers/handlers.html">Creating GoAhead Handlers</a>
- <a class="item" href="../developers/authstore.html">Creating Password Verifiers</a>
- <a class="item" href="../developers/migrating.html">Migrating to GoAhead 3</a>
- <a class="item" href="../developers/rom.html">Serving Pages from ROM</a>
- </div>
- </div>
- <div class="item">
- <a href="../ref/">Reference Guide</a>
- <div class="menu">
- <a class="item" href="../ref/compatibility.html">Compatibility</a>
- <a class="item" href="../ref/native.html">API Library</a>
- <a class="item" href="../ref/architecture.html">GoAhead Architecture</a>
- <a class="item" href="../standards/http.html">HTTP References</a>
- </div>
- </div>
- <div class="item">
- <a href="../developers/project.html">Project Resources</a>
- <div class="menu">
- <a class="item" href="http://goo.gl/IGbiio">Official GoAhead News</a>
- <a class="item" href="https://embedthis.com/goahead/">GoAhead Web Site</a>
- <a class="item" href="https://github.com/embedthis/goahead">Source Code Repository</a>
- <a class="item" href="https://github.com/embedthis/goahead/issues/99">GoAhead Security Alerts</a>
- <a class="item" href="https://github.com/embedthis/goahead/issues">Project Issue Database</a>
- <a class="item" href="https://github.com/embedthis/goahead/releases">Change Log</a>
- <a class="item" href="https://github.com/embedthis/goahead/milestones">Roadmap</a>
- <a class="item" href="https://embedthis.com/developers/contributors.html">Contributors Agreement</a>
- </div>
- </div>
- <div class="item">
- <b>Links</b>
- <div class="menu">
- <a class="item" href="https://embedthis.com/">Embedthis Web Site</a>
- <a class="item" href="https://embedthis.com/blog/">Embedthis Blog</a>
- <a class="item" href="http://twitter.com/embedthat">Twitter</a>
- </div>
- </div>
- </div>
- </div>
- <div class="ui inverted masthead">
- <div class="ui fixed inverted menu">
- <div class="ui sidebar-launch button">
- <i class="icon list layout"></i>
- </div>
- <div class="right menu">
- <a class="item" href="https://embedthis.com/">Embedthis</a>
- <a class="item" href="https://embedthis.com/goahead/">GoAhead Site</a>
- <span class="desktop-only">
- <a class="item" href="http://goo.gl/9bL9rM">GoAhead News</a>
- <a class="item" href="https://github.com/embedthis/goahead">Repository</a>
- <a class="item" href="https://embedthis.com/blog/">Blog</a>
- <a class="item" href="https://twitter.com/embedthat">Twitter</a>
- </span>
- </div>
- </div>
-
- <div class="ui breadcrumb">
- <a class="section" href="../">Home</a>
-
- <div class="divider">/</div>
- <a class="section" href="../ref/">
- Reference Guide
- </a>
-
-
- <div class="divider">/</div>
- <a class="active section" href="architecture.html">Architecture</a>
-
- </div>
-
- <iframe class="version desktop-only" src="../version.html"></iframe>
- </div>
- <div class="content">
- <h1>GoAhead Architecture</h1>
- <p>The GoAhead web server is the worlds most popular embedded web server and has been embedded in
- hundreds of different products and hundreds of millions of devices. GoAhead is a compact and efficient
- webserver with simple clean code and APIs.</p>
-
- <p>GoAhead has an strong feature set including:</p>
- <ul>
- <li>HTTP/1.1</li>
- <li>IPv4 and IPv6</li>
- <li>TLS/SSL</li>
- <li>32 and 64-bit support</li>
- <li>HTTP Keep-Alive</li>
- <li>Transfer chunk encoding</li>
- <li>Server-side Javascript</li>
- <li>Basic, Digest and Form-based Authentication</li>
- <li>Session state storage</li>
- <li>URI routing and rewriting</li>
- <li>Logging</li>
- <li>Security sandboxing</li>
- </ul>
-
- <p>GoAhead is extremely efficient. It runs as a single-threaded, event driven, non-blocking process.
- GoAhead is very small (from 600K) and very fast. On a PC class system, it will serve over 10,000 requests per
- second.</p>
-
- <a id="components"></a>
- <h2 >Core Components</h2>
- <p>GoAhead has a modular architecture and clean source code. The key components of GoAhead are:</p>
- <table title="Components" class="ui table segment">
- <thead>
- <tr>
- <th class="four wide">Component</th>
- <th>Description</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>GoAhead HTTP Core</td>
- <td>Core HTTP server. Includes services for HTTP protocol handling, socket connection
- management and logging.</td>
- </tr>
- <tr>
- <td class="nowrap">Request Router</td>
- <td>The request router directs client requests to the appropriate request handler. It
- enforces user authentication and general redirection and URI rewriting instructions.</td>
- </tr>
- <tr>
- <td class="nowrap">Portable Runtime</td>
- <td>Cross-platform, single-threaded, non-blocking event-based portable runtime. Includes services for
- memory allocation, safe string handling, lists, hashing, command execution, socket
- communications, events, timers, debug trace and logging.</td>
- </tr>
- <tr>
- <td>Authentication Framework</td>
- <td>Pluggable authentication. Supports Basic, Digest and Web Form-based authentication schemes.
- This includes a Role-based authorization scheme to access to resources can be controlled on
- a granular basis.</td>
- </tr>
- <tr>
- <td>Session State</td>
- <td>Session state storage. This stores per-user state and cookie management.</td>
- </tr>
- <tr>
- <td>Action Handler</td>
- <td>The Action handler binds URIs to C functions for simple, easy access to C-language code.</td>
- </tr>
- <tr>
- <td>File Handler</td>
- <td>The File handler serves static content such as HTML pages, images and PDF files.</td>
- </tr>
- <tr>
- <td>Javascript Handler</td>
- <td>The Javascript web framework is supports embedded server-side javascript.</td>
- </tr>
- <tr>
- <td>CGI Handler</td>
- <td>Common Gateway Interface handler for serving pages by running external CGI programs.</td>
- </tr>
- <tr>
- <td>Secure Sockets Layer (SSL)</td>
- <td>Secure Socket Layer protocol stack. This is a virtual interface that can selectively support a
- variety of SSL providers including: the MbedTLS and OpenSSL stacks.</td>
- </tr>
- </tbody>
- </table>
-
- <a id="core"></a>
- <h2>HTTP Core</h2>
- <p>The GoAhead HTTP core is responsible for parsing client HTTP requests and directing
- how the request will be processed. The HTTP core reads client requests and parses the request headers.
- It then invokes the GoAhead request router to process the request.</p>
- <p>The HTTP core includes services for: the main HTTP processing, socket communications, and logging.
- The HTTP core server also manages and enforces the sandbox resource limits that have been
- defined at build time. These limits enable GoAhead to be more deterministic in its use of system resources and
- to be a good system citizen.</p>
-
- <a id="router"></a>
- <h2>Request Router</h2>
- <p>GoAhead includes a powerful request router that manages how client HTTP requests are processed. The
- router is configured with a set of routes from the <i>route.txt</i> configuration.
- When a request is received, the router tests various routes and selects the best route to handle
- the request. In the process, routes may redirect or rewrite the request as required.</p>
- <p>A GoAhead configuration will typically have many routes. The configured routes are tested in-order by
- matching the route URI pattern against the request URL. A route may require that further preconditions be met
- before it is suitable to process the request. If the required conditions are not met, the next route in the
- configuration will be tested. There is always a catch-all route that will process the request if all prior
- routes fail to qualify.</p>
-
- <p>Once a route is selected, the specified request handler is invoked to service the request.
- GoAhead has handlers for CGI, Javascript and static file data.</p>
-
- <a id="runtime"></a>
- <h2>Portable Runtime</h2>
- <p>GoAhead is built upon a portable runtime layer that insulates the rest of the
- product from the underlying platform and allows it to be highly portable to new operating systems or
- hardware.</p>
- <p>The GoAhead runtime provides a suite of services that facilitate the creation of secure,
- embedded applications including: events, networking, safe string handling, timers, hashing, lists and
- logging.</p> <p>The runtime also provides a safer environment in which to program as it replaces 'C' APIs that
- are prone to buffer overflows and other similar security exploits. The runtime includes a high performance, safe
- string library that supports a secure programming style.</p>
- <p>The runtime's event processing can be easily integrated into existing applications. It supports
- single and multi-threaded architectures, polled or async event notification. This flexibility means that
- GoAhead can be easily integrated into most C/C++ applications.</p>
- <p>The runtime includes an optional high performance memory allocator.
- This allocator is useful when the native operating system allocator suffers from memory fragmentation.</p>
- <a id="dynamic"></a>
- <h2 >Dynamic Content</h2>
- <a id="cgi"></a>
- <h3>CGI</h3>
- <p>The Common Gateway Interface (CGI) is a standard for interfacing external applications with web servers. CGI
- was originally developed as part of the NCSA HTTP server and is an old standard for interfacing external
- applications with HTTP servers. It still enjoys considerable use.</p>
- <p>CGI scripts are written in any language that can read from the standard-input, write to the standard-output,
- and access environment variables. This means that virtually any programming language can be used, including C,
- Perl, or even Unix shell scripting.
- See <a href="../users/cgi.html">CGI</a> for more details.</p>
- <a id="goactions"></a>
- <h3>GoActions</h3>
- <p>CGI is a slow technique for creating dynamic web pages as it creates a new process for every request. This is
- slow and cumbersome. GoAhead provides a high-performance replacement called GoActions™ that is a more
- suitable solution for embedded systems that demand compact and efficient solutions.</p>
- <p>GoActions are "C" language functions that are bound directly to specific URIs. They respond to client
- requests without creating a new process for each request. By sharing the address space with GoAhead, GoActions
- can directly access the full request context and device/application specific data.</p>
- <p>GoActions are bound to URIs that begin with <i>/action/</i>. When a client requests a URI beginning with
- /action, the action handler looks for a defined GoAction of the correct name. Then the bound C function is
- invoked to service the request.
- See <a href="../users/goactions.html">GoActions</a> for more details.</p>
- <a id="jst"></a>
- <h3>Javascript Templates</h3>
- <p>Javascript Templates (JST) use Javascript code directly embedded in HTML web pages.
- The Javascript is run on the server and the result when the code executes is substituted back into the
- web page before it is sent to the client.</p>
- <p>JST allows the binding of C functions to Javascript functions, so that a JST web page can
- easily access device or system data.</p>
- <p>See <a href="../users/jst.html">Javascript Templates</a> for more details.</p>
- <a id="security"></a>
- <h2 >Security</h2>
- <p>GoAhead provides a suite of measures designed to increase the security of your web server:</p>
- <ul>
- <li>Secure Sockets Layer</li>
- <li>Authorization directives</li>
- <li>Sandbox directives</li>
- <li>Secure portable runtime</li>
- </ul>
- <h3>Secure Sockets</h3>
- <p>GoAhead supports the MbedTLS and OpenSSL stacks. You can configure both server and/or client
- authentication of certificates. SSL and TLS are supported. Other 3rd party SSL stacks are also available
- via the <a href="https://embedthis.com/catalog/">Pak online catalog</a></p>
- <h3>Authentication</h3>GoAhead provides Basic, Digest and Web-Form based authentication mechanisms. It
- supports both file and PAM-based password backends.
- <h3>Sandboxing</h3>
- <p>Sandboxing is the term applied to running GoAhead in a confined environment. GoAhead has a set of
- build-time directives that define a sandbox which limits the resources that GoAhead may
- used.</p>
-
- <a name="apis"></a>
- <h2 >Embedding APIs</h2>
- <p>GoAhead also provides a detailed API so you can create an embedded web server instance and control
- virtual hosts, port binding, directory and location blocks and every other part of GoAhead. See the <a href=
- "../ref/api/goahead.html">GoAhead API</a> for full details.</p>
- <a id="dirs"></a>
- <h2 >GoAhead Directories</h2>
- <p>Here is the list of top level directories in the GoAhead source code distribution.</p>
- <table title="dirs" class="ui table segment">
- <thead><tr><th class="three wide">Name</th><th>Purpose</th></tr></thead>
- <tbody>
- <tr><td>doc</td><td>Documentation</td></tr>
- <tr><td>package</td><td>Packaging scripts</td></tr>
- <tr><td>projects</td><td>IDE and Makefile projects</td></tr>
- <tr><td>releases</td><td>Release packages</td></tr>
- <tr><td>test</td><td>Unit test directory</td></tr>
- <tr><td>test/web</td><td>Unit test web documents</td></tr>
- <tr><td>utils</td><td>Utility programs</td></tr>
- <tr><td>web</td><td>Web documents directory</td></tr>
- <tr><td>*/inc</td><td>Master include directory</td></tr>
- <tr><td>*/bin</td><td>Output for binaries</td></tr>
- <tr><td>*/obj</td><td>Output directory for objects</td></tr>
- </tbody>
- </table>
- <a id="files"></a>
- <h2 >GoAhead Files</h2>
- <p>Here is a list of the major files in the GoAhead source code distribution.</p>
- <table title="files" class="ui table segment">
- <thead><tr><th class="three wide">Name</th><th>Purpose</th></tr></thead>
- <tbody>
- <tr><td>auth.c</td><td>Authorization management</td></tr>
- <tr><td>cgi.c</td><td>CGI handler</td></tr>
- <tr><td>crypt.c</td><td>Crypto routines</td></tr>
- <tr><td>file.c</td><td>File handler for static documents</td></tr>
- <tr><td>galloc.c</td><td>Optional fast memory allocator</td></tr>
- <tr><td>goahead.c</td><td>GoAhead server main program</td></tr>
- <tr><td>goahead.h</td><td>GoAhead master include header</td></tr>
- <tr><td>http.c</td><td>HTTP core engine</td></tr>
- <tr><td>js.c</td><td>GoAhead Javascript language</td></tr>
- <tr><td>js.h</td><td>Javascript header</td></tr>
- <tr><td>jst.c</td><td>Javascript Templates handler</td></tr>
- <tr><td>options.c</td><td>Options and Trace method handlers</td></tr>
- <tr><td>rom-documents.c</td><td>Compiled web pages into C code</td></tr>
- <tr><td>rom.c</td><td>ROM file system</td></tr>
- <tr><td>route.c</td><td>Request router</td></tr>
- <tr><td>route.txt</td><td>Route configuration</td></tr>
- <tr><td>runtime.c</td><td>Portable runtime layer</td></tr>
- <tr><td>socket.c</td><td>Socket management</td></tr>
- <tr><td>upload.c</td><td>File upload handler</td></tr>
- </tbody>
- </table>
- <a id="additional"></a>
- <h3 >GoAhead Additional Files</h3>
- <table title="additional" class="ui table segment">
- <thead><tr><th class="three wide">Name</th><th>Purpose</th></tr></thead>
- <tbody>
- <tr><td>configure</td><td>Configuration script</td></tr>
- <tr><td>Makefile</td><td>Top-level Makefile</td></tr>
- <tr><td>main.me</td><td>Primary MakeMe configuration</td></tr>
- <tr><td>*/inc/me.h</td><td>Generated MakeMe include header</td></tr>
- <tr><td>build/OS-ARCH-PROFILE/platform.me</td><td>Generated MakeMe configuration file</td></tr>
- <tr><td>server.key.pem</td><td>Test SSL private key</td></tr>
- <tr><td>server.crt</td><td>Test SSL certificate</td></tr>
- </tbody>
- </table>
- </div>
- <div class="terms ui basic center aligned segment">
- <p>© Embedthis Software, 2003-2015. All rights reserved.</p>
- </div>
- <script src="../lib/jquery/jquery.min.js"></script>
- <script src="../lib/semantic-ui/semantic.min.js"></script>
- <script src="../scripts/sidebar.min.js"></script>
-
-
- </body>
- </html>
|