1998-08-10 19:42:37 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\section{\module{gopherlib} ---
							 | 
						
					
						
							
								
									
										
										
										
											1999-04-22 16:17:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								         Gopher protocol client}
							 | 
						
					
						
							
								
									
										
										
										
											1998-07-23 17:59:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1999-04-22 16:17:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\declaremodule{standard}{gopherlib}
							 | 
						
					
						
							
								
									
										
										
										
											1998-07-23 17:59:49 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\modulesynopsis{Gopher protocol client (requires sockets).}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-07 13:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\indexii{Gopher}{protocol}
							 | 
						
					
						
							
								
									
										
										
										
											1995-02-28 17:14:32 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								This module provides a minimal implementation of client side of the
							 | 
						
					
						
							
								
									
										
										
										
											1999-04-22 16:17:45 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								the Gopher protocol.  It is used by the module \refmodule{urllib} to
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								handle URLs that use the Gopher protocol.
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								The module defines the following functions:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-07 13:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\begin{funcdesc}{send_selector}{selector, host\optional{, port}}
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Send a \var{selector} string to the gopher server at \var{host} and
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-07 13:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\var{port} (default \code{70}).  Returns an open file object from
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								which the returned document can be read.
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\end{funcdesc}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-07 13:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\begin{funcdesc}{send_query}{selector, query, host\optional{, port}}
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								Send a \var{selector} string and a \var{query} string to a gopher
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-07 13:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								server at \var{host} and \var{port} (default \code{70}).  Returns an
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								open file object from which the returned document can be read.
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								\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 data
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								is text (first character of the selector is \samp{0}), lines are
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								terminated by CRLF, and the data is terminated by a line consisting of
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								a single \samp{.}, and a leading \samp{.} should be stripped from
							 | 
						
					
						
							
								
									
										
										
										
											1998-01-07 13:17:20 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								lines that begin with \samp{..}.  Directory listings (first character
							 | 
						
					
						
							
								
									
										
										
										
											1995-03-22 15:48:46 +00:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								of the selector is \samp{1}) are transferred using the same protocol.
							 |