blob: e94e1f9c6c8c2174ec34ff5e3b4774e30272ffd7 [file] [log] [blame]
Guido van Rossum470be141995-03-17 16:07:09 +00001\section{Standard Module \sectcode{gopherlib}}
Guido van Rossuma12ef941995-02-27 17:53:25 +00002\stmodindex{gopherlib}
Guido van Rossum86751151995-02-28 17:14:32 +00003
4\renewcommand{\indexsubitem}{(in module gopherlib)}
5
Guido van Rossumcca8d2b1995-03-22 15:48:46 +00006This module provides a minimal implementation of client side of the
7the Gopher protocol. It is used by the module \code{urllib} to handle
8URLs that use the Gopher protocol.
9
10The module defines the following functions:
11
12\begin{funcdesc}{send_selector}{selector\, host\optional{\, port}}
13Send a \var{selector} string to the gopher server at \var{host} and
14\var{port} (default 70). Return an open file object from which the
15returned document can be read.
16\end{funcdesc}
17
18\begin{funcdesc}{send_query}{selector\, query\, host\optional{\, port}}
19Send a \var{selector} string and a \var{query} string to a gopher
20server at \var{host} and \var{port} (default 70). Return an open file
21object from which the returned document can be read.
22\end{funcdesc}
23
24Note that the data returned by the Gopher server can be of any type,
25depending on the first character of the selector string. If the data
26is text (first character of the selector is \samp{0}), lines are
27terminated by CRLF, and the data is terminated by a line consisting of
28a single \samp{.}, and a leading \samp{.} should be stripped from
29lines that begin with \samp{..}. Directory listings (first charactger
30of the selector is \samp{1}) are transferred using the same protocol.