nsIIOService
| IID: | bddeda3f-9020-4d12-8c70-984ee9f7935e |
| Inherits From: | nsISupports |
| Status: | FROZEN |
nsIIOService provides a set of network utility functions. This interface duplicates many of the nsIProtocolHandler methods in a protocol handler independent way (e.g., NewURI inspects the scheme in order to delegate creation of the new URI to the appropriate protocol handler). nsIIOService also provides a set of URL parsing utility functions. These are provided as a convenience to the programmer and in some cases to improve performance by eliminating intermediate data structures and interfaces.
This interface is intended to be used as a service. To create an object implementing this interface:
var obj = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);This interface is implemented by the following components:
Properties
PRBool offline
Returns true if networking is in "offline" mode. When in offline mode, attempts to access the network will fail (although this does not necessarily correlate with whether there is actually a network available -- that's hard to detect without causing the dialer to come up).
Changing this fires observer notifications ... see below.
Methods
PRBool allowPort ( PRInt32 port , char* scheme )
ACString extractScheme ( AUTF8String urlString )
PRUint32 getProtocolFlags ( char* scheme )
nsIProtocolHandler getProtocolHandler ( char* scheme )
nsIChannel newChannel ( AUTF8String spec , char* originCharset , nsIURI baseURI )
nsIChannel newChannelFromURI ( nsIURI URI )
nsIURI newFileURI ( nsIFile file )
nsIURI newURI ( AUTF8String spec , char* originCharset , nsIURI baseURI )
PRBool allowPort ( PRInt32 port , char* scheme )
Checks if a port number is banned. This involves consulting a list of unsafe ports, corresponding to network services that may be easily exploitable. If the given port is considered unsafe, then the protocol handler (corresponding to scheme) will be asked whether it wishes to override the IO service's decision to block the port. This gives the protocol handler ultimate control over its own security policy while ensuring reasonable, default protection.
- Arguments:
- port
- scheme
ACString extractScheme ( AUTF8String urlString )
Utility to extract the scheme from a URL string, consistently and according to spec (see RFC 2396).
NOTE: Most URL parsing is done via nsIURI, and in fact the scheme can also be extracted from a URL string via nsIURI. This method is provided purely as an optimization.
- Arguments:
- urlString
- Returns:
- URL scheme
PRUint32 getProtocolFlags ( char* scheme )
Returns the protocol flags for a given scheme.
- Arguments:
- scheme: the URI scheme
- Returns:
- nsIProtocolHandler::protocolFlags
nsIProtocolHandler getProtocolHandler ( char* scheme )
Returns a protocol handler for a given URI scheme.
- Arguments:
- scheme: the URI scheme
- Returns:
- nsIProtocolHandler
nsIChannel newChannel ( AUTF8String spec , char* originCharset , nsIURI baseURI )
Equivalent to newChannelFromURI(newURI(...))
- Arguments:
- spec
- originCharset
- baseURI
nsIChannel newChannelFromURI ( nsIURI URI )
Creates a channel for a given URI.
- Arguments:
- URI: nsIURI from which to make a channel
- Returns:
- nsIChannel object
nsIURI newFileURI ( nsIFile file )
This method constructs a new URI from a nsIFile.
- Arguments:
- file: specifies the file path
- Returns:
- nsIURI object
nsIURI newURI ( AUTF8String spec , char* originCharset , nsIURI baseURI )
This method constructs a new URI by determining the scheme of the URI spec, and then delegating the construction of the URI to the protocol handler for that scheme. QueryInterface can be used on the resulting URI object to obtain a more specific type of URI.
- Arguments:
- spec
- originCharset
- baseURI
Reference documentation is generated from Mozilla's source.
