S++ Official Homepage

Table of Contents

Valid HTML 4.01 Strict


Introduction

S++ is a standalone dynamic web server written in C++, which allows programmers to create dynamic web pages using C++ language. It aims at improving efficiency in coding and strength against malicious input, especially for small web applications. Besides, it has some unique features over existing dynamic web solutions.

Simple and Small: S++ is standalone and does not require companion of sophisicated programs (e.g. Apache, Tomcat). The solution is saving both installation headache and system disk space.

Separated Access Control: Compiled servlets run as individual Unix processes. The processes are partitioned by the operation system and therefore secure from interfering each other.

Written in C++: S++ is a try to employ C++ special features, instead of C-style programming. For example, reduction of pointers make the software easier to be maintained.

Automatic Conversion: Although a strong typing language, C++ is used, programmers do not need to explicitly spell the functions to convert HTTP parameters into various data type.

Strong Typing: S++ uses strong typing feature of C++. This means it is possible to detect and filter majority of type mismatches before compilation and deployment.

Although it is called "S++", it is theoretically not necessary to be related in C++ in the future. As long as a program follows the specification of communication, it does not matter what programming language it is made of.

Table of Contents


Poster

Page 1 Page 2

You can click on the thumbnails for larger version. Becareful they are really large.

Table of Contents


Download

The software is now released as the project is graded. However, please note that the software is not perfect enough for production usage. We welcome you to improve it on your own.

sxx.tar.gz (116149 bytes)

It is not yet planned if there will be any improved versions. Possible improvements can be found in Detailed Design.

Table of Contents


License

Copyright (c) 2006-2007, Kinson Chan, University of Hong Kong
(Contact: kchan [at] cs.hku.hk, charray [at] meric.hk)

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  3. Neither the name of the University of Hong Kong nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Table of Contents


Quick Start

First thing to do, of course, is to download the software... on a *nix box. Next, expand it at anywhere you feel comfortable.

You can create your first web application by copying some default folders (starting with example).

If you want to write your application in a total C++ way, you can start with example-empty folder. Inside the folder, there are four functions to fill in, similar to a Java Servlet. We call this method 1 in the following context.

In order to maximize your experience with S++, we recommend you starting with example-register. You are encouraged to watch the .page files in pages folder. They may give you hints how to program. We call this method 2. S++ comes with a code generator to convert the files into C++ codes for further compilation.

In order to compile, issue a make command at the base directory of a web application. You will finally get an executable called servlet. For more information, please download the report at Detailed Design.

Table of Contents


Detailed Design

In order to provide users the full vision of the project, the final year report is provided in PDF (2036701 bytes).

Table of Contents


Frequently Asked Questions

How is a S++ servlet different with other servlets?

Lack of container: In the design of S++, servlets are not running inside container. They are instead running on top of the OS. This allows different servlets to be in different processor and storage restrictions.

Native code: The S++ servlets, once compiled from source code, are in fact executables. They can be executed natively on the operation system. The need of having proprietary virtual machines is eliminated.

I think using strong typing language is not efficient in coding.

It is inevitable that a strong typing language to be less efficient if we consider the amount of code required. Web applications involve a lot of data type conversions. That means we have to repeatedly put instructions to convert the values.

On the other hand, this is not true for solutions like S++. In S++, we have a var class for conversion. Besides, if programmers choose method 2 for development (see Quick Start), codes for parameter format checking are shortened by a lot.

Another improvement in coding effiency is, codes for data retrival can be shortened. Programmers can map parameters directly with data source, and have our code generator to handle it. (Don't worry! It is safe - they are already checked.)

What are the reasons to choose C++ over Java?

We have free, open source and production-grade C++ compilers. It is very important to have open source compilers because it is only possible to port open source compilers. If the compiler is proprietary, users may not be supported to use the operation system that they like.

We have to also note that one size does not fit all. (Otherwise, all the men on the world would competit for a single lady.) Having a working Java-based solution is not the reason we have to drop C++ one. Besides, S++ is designed in a way totally different from Java Servlet. This make S++ unique enough to be investigated.

What are the difficulties in making this software?

HTTP parsing: Unlike Perl, C++ is not a solution designed around string handling. Parsing data from a "flattened" string is not an easy task in C++. The hand-built parser is difficult to develop and maintain. In the future it may be switched on a flex-generated one.

Pointers: C++ is relatively low level programming languages. There are a lot of dangerous features such as pointers. Although it is possible to avoid most of them, it is inevitable we have to deal with some, especially for socket system calls. Extra care and effort is used to avoid bugs.

Automatic conversion: C++ is a strong typing language. In order to provide flexibility we find in weak typing language, a var class is designed. C++'s operator overloading make this done easier. However, there are still some complications that not a lot of people know how to deal with.

I am confused. Is S++ a language or a program?

S++ is a program written in C++, with blanks to be filled. Programmers can fill in their own C++ code, compile, and get thier desired servlet. Meanwhile, we have some interesting special syntax for code generation (see Quick Start). This special syntax may expand and change S++ into a new language, just like how PHP evolved from Perl.

What do you mean by standalone?

It means the software is working on itself. It does not require companion of extra software packages (e.g. Tomcat, Apache) to run. Of course, you may want to keep your operation system and a g++ compiler.

Who is the author of this program?

kchan [at] csis.hku.hk

S++ is in fact the author's final year project. The development of S++ after graduation may have chance to be continued.

Where is S++ written and tested?

It is written on Mac OS X and FreeBSD. Hopefully the source code may also be working on most of the *nix. However, if a operation system is known to have serious memory leakage, it is not a good choice.

Will S++ support Microsoft Windows?

Sorry, this is not in any part of the plan. However, since S++ is open source, any one in interest is welcomed to do the porting.

The reason for Microsoft Windows to be excluded is that, the API on this operation system is too different from common *nix.

Table of Contents


This page is hosted on Project Meric Phase 3.