chickadee » gopher » accept

accept handle-requestprocedure
max-line-length 2048parameter

Reads a line from the client (up to CRLF, plain CR, or plain LF), replaces any ASCII NULs with SPACE, and splits the line into fields, using TAB as the delimiter. In general, client lines take 4 forms:

  • Selector
  • Selector<TAB>Search terms
  • Selector<TAB>Gopher+ data
  • Selector<TAB>Gopher+ data<TAB>Search terms

The first field is always the requested selector. Search terms are added for type 7 requests. The Gopher+ protocol unfortunately introduces some context-sensitive ambiguity into the meaning of the fields, and this module is not in the business of figuring that out. Instead, the user is expected to hash out the meaning of any extra fields, and handle-request is therefore called with two arguments:

(handle-request (car fields) (cdr fields))
(handle-request selector extra)            ; put another way

Note: the RFC says selectors may not exceed 255 characters, but this check is not enforced; however, to avoid memory overflow, accept will only read up to max-line-length characters. (Special note: line limiting doesn't currently work for TCP ports!)