Functions for accessing HTTP requests

The following functions are useful for accessing properties of a HTTP request, in a Kawa program that is run either as a servlet or a CGI script. These functions can be used from plain Scheme, from KRL (whether in BRL-compatible mode or not), and from XQuery.

If using plain Scheme, you need to do the following before using these functions.

(require 'http)

This is not needed for KRL or XQuery.

Function: request-method

Returns the method of the HTTP request, usually "GET" or "POST". Corresponds to the CGI variable REQUEST_METHOD.

Function: request-path-info

Corresponds to the CGI variable PATH_INFO.

Function: request-path-translated

Corresponds to the CGI variable PATH_TRANSLATED.

Function: request-uri

Returns the URI of the request, not including the query string, or server specification. The is the combination of CGI variables SCRIPT_NAME and PATH_INFO.

Function: request-url

Returns the complete URL of the request, except the query string.

Function: request-query-string

Returns the query string from an HTTP request. The query string is the part of the request URL after a quetion mark. Returns false if there was no query string. Corresponds to the CGI variable QUERY_STRING.