Next: , Previous: cgi, Up: Top


4 (www main)

The (www main) module provides a generic interface useful for retriving data named by any URL. The URL scheme http is pre-registered.

— Procedure: www:set-protocol-handler! proto handler

Associate for scheme proto the procedure handler. proto is a symbol, while handler is a procedure that takes three strings: the host, port and path portions, respectively of a url object. Its return value is the return value of www:get (for proto), and need not be a string.

— Procedure: www:get url-string

Parse url-string into portions. For HTTP, open a connection, retrieve and return the specified document. Otherwise, consult the handler procedure registered for the particular scheme and apply it to the host, port and path portions of url-string. If no such handler exists, signal "unknown URL scheme" error.

There is also the convenience proc www:http-head-get.

— Procedure: www:http-head-get url-string [alist?]

Parse url-string into portions; issue an "HTTP HEAD" request. Signal error if the scheme for url-string is not http. Optional second arg alist? non-#f means return only the alist portion of the HTTP response object.