Trivial-HTTP User's Guide

Table of Contents

Introduction

Reference

HTTP Basics

Utilities

Indices

Introduction

If your HTTP needs are simple (trivial, even), then you've come to the right place. If, on some other hand, you're looking for a full featured HTTP Client with all the bell's and whistles, then you should seek out Drakma.

Reference

HTTP Basics

http-get url
function
returns a list of three elements: a response code as integer, an association list of headers returned from the server, and a stream from which the response can be read.
http-download url destination &key signal-error?
function
Resolves url using http-resolve and downloads the contents of the stream it to destination. Destination is assumed to be a file. Returns (as multiple values) the number of elements downloaded (e.g., bytes) and the actual URL.
http-resolve url &key http-method signal-error? verbose?
function
Similar to http-get, http-resolve returns a list of four elements: the HTTP response code, the headers, the stream and the resolved URL. HTTP-response resolves 301 and 302 responses, and signals an error on responses greater than 400. If there is not an error, then the caller is responsible for closing the HTTP stream.
http-post url content-type content &key headers debug?
function
given a URL, a MIME content type, and the content as a character stream, POST to the URL and return the list of three elements as described for http-get.
http-head url
function
Returns a list of two elements: a response code as an integer and an association list of headers returned from the server.

Utilities

header-value name headers
function
Searchers headers for name without case sensitivity. Headers should be an alist mapping symbols to values; name a symbol. Returns the value if name is found or nil if it is not.
header-pair name headers
function
Searches headers for name without case sensitivity. Headers should be an alist mapping symbols to values; name a symbol. Returns the (name value) pair if name is found or nil if it is not.
escape-url-query query
function
Escapes a query string in accordance with the HTTP specification.

Indices