Serving Across Puzzles on the World Wide Web


Making Across crossword puzzles available on your web page for downloading is as simple as placing a link to the puzzle file. If the link is to an ftp site (ftp://) and the puzzle is named with the .puz extension, everything should work fine. However, if the link is through an HTTP server (http://), clicking on that link will not, in some cases, result in Across Lite being started up as a helper application at the visitor's end. They will, of course, be able to save that puzzle on disk and load it manually into Across Lite. We recommend the above simple methods for those that are not familiar with CGI scripts or do not need to bother with CGI scripts and/or do not have the permissions necessary to install CGI scripts but may have an ftp site available.

This page provides information on how you can serve crossword puzzles in Across format through an HTTP server to go directly into Across Lite programs configured as helper applications by your visitors. You will either need to have access to the server configuration files or be able to install a trivial CGI script. We will assume that you have successfully created crosswords in Across format either using Across Lite+ or some other software that is licensed to produce Across puzzles.

For the experts

This section provides the essential information for those that have already mastered the terminology and the methods of WWW. If this section is incomprehensible to you, you may wish to read further.

The suggested MIME type for Across crosswords is application/x-crossword. Most users of Across Lite will have configured the program to start up for that MIME type. You will need to configure your site to output that MIME type for puzzles in Across format. This can be done either by linking .puz filename extension to the MIME type in the server configuration (in NCSA httpd, you would add the line AddType application/x-crossword .puz to the configuration file srm.conf; in CERN httpd you would add the line AddType .puz application/x-crossword to httpd.conf) or by writing a CGI script to output the suggested MIME type in the Content-type: tag and then copying the puzzle file after a blank line. Some example scripts to serve Across puzzles can be found here.

For the rest

This is a brief tutorial on how the pieces fit together for Across Lite to be used as a helper application.

How do the Web browsers recognize an Across puzzle?

Most web browsers that support additional helper applications can be configured to start up Across Lite based on the filename extension (.puz is the suggested filename extension for Across puzzles) of the file being fetched and/or the file type of the puzzle file. For local files, the browser normally uses the file type extension unless the file already has the file type information embedded in it. For remote files, the browser depends on the remote server to tell it what the file type is before sending the file. The file type for documents served on the World Wide Web is based on the MIME typing scheme. For our purposes, it is sufficient to understand that a MIME type consists of a base type string and a subtype string, usually written as base type/sub type. The MIME type suggested for Across puzzles is application/x-crossword.

How do the Web servers recognize an Across puzzle?

In most cases, they do not need to. However, one way of ensuring that Across puzzles are served with MIME type application/x-crossword is to configure the server to associate that MIME type with the file extension .puz (in NCSA httpd, you would add to the configuration file srm.conf). This not only requires privileges to configure the server but also assumes that all files with extension .puz in the site where the server resides are Across puzzles. Hence, this solution would only be appropriate for individuals/companies that manage their own web server and can ensure that the only files they serve with extension .puz are Across puzzles.

By default, most servers look at an Across puzzle file and decide that it is a binary file and promptly notify the client browser with the standard MIME type normally associated with binary (non text/image/audio) files - application/octet-stream. Browsers that support user defined helper applications can be configured to run Across Lite on files fetched with the MIME type application/octet-stream. However, we DO NOT recommend this and consequently you cannot assume that your audience will have done so.

Why not recommend that MIME type application/octet-stream be associated with Across Lite?

The MIME type application/octet-stream is a standard MIME type that is used for many different types of binary files including executable files (.EXE, .BIN, etc.). The visitors may have already configured their browsers to do an action (for example, save to disk) in response to fetching a document of MIME type application/octet-stream. Although the filename extension may also be associated with the MIME type in a browser, many browsers simply do not consider the filename extension when a MIME type is known. Hence, multiple specification of actions for that MIME type based on filename extension is not an option for many in your audience. On the other hand, requiring your audience to associate only Across Lite with that standard MIME type is unreasonable as well as inappropriate.

How do I serve an Across puzzle with the correct MIME type?

With a CGI script. Servers treat URLS that correspond to CGI scripts a bit differently than URLS to files. Servers do not attempt to send a MIME type for the output of the script but rather delegate that responsibility to the script. If the script does not output a MIME type, most servers will output the default MIME type for HTML documents text/html. If the script redirects (i.e., provides another URL to a local or remote file) in response to a request sent to the script, the server will now consider the new document and its filename extension, etc., to determine the MIME type to send.

The CGI script can be written in any of the available languages (perl, tcl, ksh, C/C++, Visual Basic, etc). The central idea is that rather than placing a link to the puzzle itself, you place a link to a CGI script along with the puzzle identifying information. For example,

http://puzzle.my.com/cgi-bin/serve/puzzle6

or
http://puzzle.my.com/cgi-bin/serve?puzzle6

depending on how you wish to access the puzzle identification inside the script.

The script is an executable named "serve" in your CGI scripts directory. In response, the script must output the following:

Content-type: application/x-crossword

... contents of Across puzzle #6 here after the blank line ...
The blank line after the Content-type line is important! The path name for the file in which the puzzle exists must be known to the script rather than encoded in the link URL. This is very important for security reasons when using some of the script languages.

We have provided some example scripts here for serving Across puzzles. More details on CGI and scripts can be obtained here

Finally, if you are really having trouble serving Across puzzles, contact us at help@litsoft.com and we will try to help you out.


Go to Across Preview
For comments or questions about the site, send e-mail to webmaster@litsoft.com. Copyright (c) 1998 Literate Software Systems. All rights reserved