frondoc picture

This page is
part of the
Frontier 4 site.

Frontier 5
shipped in
January 1998.

The information
on these pages
may not be
accurate for
Frontier 5.

These pages
are maintained
for archival
purposes only.

Playing with Apple's Web Server

Good morning!

The holidays are over, MacWorld Expo is almost here, the developer survey is complete, and I'm (once again) digging into Apple's new personal web server interface with CGI apps, and working towards connecting it to the Frontier CGI framework.

You can download the (beta) server software from Apple's website.

I got stuck

In the first attempt to get it working, in late December, I got stuck after setting up a suffix mapping, verifying that it was registered, but still couldn't get Pony to call the CGI. It would respond with a statement that the file didn't exist

John Norstad, and Jim Correia,, came to the rescue. They took the message literally, they both created dummy files and the CGI worked as it's supposed to. I guess it pays to take error messages literally.

I think this is a bug, and Apple will possibly fix it. For now at least we know how to work around it. Onward!

Test it out

I have the Pony server running on a PowerBook 540C in the other room. I am using Apple's sample app, Responder, to test it out. When you call the Responder directly, as below, it works:

And when you use the suffix-map to get there, it also now works:


Moving forward

The next step is to create a sdoc handler that Pony can talk to. I'll save you the suspense -- I hit a deal-stopper.

Here's what I did. First I downloaded Mason Hale's CGI Framework. It has a folder containing 'sdoc' handlers for MacHTTP and NetPresenz.

Apple's docs say: "Path and search arguments are supported using the '$' and '?' delimitters, as in MacHTTP 2.2. The AppleEvent structure is identical to the MacHTTP 2.2 format."

Based on this statement, I thought I should start with Mason's 'sdoc' handler for MacHTTP. So I downloaded and installed it. I created a dummy file in the Web Pages folder called samples.tellparams.fcgi. I registered '.fcgi' as an action directed at an application called "Frontier.cgi". I created an alias to the Frontier app called Frontier.cgi and put it in the Web Pages folder.

I entered the following into my web browser:

Frontier comes to the front, indicating that Pony correctly understood that it was supposed to send the event to Frontier. But the browser hangs, and after about a minute or so, it serves up the text contained in the dummy file.

I tried making all the params to the 'sdoc' handler optional, but this didn't change the behavior.

My theory is that the param list doesn't match up, Frontier is returning an error, and Pony isn't reporting it.

It would be helpful (is anyone from Apple/Maxum watching this page?) to have look at the source code that's sending the Apple Event. Or the source to the Responder CGI app.

[Postscript: Jim Correia reports that the source for Responder is available at Thanks Jim!]

The question is, what is Pony saying to us? What are the params to the Apple Event? We can write a sniffer, it would take a few hours, but it would be much better to have the definitive word from the developers at Apple and/or Maxum.

General comments

The server software makes some DebugStr calls. Be sure you have Macsbug or an equivalent running on your system.

Error codes are returned from the Apple Events. It would be helpful to have a list of what these mean.

I've loaded in Apple's Docs on CGI scripting on the the Apple's CGI Docs page.

A start at the install file

I started by writing scripts that register, list and delete actions, following the sample scripts that ship with the server. They live in system.verbs.apps.pony. You can download it from:

Note: The fun name of this product is Pony Express. That's the app their scripts talk to and that's the name of the prefs folder. It's a little more catchy than APWS, so I used "pony" instead.


CGI Scripting in Frontier -- Explains, step-by-step, how to write CGI scripts in Frontier. This page describes the framework that we want to connect to Apple's server.

© Copyright 1996-98 UserLand Software. This page was last built on 5/9/98; 8:29:41 AM. It was originally posted on 12/28/96; 4:21:04 PM.