36 lines · 1.5 KB · TeX
RawDownload
\section{\module{gopherlib} ---         Gopher protocol client} \declaremodule{standard}{gopherlib}\modulesynopsis{Gopher protocol client (requires sockets).} \deprecated{2.5}{The \code{gopher} protocol is not in active use                 anymore.} \indexii{Gopher}{protocol} This module provides a minimal implementation of client side of theGopher protocol.  It is used by the module \refmodule{urllib} tohandle URLs that use the Gopher protocol. The module defines the following functions: \begin{funcdesc}{send_selector}{selector, host\optional{, port}}Send a \var{selector} string to the gopher server at \var{host} and\var{port} (default \code{70}).  Returns an open file object fromwhich the returned document can be read.\end{funcdesc} \begin{funcdesc}{send_query}{selector, query, host\optional{, port}}Send a \var{selector} string and a \var{query} string to a gopherserver at \var{host} and \var{port} (default \code{70}).  Returns anopen file object from which the returned document can be read.\end{funcdesc} Note that the data returned by the Gopher server can be of any type,depending on the first character of the selector string.  If the datais text (first character of the selector is \samp{0}), lines areterminated by CRLF, and the data is terminated by a line consisting ofa single \samp{.}, and a leading \samp{.} should be stripped fromlines that begin with \samp{..}.  Directory listings (first characterof the selector is \samp{1}) are transferred using the same protocol.