Kiosk Proxy Service

Motivation

The kiosk displays web content, which may become available due to any number of reasons, including network and server failures. When this happens, Firefox, the browser employed by the kiosk computer, resorts to displaying an error message. While useful in some cases where users have control over the browser, such messages are of no use in a public environment. Furthermore, this situation is even worse with regards to the upper kiosk display, which relies on automatic refreshes of the content, without user intervention. In the case of an error, the browser is stuck, and the machine requires a reboot (due to the current restrictive access policy to the kiosk computer).

An HTTP proxy can be used to overcome these problems. The proxy intercepts all HTTP requests and responses. If a server responds with an HTTP error code (or does not respond at all), the proxy sends a "normal" response to the client (the browser), containing some default HTML content. Thus, the browser should never display an error message. Moreover, the default content should always contain an auto refresh HTML header directive, which ensures that standard content becomes available once the network/server recovers.

Implementation

The main goal in writing the proxy was to create a program that is self-contained, in order to keep the kiosk computer as simple as possible. This means that no complex environments (Java, PERL, etc.) should be depended upon, as the maintenance of these may be too troublesome. On the other hand, writing a proxy from scratch requires too much work and is not portable.

The solution was to use the Qt toolkit, and create a statically-linked executable. This toolkit is free, cross-platform, and implements many of the abstractions required by an HTTP proxy server. A statically-linked executable means that no installation is required in order to run the server: a simple copy of the executable (and, on Windows, of the MinGW dll) is all that is needed.

There are 3 major classes in the proxy's implementation:

  1. MainDialog Establishes an event loop for the server (on Qt, this is much easier than using threads, or resorting to low-level event handling)
  2. Server Listens for client connections, and creates an HttpConnection object for each new connection
  3. HttpConnection Implements the proxy logic. Uses a QTcpSocket to talk to the client, and a QHttp object to talk to servers.

Building and installing

To compile the server on Windows, you need to download and install the free version of Qt/Windows (tested on version 4.3), along with the MinGW compiler (can be installed via the Qt installer). Then, follow the instructions Here on how to prepare Qt for static linking. This will take time, as Qt needs to be locally recompiled. Then, open a Qt terminal (will be available from the Qt entry on the Windows start menu), change to the server's source directory, and run

    Prompt> qmake
    Prompt> mingw32-make

To install the server, simply copy the resulting executable into a directory of your choice, along with mingwm10.dll. You are now ready to run the server.

To use the server, set up Firefox to use a proxy with localhost as the host and port 8080.

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r2 - 2008-03-31 - EladLahav
 
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback