The ihURL module provides a standard interface to the host browser's URL transactions and other network operations. Its primary interface is through a set of classes that provide various types of services based on standard URL strings. In addition, some global symbols common to many of the classes are also available.
URL_FINISHED
URL_INCOMPLETE
URL_INTERACTIVE
These three symbols define the status codes which an existing URL class may be in. And, yes, there is no error state yet...
URLClosedError
This exception is raised when an I/O operation is attempted
on a URL that has been closed. (E.g., its
Destroy()
method has been called.)
ImplementationError
This exception is raised when a method in an abstract
class (e.g., the LineURL
class) is called, but the
method must be implemented by a subclass and has not been.
SecurityError
This exception is raised when some kind of insecure URL
access is attempted, for example trying to open a "file:
"
URL.
GetHostName()
string
representing the
network name of the machine the program is running under.
GeHostByName(name)
string
representing the
network IP address (in the nnn.nnn.nnn.nnn
numeric dot
form) of the given machine name.
There are no global types defined by this module.
RawURL
This is the base-class of all URL classes. It defines the basic operations which may be done on a URL, retrieval of URL data and status information, and the active methods that sub-classes may override to interact with a URL.
LineURL
.
Document
under which
the program
desiring to retrieve this URL is running.
string
representing the URL
to be retrieved. This may be a partial URL
(e.g. "graphic.gif
"), which will be
interpreted as being relative to the base URL of the
given document. See below for details on how
different URLs are handled.
RawURL
class, the caller must supply
a standard URL identifier and the
Document
in which it is running. The appropriate action will then be
performed to retrieve the given URL. Control is returned back
to the caller while the retrieval is in progress, with
appropriate methods within this class called when data is
ready.
The primary determining factor for what happens when this class is instantiated is the given URL string; this may be most of the more popular URL identifiers, along with special types intended to be useful primarily for internal program use. See the class description below for more detailed information.
string
containing the available
data.
Note that this base-class's OnRead()
method must be called by any subclass that overrides
it,
in order for this class to maintain correct state
information.
Warning: This method may be
called at any time. In particular, any time an asynchronous
URL request is not supported, it will likely be called with
the complete URL data before the
__init__
method has returned.
string
containing the data to send.
OnError()
method.
string
representing the actual URL being requested. This is the URL
as given to __init__()
, expanded to a
fully-qualified URL string.
string
representing
the URL of the object.
string
containing
the value of this header.
Content-type
, and the returned value is a
string
representing the returned
header line, or None
if it was not
supplied.
Note: the current implementation of iHTML does
not get this header information from HTTP requests; it just
always supplies one header line of Content-type:
application/ihtml;language=python
.
This class has no publically defined members.
This is the core class used to retrieve URL data. Most of its
specific handling of URLs is performed back in the browser itself, and thus
depends on the browser's capabilities. In the case of the Mosaic
implementation, this provides access to most of the expected types of URLs
-- http:
, ftp:
, etc. For these types of URLs,
the expected behavior of returning the data associated with the given URL
is provided. The behavior for other URLs such as news
: and
gopher:
has not yet been defined.
In addition to the standard URLs mentioned above, the iHTML library
itself defines a new URL named "tcp:
". This URL provides
low-level interactive access to a network; it essentially encapsulates the
basic socket implementation into the same interface as all other
higher-level network operations.
The complete syntax of this URL is
"tcp://machine:port/
". Much like
other similarly constructed URLs, most of these fields are optional. The
meanings of them are as follows:
flapjack.cs.orst.edu
or 128.193.38.74
.
Currently, only the fully qualified form, including both the machine
name and port, is understood. This construct results in an interactive
session
being created with a server at the specified remote machine; it is
essentially the equivalent of a socket connect()
call.
In the future, additional forms of this URL will be added. Some of these will include:
tcp://port/
tcp:port/
LineURL
An abstract class which provides line-structured access to a URL.
RawURL
list
of the
lines which have arrived. Every element of the list
is a string
, containing one
line. The strings are not terminated by a
new-line or carriage return character.
OnRead()
method is overridden by this class, and it is used to buffer
data until one or more complete lines are available. At that
point, this method is called to hand the lines off to the
superclass.
This class has no publically defined members.
Dianne Kyra Hackborn <hackbod@angryredplanet.com> | Last modified: Fri Sep 13 06:13:27 PDT 1996 |