The Haiku/BeOS Tip Server
Tips and tricks for Haiku/BeOS users

UBB on BeOS: Set MIME types properly

Contributed by: Scot Hacker
This tip is valid for: Both BeOS and Haiku

If you want to run the Ultimate Bulletin Board discussion system on your BeOS web server (such as the discussion boards here at the Tip Server), you’ll find that everything works pretty much out of the box… with one exception: Newly generated HTML files produced by scripts have not yet had their MIME types set properly. Because some BeOS web servers (notably Robin Hood) examine the MIME type of each file rather than using a MIME database like other servers, the generated pages won’t be served without running mimeset, or settype, or right-click Identify, or by double-clicking the file in the Tracker. If you’re using Apache or Xitami, note that these servers do MIME via extensions rather than BeOS filetypes. They should be immune to this problem.

The solution is to modify the source code of the scripts so that they give the generated HTML documents the proper MIME type immediately after generation. The file generation code is stored in an UBB library file.

Open up ubb_library2.pl and look for the string:

chmod (0777, "$ForumsPath/$ExactPath/HTML/$HTMLPageName.$FileExt");

This was around line 434 in the version of the scripts I downloaded (but was at a different line in the pro version I upgraded to). Immediately after that line, add this block:


@SetType = ("settype", "-t", "text/html",
 "$ForumsPath/$ForumIs/HTML/$ThreadNumber.html");
system (@SetType);

The only other change you need to make is to change the path to perl in all of the forum scripts, though that should be fairly obvious. This is, of course:

#!/boot/home/config/bin/perl

Posted in Applications


(comments are closed).