Contents of this section
Having trouble getting your first WebKit program to work?
- Make sure you have a functioning Linux system.
Does Linux boot and run your normal admin applications
such as 'vi' and 'gcc'?
- Make sure FlagShip is correctly installed.
Can you create, build, and run a "Hello World" program
with FlagShip? (Or you could try to compile and run
fscheck.prg
, which is installed in /usr/FSsrc
by default.)
- Make sure you have TCP/IP networking installed and functioning.
To work with WebKit and develop your server applications, you don't
really have to be on the Internet, or even have a network connection,
but you do need to have TCP/IP and to be able to 'ping' yourself.
Check your TCP/IP installation by running from
the command line:
$ ping `hostname`
- Make sure your WWW server is up. Run
$ telnet `hostname` 80
- Now install, configure, and test your WWW browser. We recommend that
you use Lynx as you work with WebKit because it's fast, independent of
your XWindows configuration, and has few complications in general.
Other tips:
-
/etc/webkit.conf
is used by the
webkit
shell script to set a few environment variables on startup. If you
run the
webkit
script on another server you will need
to copy this file and maybe make changes to it.
- To uninstall WebKit, simply erase the following
files. These are only their most common locations, so your
commands may be different.
- /usr/local/include/webkit.fh
- /usr/local/lib/libwebkit.a
- /usr/local/etc/httpd/cgi-bin/webkit
- /usr/local/etc/httpd/cgi-bin/webkit-gateway
- /usr/local/etc/httpd/cgi-bin/example\1-9\
- /etc/webkit.conf
- WebKit examples directory
Remove a webkit-specific entry from /etc/syslog.conf if
needed.
- If your WebKit program blows up with no visible signs
of an error code--look to issues with the startup code, which executes
before WebKit's error handler kicks in. You might be getting a
"user limits exceeded" error as a result of running some other FlagShip
application at the same time as your WebKit application under a
single-user runtime license.
- When you start your WebKit program from the command line,
it will go into the background and await connections on the specified
port as a Gateway-mode server. If you do not want this behavior, compile
in your own
main()
function and you will be in control.
- When you start your WebKit Gateway mode program,
you might want to execute
TERM=dumb
first. That way any
runtime errors that FlagShip catches before the WebKit
error handler becomes active will display without escape codes on
the WWW browser.
- Your <FORM> tags should use
METHOD=POST
.
- If you put a protocol analyzer on the WebKit host you'll
find this traffic passing from the Gateway process to the server:
4 bytes length of environment variable block
4 bytes number of environment variables
n bytes environment variable block:
name -NUL- value -NUL- ...
4 bytes length of form variable block
4 bytes number of form variables
n bytes form variable block:
name -NUL- value -NUL- ...
The Gateway process takes whatever it gets back over the same socket
(presumably HTML code) and shoots it to standard output, which
CGI passes to the browser.
- It is possible, when you build your program with a FlagShip compiler that
is not licensed for unlimited users, that some other FlagShip
application would be running on the host when your application is invoked.
This is a major problem because you get an
alert()
box that
reads, "Sorry, user limits exceeded" before
the WebKit initialization code gets a chance to set a different
errorblock()
from FlagShip's default. When linked with
libwebkit.a
, then, alert()
just sits there and waits for a
keypress that will never occur. The only thing to do is to kill the
process.
- With FlagShip 4.3, you can merely link in WebKit to allow your
FlagShip programs to bypass ncurses even when you are developing
a program that will never be used in connection with the World Wide Web.
This feature can be valuable for batch-type
programs that you'd like to run in the background via
batch
or
cron
, or for reporting-type programs that you want to redirect
to a file or pipeline. To do this, you need to add -lwebkit
to the linker command line, and run the program with the TERM
environment variable set to fsdumb
for the "FlagShip dumb
terminal" type.
Output from qout()
and qqout()
(as well as their
equivalents, ?
and ??
) is written directly to standard
output. You can easily write a complex report using no output other
than the ?
command.
You may wish to execute stty sane
afterwards. Otherwise the
FlagShip runtime messes with your terminal settings. This is not
necessary when launching a Gateway mode server because libwebkit.a does
this for you.
If you use FlagShip 4.4, this particular feature is probably not
very useful to you since it's provided with the compiler and libraries
already.
Next Chapter, Previous Chapter
Table of contents of this chapter,
General table of contents
Top of the document,
Beginning of this Chapter