Chapter 22. HTML and HTTP

Table of Contents
Web Server Support
Web Client Support
CGI Support
Extended Example

One of the many uses to which RScheme has been put is as an application server for building intranet and internet web servers. There are several modules which are used to make the construction of web servers and web-based services convenient. The module provides basic procedures for generating HTML programmatically.


Most web-enabled facilities have a strong requirement for the dynamic generation of HTML. RScheme meets this need by supplying procedures for producing marked-up output. One distinguishing characteristic of RScheme's approach to generating dynamic HTML is that the markup is passed "out-of-band" using a specialized <output-port> so that normal output can be automatically escaped.

For example, if you are generating a fragment of HTML dynamically, you do not need to worry about whether or not the text you're generating contains HTML special characters like '<' or '&'. Consider this program fragment:

(define (gen-user-name (fullname <string>) (email <string>))
  (bold (display fullname))
  (display " <")
  (emph (display email))
  (display ">"))

The gen-user-name procedure need not be concerned about whether the fullname might contain characters special to HTML, as in "Alice & Bob". An in displaying the "<" and ">" email address delimiters, the programmer need not recall that these should appear as "&lt;" and "&gt;" in HTML -- the system will automatically substitute the correct translation.