home *** CD-ROM | disk | FTP | other *** search
/ Internet Access: To the Information Highway / InternetAccessToTheInformationHighway1994.disc1of1.iso / inetinfo / gopher.txt < prev    next >
Text File  |  1994-06-08  |  37KB  |  896 lines

  1.  
  2.  
  3. Network Working Group                                     F. Anklesaria
  4. Request for Comments: 1436                                  M. McCahill
  5.                                                              P. Lindner
  6.                                                              D. Johnson
  7.                                                               D. Torrey
  8.                                                              B. Alberti
  9.                                                 University of Minnesota
  10.                                                              March 1993
  11.  
  12.  
  13.                       The Internet Gopher Protocol
  14.          (a distributed document search and retrieval protocol)
  15.  
  16. Status of this Memo
  17.  
  18.    This memo provides information for the Internet community.  It does
  19.    not specify an Internet standard.  Distribution of this memo is
  20.    unlimited.
  21.  
  22. Abstract
  23.  
  24.    The Internet Gopher protocol is designed for distributed document
  25.    search and retrieval.  This document describes the protocol, lists
  26.    some of the implementations currently available, and has an overview
  27.    of how to implement new client and server applications.  This
  28.    document is adapted from the basic Internet Gopher protocol document
  29.    first issued by the Microcomputer Center at the University of
  30.    Minnesota in 1991.
  31.  
  32. Introduction
  33.  
  34.    gopher  n.  1. Any of various short tailed, burrowing mammals of the
  35.    family Geomyidae, of North America.  2. (Amer. colloq.) Native or
  36.    inhabitant of Minnesota: the Gopher State.  3. (Amer. colloq.) One
  37.    who runs errands, does odd-jobs, fetches or delivers documents for
  38.    office staff.  4. (computer tech.) software following a simple
  39.    protocol for burrowing through a TCP/IP internet.
  40.  
  41.    The Internet Gopher protocol and software follow a client-server
  42.    model.  This protocol assumes a reliable data stream; TCP is assumed.
  43.    Gopher servers should listen on port 70 (port 70 is assigned to
  44.    Internet Gopher by IANA).  Documents reside on many autonomous
  45.    servers on the Internet.  Users run client software on their desktop
  46.    systems, connecting to a server and sending the server a selector (a
  47.    line of text, which may be empty) via a TCP connection at a well-
  48.    known port.  The server responds with a block of text terminated by a
  49.    period on a line by itself and closes the connection.  No state is
  50.    retained by the server.
  51.  
  52.  
  53.  
  54. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 1]
  55.  
  56. RFC 1436                         Gopher                       March 1993
  57.  
  58.  
  59.    While documents (and services) reside on many servers, Gopher client
  60.    software presents users with a hierarchy of items and directories
  61.    much like a file system.  The Gopher interface is designed to
  62.    resemble a file system since a file system is a good model for
  63.    organizing documents and services; the user sees what amounts to one
  64.    big networked information system containing primarily document items,
  65.    directory items, and search items (the latter allowing searches for
  66.    documents across subsets of the information base).
  67.  
  68.    Servers return either directory lists or documents.  Each item in a
  69.    directory is identified by a type (the kind of object the item is),
  70.    user-visible name (used to browse and select from listings), an
  71.    opaque selector string (typically containing a pathname used by the
  72.    destination host to locate the desired object), a host name (which
  73.    host to contact to obtain this item), and an IP port number (the port
  74.    at which the server process listens for connections). The user only
  75.    sees the user-visible name.  The client software can locate and
  76.    retrieve any item by the trio of selector, hostname, and port.
  77.  
  78.    To use a search item, the client submits a query to a special kind of
  79.    Gopher server: a search server.  In this case, the client sends the
  80.    selector string (if any) and the list of words to be matched. The
  81.    response yields "virtual directory listings" that contain items
  82.    matching the search criteria.
  83.  
  84.    Gopher servers and clients exist for all popular platforms.  Because
  85.    the protocol is so sparse and simple, writing servers or clients is
  86.    quick and straightforward.
  87.  
  88. 1.  Introduction
  89.  
  90.    The Internet Gopher protocol is designed primarily to act as a
  91.    distributed document delivery system.  While documents (and services)
  92.    reside on many servers, Gopher client software presents users with a
  93.    hierarchy of items and directories much like a file system.  In fact,
  94.    the Gopher interface is designed to resemble a file system since a
  95.    file system is a good model for locating documents and services.  Why
  96.    model a campus-wide information system after a file system?  Several
  97.    reasons:
  98.  
  99.       (a) A hierarchical arrangement of information is familiar to many
  100.       users.  Hierarchical directories containing items (such as
  101.       documents, servers, and subdirectories) are widely used in
  102.       electronic bulletin boards and other campus-wide information
  103.       systems. People who access a campus-wide information server will
  104.       expect some sort of hierarchical organization to the information
  105.       presented.
  106.  
  107.  
  108.  
  109.  
  110. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 2]
  111.  
  112. RFC 1436                         Gopher                       March 1993
  113.  
  114.  
  115.       (b) A file-system style hierarchy can be expressed in a simple
  116.       syntax.  The syntax used for the internet Gopher protocol is
  117.       easily understandable, and was designed to make debugging servers
  118.       and clients easy.  You can use Telnet to simulate an internet
  119.       Gopher client's requests and observe the responses from a server.
  120.       Special purpose software tools are not required.  By keeping the
  121.       syntax of the pseudo-file system client/server protocol simple, we
  122.       can also achieve better performance for a very common user
  123.       activity: browsing through the directory hierarchy.
  124.  
  125.       (c) Since Gopher originated in a University setting, one of the
  126.       goals was for departments to have the option of publishing
  127.       information from their inexpensive desktop machines, and since
  128.       much of the information can be presented as simple text files
  129.       arranged in directories, a protocol modeled after a file system
  130.       has immediate utility.  Because there can be a direct mapping from
  131.       the file system on the user's desktop machine to the directory
  132.       structure published via the Gopher protocol, the problem of
  133.       writing server software for slow desktop systems is minimized.
  134.  
  135.       (d) A file system metaphor is extensible.  By giving a "type"
  136.       attribute to items in the pseudo-file system, it is possible to
  137.       accommodate documents other than simple text documents.  Complex
  138.       database services can be handled as a separate type of item.  A
  139.       file-system metaphor does not rule out search or database-style
  140.       queries for access to documents.  A search-server type is also
  141.       defined in this pseudo-file system.  Such servers return "virtual
  142.       directories" or list of documents matching user specified
  143.       criteria.
  144.  
  145. 2.  The internet Gopher Model
  146.  
  147.    A detailed BNF rendering of the internet Gopher syntax is available
  148.    in the appendix...but a close reading of the appendix may not be
  149.    necessary to understand the internet Gopher protocol.
  150.  
  151.    In essence, the Gopher protocol consists of a client connecting to a
  152.    server and sending the server a selector (a line of text, which may
  153.    be empty) via a TCP connection.  The server responds with a block of
  154.    text terminated with a period on a line by itself, and closes the
  155.    connection.  No state is retained by the server between transactions
  156.    with a client. The simple nature of the protocol stems from the need
  157.    to implement servers and clients for the slow, smaller desktop
  158.    computers (1 MB Macs and DOS machines), quickly, and efficiently.
  159.  
  160.    Below is a simple example of a client/server interaction; more
  161.    complex interactions are dealt with later.  Assume that a "well-
  162.    known" Gopher server (this may be duplicated, details are discussed
  163.  
  164.  
  165.  
  166. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 3]
  167.  
  168. RFC 1436                         Gopher                       March 1993
  169.  
  170.  
  171.    later) listens at a well known port for the campus (much like a
  172.    domain-name server).  The only configuration information the client
  173.    software retains is this server's name and port number (in this
  174.    example that machine is rawBits.micro.umn.edu and the port 70). In
  175.    the example below the F character denotes the TAB character.
  176.  
  177.  Client:          {Opens connection to rawBits.micro.umn.edu at port 70}
  178.  
  179.  Server:          {Accepts connection but says nothing}
  180.  
  181.  Client: <CR><LF> {Sends an empty line: Meaning "list what you have"}
  182.  
  183.  Server:          {Sends a series of lines, each ending with CR LF}
  184.  0About internet GopherFStuff:About usFrawBits.micro.umn.eduF70
  185.  1Around University of MinnesotaFZ,5692,AUMFunderdog.micro.umn.eduF70
  186.  1Microcomputer News & PricesFPrices/Fpserver.bookstore.umn.eduF70
  187.  1Courses, Schedules, CalendarsFFevents.ais.umn.eduF9120
  188.  1Student-Staff DirectoriesFFuinfo.ais.umn.eduF70
  189.  1Departmental PublicationsFStuff:DP:FrawBits.micro.umn.eduF70
  190.                     {.....etc.....}
  191.  .                  {Period on a line by itself}
  192.                     {Server closes connection}
  193.  
  194.  
  195.    The first character on each line tells whether the line describes a
  196.    document, directory, or search service (characters '0', '1', '7';
  197.    there are a handful more of these characters described later).  The
  198.    succeeding characters up to the tab form a user display string to be
  199.    shown to the user for use in selecting this document (or directory)
  200.    for retrieval.  The first character of the line is really defining
  201.    the type of item described on this line. In nearly every case, the
  202.    Gopher client software will give the users some sort of idea about
  203.    what type of item this is (by displaying an icon, a short text tag,
  204.    or the like).
  205.  
  206.    The characters following the tab, up to the next tab form a selector
  207.    string that the client software must send to the server to retrieve
  208.    the document (or directory listing).  The selector string should mean
  209.    nothing to the client software; it should never be modified by the
  210.    client.  In practice, the selector string is often a pathname or
  211.    other file selector used by the server to locate the item desired.
  212.    The next two tab delimited fields denote the domain-name of the host
  213.    that has this document (or directory), and the port at which to
  214.    connect.  If there are yet other tab delimited fields, the basic
  215.    Gopher client should ignore them.  A CR LF denotes the end of the
  216.    item.
  217.  
  218.  
  219.  
  220.  
  221.  
  222. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 4]
  223.  
  224. RFC 1436                         Gopher                       March 1993
  225.  
  226.  
  227.    In the example, line 1 describes a document the user will see as
  228.    "About internet Gopher".  To retrieve this document, the client
  229.    software must send the retrieval string: "Stuff:About us" to
  230.    rawBits.micro.umn.edu at port 70.  If the client does this, the
  231.    server will respond with the contents of the document, terminated by
  232.    a period on a line by itself.  A client might present the user with a
  233.    view of the world something like the following list of items:
  234.  
  235.  
  236.       About Internet Gopher
  237.       Around the University of Minnesota...
  238.       Microcomputer News & Prices...
  239.       Courses, Schedules, Calendars...
  240.       Student-Staff Directories...
  241.       Departmental Publications...
  242.  
  243.  
  244.  
  245.    In this case, directories are displayed with an ellipsis and files
  246.    are displayed without any.  However, depending on the platform the
  247.    client is written for and the author's taste, item types could be
  248.    denoted by other text tags or by icons.  For example, the UNIX
  249.    curses-based client displays directories with a slash (/) following
  250.    the name; Macintosh clients display directories alongside an icon of
  251.    a folder.
  252.  
  253.    The user does not know or care that the items up for selection may
  254.    reside on many different machines anywhere on the Internet.
  255.  
  256.    Suppose the user selects the line "Microcomputer News & Prices...".
  257.    This appears to be a directory, and so the user expects to see
  258.    contents of the directory upon request that it be fetched.  The
  259.    following lines illustrate the ensuing client-server interaction:
  260.  
  261.  
  262.     Client:           (Connects to pserver.bookstore.umn.edu at port 70)
  263.     Server:           (Accepts connection but says nothing)
  264.     Client: Prices/   (Sends the magic string terminated by CRLF)
  265.     Server:           (Sends a series of lines, each ending with CR LF)
  266.     0About PricesFPrices/AboutusFpserver.bookstore.umn.eduF70
  267.     0Macintosh PricesFPrices/MacFpserver.bookstore.umn.eduF70
  268.     0IBM PricesFPrices/IckFpserver.bookstore.umn.eduF70
  269.     0Printer & Peripheral PricesFPrices/PPPFpserver.bookstore.umn.eduF70
  270.                       (.....etc.....)
  271.     .                 (Period on a line by itself)
  272.                       (Server closes connection)
  273.  
  274.  
  275.  
  276.  
  277.  
  278. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 5]
  279.  
  280. RFC 1436                         Gopher                       March 1993
  281.  
  282.  
  283. 3. More details
  284.  
  285. 3.1  Locating services
  286.  
  287.    Documents (or other services that may be viewed ultimately as
  288.    documents, such as a student-staff phonebook) are linked to the
  289.    machine they are on by the trio of selector string, machine domain-
  290.    name, and IP port.  It is assumed that there will be one well-known
  291.    top-level or root server for an institution or campus.  The
  292.    information on this server may be duplicated by one or more other
  293.    servers to avoid a single point of failure and to spread the load
  294.    over several servers.  Departments that wish to put up their own
  295.    departmental servers need to register the machine name and port with
  296.    the administrators of the top-level Gopher server, much the same way
  297.    as they register a machine name with the campus domain-name server.
  298.    An entry which points to the departmental server will then be made at
  299.    the top level server.  This ensures that users will be able to
  300.    navigate their way down what amounts to a virtual hierarchical file
  301.    system with a well known root to any campus server if they desire.
  302.  
  303.    Note that there is no requirement that a department register
  304.    secondary servers with the central top-level server; they may just
  305.    place a link to the secondary servers in their own primary servers.
  306.    They may indeed place links to any servers they desire in their own
  307.    server, thus creating a customized view of thethe Gopher information
  308.    universe; links can of course point back at the top-level server.
  309.    The virtual (networked) file system is therefore an arbitrary graph
  310.    structure and not necessarily a rooted tree.  The top-level node is
  311.    merely one convenient, well-known point of entry.  A set of Gopher
  312.    servers linked in this manner may function as a campus-wide
  313.    information system.
  314.  
  315.    Servers may of course point links at other than secondary servers.
  316.    Indeed servers may point at other servers offering useful services
  317.    anywhere on the internet.  Viewed in this manner, Gopher can be seen
  318.    as an Internet-wide information system.
  319.  
  320. 3.2 Server portability and naming
  321.  
  322.    It is recommended that all registered servers have alias names
  323.    (domain name system CNAME) that are used by Gopher clients to locate
  324.    them.  Links to these servers should use these alias names rather
  325.    than the primary names.  If information needs to be moved from one
  326.    machine to another, a simple change of domain name system alias
  327.    (CNAME) allows this to occur without any reconfiguration of clients
  328.    in the field.  In short, the domain name system may be used to re-map
  329.    a server to a new address.  There is nothing to prevent secondary
  330.    servers or services from running on otherwise named servers or ports
  331.  
  332.  
  333.  
  334. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 6]
  335.  
  336. RFC 1436                         Gopher                       March 1993
  337.  
  338.  
  339.    other than 70, however these should be reachable via a primary
  340.    server.
  341.  
  342. 3.3 Contacting server administrators
  343.  
  344.    It is recommended that every server administrator have a document
  345.    called something like: "About Bogus University's Gopher server" as
  346.    the first item in their server's top level directory.  In this
  347.    document should be a short description of what the server holds, as
  348.    well as name, address, phone, and an e-mail address of the person who
  349.    administers the server.  This provides a way for users to get word to
  350.    the administrator of a server that has inaccurate information or is
  351.    not running correctly.  It is also recommended that administrators
  352.    place the date of last update in files for which such information
  353.    matters to the users.
  354.  
  355. 3.4  Modular addition of services
  356.  
  357.    The first character of each line in a server-supplied directory
  358.    listing indicates whether the item is a file (character '0'), a
  359.    directory (character '1'), or a search (character '7').  This is the
  360.    base set of item types in the Gopher protocol.  It is desirable for
  361.    clients to be able to use different services and speak different
  362.    protocols (simple ones such as finger; others such as CSO phonebook
  363.    service, or Telnet, or X.500 directory service) as needs dictate.
  364.    CSO phonebook service is a client/server phonebook system typically
  365.    used at Universities to publish names, e-mail addresses, and so on.
  366.    The CSO phonebook software was developed at the University of
  367.    Illinois and is also sometimes refered to as ph or qi.  For example,
  368.    if a server-supplied directory listing marks a certain item with type
  369.    character '2', then it means that to use this item, the client must
  370.    speak the CSO protocol.  This removes the need to be able to
  371.    anticipate all future needs and hard-wire them in the basic Internet
  372.    Gopher protocol; it keeps the basic protocol extremely simple.  In
  373.    spite of this simplicity, the scheme has the capability to expand and
  374.    change with the times by adding an agreed upon type-character for a
  375.    new service.  This also allows the client implementations to evolve
  376.    in a modular fashion, simply by dropping in a module (or launching a
  377.    new process) for some new service.  The servers for the new service
  378.    of course have to know nothing about Internet Gopher; they can just
  379.    be off-the shelf CSO, X.500, or other servers.  We do not however,
  380.    encourage arbitrary or machine-specific proliferation of service
  381.    types in the basic Gopher protocol.
  382.  
  383.    On the other hand, subsets of other document retrieval schemes may be
  384.    mapped onto the Gopher protocol by means of "gateway-servers".
  385.    Examples of such servers include Gopher-to-FTP gateways, Gopher-to-
  386.    archie gateways, Gopher-to-WAIS gateways, etc.  There are a number of
  387.  
  388.  
  389.  
  390. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 7]
  391.  
  392. RFC 1436                         Gopher                       March 1993
  393.  
  394.  
  395.    advantages of such mechanisms. First, a relatively powerful server
  396.    machine inherits both the intelligence and work, rather than the more
  397.    modest, inexpensive desktop system that typically runs client
  398.    software or basic server software.  Equally important, clients do not
  399.    have to be modified to take advantage of a new resource.
  400.  
  401. 3.5  Building clients
  402.  
  403.    A client simply sends the retrieval string to a server if it wants to
  404.    retrieve a document or view the contents of a directory.  Of course,
  405.    each host may have pointers to other hosts, resulting in a "graph"
  406.    (not necessarily a rooted tree) of hosts.  The client software may
  407.    save (or rather "stack") the locations that it has visited in search
  408.    of a document.  The user could therefore back out of the current
  409.    location by unwinding the stack.  Alternatively, a client with
  410.    multiple-window capability might just be able to display more than
  411.    one directory or document at the same time.
  412.  
  413.    A smart client could cache the contents of visited directories
  414.    (rather than just the directory's item descriptor), thus avoiding
  415.    network transactions if the information has been previously
  416.    retrieved.
  417.  
  418.    If a client does not understand what a say, type 'B' item (not a core
  419.    item) is, then it may simply ignore the item in the directory
  420.    listing; the user never even has to see it.  Alternatively, the item
  421.    could be displayed as an unknown type.
  422.  
  423.    Top-level or primary servers for a campus are likely to get more
  424.    traffic than secondary servers, and it would be less tolerable for
  425.    such primary servers to be down for any long time.  So it makes sense
  426.    to "clone" such important servers and construct clients that can
  427.    randomly choose between two such equivalent primary servers when they
  428.    first connect (to balance server load), moving to one if the other
  429.    seems to be down.  In fact, smart client implementations do this
  430.    clone server and load balancing.  Alternatively, it may make sense to
  431.    have the domain name system return one of a set of redundant of
  432.    server's IP address to load balance betwen redundant sets of
  433.    important servers.
  434.  
  435. 3.6  Building ordinary internet Gopher servers
  436.  
  437.    The retrieval string sent to the server might be a path to a file or
  438.    directory.  It might be the name of a script, an application or even
  439.    a query that generates the document or directory returned.  The basic
  440.    server uses the string it gets up to but not including a CR-LF or a
  441.    TAB, whichever comes first.
  442.  
  443.  
  444.  
  445.  
  446. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 8]
  447.  
  448. RFC 1436                         Gopher                       March 1993
  449.  
  450.  
  451.    All intelligence is carried by the server implementation rather than
  452.    the protocol.  What you build into more exotic servers is up to you.
  453.    Server implementations may grow as needs dictate and time allows.
  454.  
  455. 3.7  Special purpose servers
  456.  
  457.    There are two special server types (beyond the normal Gopher server)
  458.    also discussed below:
  459.  
  460.       1.  A server directory listing can point at a CSO nameserver (the
  461.       server returns a type character of '2') to allow a campus
  462.       student-staff phonebook lookup service.  This may show up on the
  463.       user's list of choices, perhaps preceded by the icon of a phone-
  464.       book.  If this item is selected, the client software must resort
  465.       to a pure CSO nameserver protocol when it connects to the
  466.       appropriate host.
  467.  
  468.       2.  A server can also point at a "search server" (returns a first
  469.       character of '7').  Such servers may implement campus network (or
  470.       subnet) wide searching capability.  The most common search servers
  471.       maintain full-text indexes on the contents of text documents held
  472.       by some subset of Gopher servers.  Such a "full-text search
  473.       server" responds to client requests with a list of all documents
  474.       that contain one or more words (the search criteria).  The client
  475.       sends the server the selector string, a tab, and the search string
  476.       (words to search for). If the selector string is empty, the client
  477.       merely sends the search string.  The server returns the equivalent
  478.       of a directory listing for documents matching the search criteria.
  479.       Spaces between words are usually implied Boolean ANDs (although in
  480.       different implementations or search types, this may not
  481.       necessarily be true).
  482.  
  483.    The CSO addition exists for historical reasons: at time of design,
  484.    the campus phone-book servers at the University of Minnesota used the
  485.    CSO protocol and it seemed simplest to just engulf them.  The index-
  486.    server is however very much a Gopher in spirit, albeit with a slight
  487.    twist in the meaning of the selector-string.  Index servers are a
  488.    natural place to incorperate gateways to WAIS and WHOIS services.
  489.  
  490. 3.7.1  Building CSO-servers
  491.  
  492.    A CSO Nameserver implementation for UNIX and associated documentation
  493.    is available by anonymous ftp from uxa.cso.uiuc.edu.  We do not
  494.    anticipate implementing it on other machines.
  495.  
  496.  
  497.  
  498.  
  499.  
  500.  
  501.  
  502. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti         [Page 9]
  503.  
  504. RFC 1436                         Gopher                       March 1993
  505.  
  506.  
  507. 3.7.2  Building full-text search servers
  508.  
  509.    A full-text search server is a special-purpose server that knows
  510.    about the Gopher scheme for retrieving documents.  These servers
  511.    maintain a full-text index of the contents of plain text documents on
  512.    Gopher servers in some specified domain.  A Gopher full-text search
  513.    server was implemented using several NeXTstations because it was easy
  514.    to take advantage of the full-text index/search engine built into the
  515.    NeXT system software.  A search server for generic UNIX systems based
  516.    on the public domain WAIS search engine, is also available and
  517.    currently an optional part of the UNIX gopher server.  In addition,
  518.    at least one implementation of the gopher server incorperates a
  519.    gateway to WAIS servers by presenting the WAIS servers to gopherspace
  520.    as full-text search servers.  The gopher<->WAIS gateway servers does
  521.    the work of translating from gopher protocol to WAIS so unmodified
  522.    gopher clients can access WAIS servers via the gateway server.
  523.  
  524.    By using several index servers (rather than a monolithic index
  525.    server) indexes may be searched in parallel (although the client
  526.    software is not aware of this).  While maintaining full-text indexes
  527.    of documents distributed over many machines may seem a daunting task,
  528.    the task can be broken into smaller pieces (update only a portion of
  529.    the indexes, search several partial indexes in parallel) so that it
  530.    is manageable.  By spreading this task over several small, cheap (and
  531.    fast) workstations it is possible to take advantage of fine-grain
  532.    parallelism.  Again, the client software is not aware of this. Client
  533.    software only needs to know that it can send a search string to an
  534.    index server and will receive a list of documents that contain the
  535.    words in the search string.
  536.  
  537. 3.8  Item type characters
  538.  
  539.    The client software decides what items are available by looking at
  540.    the first character of each line in a directory listing.  Augmenting
  541.    this list can extend the protocol.  A list of defined item-type
  542.    characters follows:
  543.  
  544.    0   Item is a file
  545.    1   Item is a directory
  546.    2   Item is a CSO phone-book server
  547.    3   Error
  548.    4   Item is a BinHexed Macintosh file.
  549.    5   Item is DOS binary archive of some sort.
  550.        Client must read until the TCP connection closes.  Beware.
  551.    6   Item is a UNIX uuencoded file.
  552.    7   Item is an Index-Search server.
  553.    8   Item points to a text-based telnet session.
  554.    9   Item is a binary file!
  555.  
  556.  
  557.  
  558. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 10]
  559.  
  560. RFC 1436                         Gopher                       March 1993
  561.  
  562.  
  563.        Client must read until the TCP connection closes.  Beware.
  564.    +   Item is a redundant server
  565.    T   Item points to a text-based tn3270 session.
  566.    g   Item is a GIF format graphics file.
  567.    I   Item is some kind of image file.  Client decides how to display.
  568.  
  569.    Characters '0' through 'Z' are reserved.  Local experiments should
  570.    use other characters.  Machine-specific extensions are not
  571.    encouraged.  Note that for type 5 or type 9 the client must be
  572.    prepared to read until the connection closes.  There will be no
  573.    period at the end of the file; the contents of these files are binary
  574.    and the client must decide what to do with them based perhaps on the
  575.    .xxx extension.
  576.  
  577. 3.9  User display strings and server selector strings
  578.  
  579.    User display strings are intended to be displayed on a line on a
  580.    typical screen for a user's viewing pleasure.  While many screens can
  581.    accommodate 80 character lines, some space is needed to display a tag
  582.    of some sort to tell the user what sort of item this is.  Because of
  583.    this, the user display string should be kept under 70 characters in
  584.    length.  Clients may truncate to a length convenient to them.
  585.  
  586. 4.   Simplicity is intentional
  587.  
  588.    As far as possible we desire any new features to be carried as new
  589.    protocols that will be hidden behind new document-types.  The
  590.    internet Gopher philosophy is:
  591.  
  592.       (a) Intelligence is held by the server.  Clients have the option
  593.       of being able to access new document types (different, other types
  594.       of servers) by simply recognizing the document-type character.
  595.       Further intelligence to be borne by the protocol should be
  596.       minimized.
  597.  
  598.       (b) The well-tempered server ought to send "text" (unless a file
  599.       must be transferred as raw binary).  Should this text include
  600.       tabs, formfeeds, frufru?  Probably not, but rude servers will
  601.       probably send them anyway.  Publishers of documents should be
  602.       given simple tools (filters) that will alert them if there are any
  603.       funny characters in the documents they wish to publish, and give
  604.       them the opportunity to strip the questionable characters out; the
  605.       publisher may well refuse.
  606.  
  607.       (c) The well-tempered client should do something reasonable with
  608.       funny characters received in text; filter them out, leave them in,
  609.       whatever.
  610.  
  611.  
  612.  
  613.  
  614. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 11]
  615.  
  616. RFC 1436                         Gopher                       March 1993
  617.  
  618.  
  619. Appendix
  620.  
  621.    Paul's NQBNF (Not Quite BNF) for the Gopher Protocol.
  622.  
  623.    Note:  This is modified BNF (as used by the Pascal people) with a few
  624.           English modifiers thrown in.  Stuff enclosed in '{}' can be
  625.           repeated zero or more times.  Stuff in '[]' denotes a set of
  626.           items.  The '-' operator denotes set subtraction.
  627.  
  628.  
  629. Directory Entity
  630.  
  631. CR-LF     ::= ASCII Carriage Return Character followed by Line Feed
  632.               character.
  633.  
  634. Tab       ::= ASCII Tab character.
  635.  
  636. NUL       ::= ASCII NUL character.
  637.  
  638. UNASCII   ::= ASCII - [Tab CR-LF NUL].
  639.  
  640. Lastline  ::= '.'CR-LF.
  641.  
  642. TextBlock ::= Block of ASCII text not containing Lastline pattern.
  643.  
  644. Type      ::= UNASCII.
  645.  
  646. RedType   ::= '+'.
  647.  
  648. User_Name ::= {UNASCII}.
  649.  
  650. Selector  ::= {UNASCII}.
  651.  
  652. Host      ::= {{UNASCII - ['.']} '.'} {UNASCII - ['.']}.
  653.  
  654. Note: This is a Fully Qualified Domain Name as defined in RFC 1034.
  655.       (e.g., gopher.micro.umn.edu)  Hosts that have a CR-LF
  656.       TAB or NUL in their name get what they deserve.
  657.  
  658. Digit     ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' .
  659.  
  660. DigitSeq  ::= digit {digit}.
  661.  
  662. Port      ::= DigitSeq.
  663.  
  664. Note: Port corresponds the the TCP Port Number, its value should
  665.       be in the range [0..65535]; port 70 is officially assigned
  666.       to gopher.
  667.  
  668.  
  669.  
  670. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 12]
  671.  
  672. RFC 1436                         Gopher                       March 1993
  673.  
  674.  
  675. DirEntity ::= Type User_Name Tab Selector Tab Host Tab Port CR-LF
  676.           {RedType User_Name Tab Selector Tab Host Tab Port CR-LF}
  677.  
  678.  
  679.  
  680. Notes:
  681.  
  682.    It is *highly* recommended that the User_Name field contain only
  683.    printable characters, since many different clients will be using
  684.    it.  However if eight bit characters are used, the characters
  685.    should conform with the ISO Latin1 Character Set.  The length of
  686.    the User displayable line should be less than 70 Characters; longer
  687.    lines may not fit across some screens.
  688.  
  689.    The Selector string should be no longer than 255 characters.
  690.  
  691.  
  692. Menu Entity
  693.  
  694. Menu      ::= {DirEntity} Lastline.
  695.  
  696.  
  697. Menu Transaction  (Type 1 item)
  698.  
  699. C: Opens Connection
  700. S: Accepts Connection
  701. C: Sends Selector String
  702. S: Sends Menu Entity
  703.  
  704.    Connection is closed by either client or server (typically server).
  705.  
  706.  
  707. Textfile Entity
  708.  
  709. TextFile  ::= {TextBlock} Lastline
  710.  
  711. Note:  Lines beginning with periods must be prepended with an extra
  712.      period to ensure that the transmission is not terminated early.
  713.      The client should strip extra periods at the beginning of the line.
  714.  
  715.  
  716. TextFile Transaction (Type 0 item)
  717.  
  718. C: Opens Connection.
  719. S: Accepts connection
  720. C: Sends Selector String.
  721. S: Sends TextFile Entity.
  722.  
  723.  
  724.  
  725.  
  726. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 13]
  727.  
  728. RFC 1436                         Gopher                       March 1993
  729.  
  730.  
  731.    Connection is closed by either client or server (typically server).
  732.  
  733. Note:  The client should be prepared for the server closing the
  734.        connection without sending the Lastline.  This allows the
  735.        client to use fingerd servers.
  736.  
  737.  
  738. Full-Text Search Transaction (Type 7 item)
  739.  
  740. Word      ::= {UNASCII - ' '}
  741. BoolOp ::= 'and' | 'or' | 'not' | SPACE
  742. SearchStr ::= Word {{SPACE BoolOp} SPACE Word}
  743.  
  744. C: Opens Connection.
  745. C: Sends Selector String, Tab, Search String.
  746. S: Sends Menu Entity.
  747.  
  748. Note:  In absence of 'and', 'or', or 'not' operators, a SPACE is
  749.        regarded as an implied 'and' operator.  Expression is evaluated
  750.        left to right.  Further, not all search engines or search
  751.        gateways currently implemented have the boolean operators
  752.        implemented.
  753.  
  754. Binary file Transaction (Type 9 or 5 item)
  755.  
  756. C: Opens Connection.
  757. S: Accepts connection
  758. C: Sends Selector String.
  759. S: Sends a binary file and closes connection when done.
  760.  
  761.  
  762. Syntactic Meaning for Directory Entities
  763.  
  764.  
  765. The client should interpret the type field as follows:
  766.  
  767. 0   The item is a TextFile Entity.
  768.     Client should use a TextFile Transaction.
  769.  
  770. 1   The item is a Menu Entity.
  771.     Client should use a Menu Transaction.
  772.  
  773. 2   The information applies to a CSO phone book entity.
  774.     Client should talk CSO protocol.
  775.  
  776. 3   Signals an error condition.
  777.  
  778. 4   Item is a Macintosh file encoded in BINHEX format
  779.  
  780.  
  781.  
  782. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 14]
  783.  
  784. RFC 1436                         Gopher                       March 1993
  785.  
  786.  
  787. 5   Item is PC-DOS binary file of some sort.  Client gets to decide.
  788.  
  789. 6   Item is a uuencoded file.
  790.  
  791. 7   The information applies to a Index Server.
  792.     Client should use a FullText Search transaction.
  793.  
  794. 8   The information applies to a Telnet session.
  795.     Connect to given host at given port. The name to login as at this
  796.     host is in the selector string.
  797.  
  798. 9   Item is a binary file.  Client must decide what to do with it.
  799.  
  800. +   The information applies to a duplicated server.  The information
  801.     contained within is a duplicate of the primary server.  The primary
  802.     server is defined as the last DirEntity that is has a non-plus
  803.     "Type" field.  The client should use the transaction as defined by
  804.     the primary server Type field.
  805.  
  806. g   Item is a GIF graphic file.
  807.  
  808. I   Item is some kind of image file.  Client gets to decide.
  809.  
  810. T   The information applies to a tn3270 based telnet session.
  811.     Connect to given host at given port. The name to login as at this
  812.     host is in the selector string.
  813.  
  814. Security Considerations
  815.  
  816.    Security issues are not discussed in this memo.
  817.  
  818. Authors' Addresses
  819.  
  820.    Farhad Anklesaria
  821.    Computer and Information Services, University of Minnesota
  822.    Room 152 Shepherd Labs
  823.    100 Union Street SE
  824.    Minneapolis, MN 55455
  825.  
  826.    Phone: (612) 625 1300
  827.    EMail: fxa@boombox.micro.umn.edu
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 15]
  839.  
  840. RFC 1436                         Gopher                       March 1993
  841.  
  842.  
  843.    Mark McCahill
  844.    Computer and Information Services, University of Minnesota
  845.    Room 152 Shepherd Labs
  846.    100 Union Street SE
  847.    Minneapolis, MN 55455
  848.  
  849.    Phone: (612) 625 1300
  850.    EMail: mpm@boombox.micro.umn.edu
  851.  
  852.  
  853.    Paul Lindner
  854.    Computer and Information Services, University of Minnesota
  855.    Room 152 Shepherd Labs
  856.    100 Union Street SE
  857.    Minneapolis, MN 55455
  858.  
  859.    Phone: (612) 625 1300
  860.    EMail: lindner@boombox.micro.umn.edu
  861.  
  862.  
  863.    David Johnson
  864.    Computer and Information Services, University of Minnesota
  865.    Room 152 Shepherd Labs
  866.    100 Union Street SE
  867.    Minneapolis, MN 55455
  868.  
  869.    Phone: (612) 625 1300
  870.    EMail: dmj@boombox.micro.umn.edu
  871.  
  872.  
  873.    Daniel Torrey
  874.    Computer and Information Services, University of Minnesota
  875.    Room 152 Shepherd Labs
  876.    100 Union Street SE
  877.    Minneapolis, MN 55455
  878.  
  879.    Phone: (612) 625 1300
  880.    EMail: daniel@boombox.micro.umn.edu
  881.  
  882.  
  883.    Bob Alberti
  884.    Computer and Information Services, University of Minnesota
  885.    Room 152 Shepherd Labs
  886.    100 Union Street SE
  887.    Minneapolis, MN 55455
  888.  
  889.    Phone: (612) 625 1300
  890.    EMail: alberti@boombox.micro.umn.edu
  891.  
  892.  
  893.  
  894. Anklesari, McCahill, Lindner, Johnson, Torrey & Alberti        [Page 16]
  895.  
  896.