NaviServer - programmable web server

[ Main Table Of Contents | Table Of Contents | Keyword Index ]

# main-features(n) 4.99.8 manual "NaviServer Manual"

## Name

main-features - NaviServer Features

## Table Of Contents

## Description

## What is NaviServer?

NaviServer is a World Wide Web server that provides access control and database connections and runs on multiple UNIX platforms. NaviServer can access SQL databases including Sybase, SOLID, Postgres, and some third-party database drivers.

NaviServer is extendable with both C and Tcl APIs that expose core functions and provide primitives for accessing the database. NaviServer also provides optional CGI support, although the C and Tcl APIs are more powerful, offer superior performance, and are easier to use.

You can configure multiple servers within one NaviServer configuration file, and then specify which server to run when you run NaviServer. NaviServer also uses a multi-threaded design on all supported platforms. You can configure the number of threads each server can use.

NaviServer offers direct connections to SQL databases such as Postgres, Sybase, MS SQLServer. Third-party database drivers are provided for Oracle, Informix, and Interbase. You can even configure NaviServer to have connections to multiple databases and specify which databases are available to each server.

NaviServer also includes server administration capabilities. An access control system allows you to specify separate permissions for each combination of URL and HTTP method (GET, PUT, or POST). You can also specify users and groups who are allowed access to NaviServer.

## Features

NaviServer Administration Features

- Access Control:

  NaviServer's access control system allows you to define users, assign users to groups, and set permissions for users, groups, and hosts.

  When defining permissions for the NaviServer, you can specify lists of users to allow or disallow, lists of groups to allow or disallow, and hosts (specified either by host name or IP address) to allow or disallow for each method/URL combination..

- Multi-homing:

  NaviServer allows you to run multiple servers on one host by attaching them to different port and/or IP address combinations.

  See the "Configuration for Multiple IP Addresses" section for information on configuring NaviServer for multi-homing.

- Database Services Features

  NaviServer manages pools of open connections to databases. These pools let NaviServer quickly service simultaneous database requests (without continuously opening and closing the database), and to prevent a large number of HTTP requests from overloading the system. Both the Tcl and C APIs provide access to these database pools.

- Programming Interface Features

- Tcl Interface:

  NaviServer can be extended using the Tcl scripting language. NaviServer provides a powerful Tcl API containing a full array of functions and primitives that give you access to all of NaviServer's core functionality and SQL databases. Tcl functions are available to interact with the connection, implement scheduled procedures, maintain state, access the sockets and threads interfaces, roll access logs, maintain permissions, access the database, and much more.

  You can create scripts in a private Tcl library for each server, or in a library shared by multiple servers. Since Tcl is embedded in NaviServer, a separate process is not required to run a Tcl script, making Tcl extensions much more efficient than CGI-based extensions.

- NaviServer Dynamic Pages (ADPs)

  ADPs allow you to embed Tcl scripts directly into HTML pages. The script(s) are interpreted dynamically when the page is accessed.

- C Interface:

  NaviServer can also be extended with the C API. The C API lets you write your own logging routines, access control system, communications drivers, or database drivers. It provides all the necessary functions and structures you need to access NaviServer's core functionality and the database.

  To use the C API, you compile your C module into a Unix shared library. NaviServer will dynamically load the module and call your initialization function.

- CGI Support, Including CGI File Type Activation:

  NaviServer provides full CGI support. Because running a CGI program requires a separate process to be created, it is less efficient than extending NaviServer with Tcl or C.

  You can configure NaviServer to look for CGI programs in a specific directory, or you can store CGI programs near the HTML files and refer to them using the .cgi file type. Any file with the .cgi extension will be interpreted as a CGI program by NaviServer. You can configure NaviServer to activate the .cgi file type in specific directories or groups of directories.

### High Performance

Fast and efficient handling of simultaneous connections through a combination of multi-threading, in-memory caching, and single-threaded asynchronous I/O. NaviServer has an advanced multithreaded architecture. Multithreading features include:

- Fast response without having to fork for each connection.

- Multiple, simultaneous servicing of connections.

- Ability to keep state in the address space of the single NaviServer process - no need to maintain slow and messy external files!

- Simple programming model where each request is handled in its own thread, freeing the programmer from the worry of a long running request blocking the server.

- Fully configurable minimum and maximum number of threads on a per-virtual server basis. Threads are transparently added when demand rises and then slowly exit as demand falls.

- The Tcl interface is fully multi-threaded aware - no special steps are required to ensure proper concurrent script evaluation.

- The nsthread platform-independent C API for multithreaded programming which includes:

  - Functions to create and wait for new threads

  - Mutex, critical section, semaphore, and event objects to protect shared resources

  - Thread local storage for maintaining per-thread data

- The nsthread interface allows the NaviServer programmer to write new C functions which use advanced multithreaded locking and synchronization techniques independent of the host platform. In fact, the NaviServer is written entirely using the nsthread interface - no platform specific multithreading code is used anywhere in the NaviServer or in any NaviServer module. No other Web server provides this level of multithreaded programming support!

- NaviServer performs in-memory caching of pages and scripts, and single-threaded asynchronous I/O for returning static content.

### Tcl Scripting

Quickly add dynamic content to your website:

- Integrated multi-threaded interpreter runs scripts in parallel in one process with complete access to server state

- NaviServer Dynamic Pages (ADP's) allow embedding of Tcl scripts in HTML pages

- Rich, easy-to-use scripting language loaded with new NaviServer-specific extensions for building web applications

- Ability to add your own C commands to the language

NaviServer includes the Tcl (Tool Command Language) scripting language as an integral part of its architecture:

- The Tcl interface allows you to quickly build custom Web applications without C code or messy CGIs.

- The Tcl interface is multithreaded, allowing more than one Tcl script to operate in one or more virtual servers simultaneously.

- Built-in Tcl scripts operate up to 10 times faster than comparable Perl-based CGIs.

- The Tcl interface can be extended to include your own custom Tcl commands written as Tcl procedures or as C primitives.

- NaviServer extends Tcl to include commands for accessing one more open databases without writing any C code or executing slow external CGIs.

- The Tcl interface includes useful commands for accessing HTML form data and information about the active connection.

- The Tcl interface provides a command for opening a TCP/IP socket which can be used to implement a quick HTTP transaction to another Web server or send Email using SMTP (a procedure for sending email is included).

- Resources allocated during evaluation of a Tcl script (e.g., open database handles, open files, ns_Set data) are automatically garbage collected after the script returns, freeing the script developer of these tedious tasks.

- Tcl scripts can be in the pages directory along with the HTML pages and images or in a special Tcl library directory:

  - Scripts in the pages directory are evaluated on each transaction which is ideal for quick script development.

  - Scripts in the library directories are evaluated at startup time for fast response without having to open and read the script file.

- NaviServer includes an HTML-forms based interface for creating and updating Tcl scripts which are located in the Tcl library directory. Also included is a simple HTML form for ad-hoc evaluation of a Tcl script typed directly into a text area box.

- Tcl, unlike Java, has been in use by a large user community for years (join the comp.lang.tcl newsgroup) and is well documented by the creator of Tcl, John Ousterhout of Sun Microsystems.

- NaviServer Dynamic Pages (ADP's) are HTML pages that are parsed and run on the server when the page is accessed -- ADPs contain HTML tags and Tcl scripts. ADPs are ideal in situations where you want to generate part or all of a specific page dynamically.

### Complete C API

Write custom dynamically loaded modules for:

- Handling requests

- Translating URLs

- Logging

- Database access

- Thread creation and synchronization

- And much more!

The NaviServer includes a complete C API. Using the C API you can write:

- Custom request functions to handle HTTP request to an URL or a complete hierarchy of URLs.

- Custom URL-to-file translation routines to convert an HTTP URL to a file in the local filesystem. This can be used to map URLs to one or more filesystem directories as required for maintenance or load balancing.

- New Tcl commands for use in your Tcl scripts. NaviServer provides initialization functions to ensure your command is available in all the Tcl interpreters in a virtual server Tcl interpreter pool.

- Database drivers to interface NaviServer to your own DBMS.

- Communications drivers so NaviServer can implement HTTP over a new underlying protocol:

  - The included nssock module implements HTTP over regular TCP/IP sockets just like other basic Web servers such as NCSA, CERN, or WebSite.

  - Filter functions which run at any stage of each HTTP request. A filter can be used to implement logging - in fact, this is how the nslog Common Log Format logging module works.

  - A scheduled procedure which runs at regular intervals. A scheduled procedure can be used in conjunction with a filter function to implement a statistics gathering system.

No other Web server C API is as complete and powerful as the NaviServer C API!

### SQL Database Services

Powerful and easy access to a variety of SQL databases. Driver source for PostgreSQL and Sybase/MSSQLServer are included with others available from third parties.

NaviServer includes loads of features to help you connect your website to SQL databases:

- Provides a platform independent interface to SQL relational databases.

- Connects to underlying database servers through plug-in database drivers:

  - Included are drivers for Sybase, MS SQLserver, and PostgreSQL.

  - The NaviServer/AOLserver Communities have also contributed drivers for Informix, Oracle, Interbase, and MySQL.

- NaviServer maintains one or more pools with one or more open database connections. By maintaining open connections, HTTP requests have instant access to the database instead of incurring the expensive startup time of a CGI-based solution.

- Requests are queued in first in, first out order to ensure efficient and fair use of database resources.

- Database operations are available through both the C and Tcl API's.

### Secure Sockets Layer

SSL enables network encryption for e-commerce applications via openssl module.

### Hierarchical Access Control

Restrict access to all or part of your Web through lists of users, groups, and/or client address.