@mozilla.org/network/input-stream-channel;1

This component implements the following interfaces:

Constants

Set (e.g., by the docshell) to indicate whether or not the channel corresponds to a document URI.
PRUint32 nsIChannel.LOAD_DOCUMENT_URI = 65536
If the end consumer for this load has been retargeted after discovering it's content, this flag will be set:
PRUint32 nsIChannel.LOAD_RETARGETED_DOCUMENT_URI = 131072
This flag is set to indicate that onStopRequest may be followed by another onStartRequest/onStopRequest pair. This flag is, for example, used by the multipart/replace stream converter.
PRUint32 nsIChannel.LOAD_REPLACE = 262144
Set (e.g., by the docshell) to indicate whether or not the channel corresponds to an initial document URI load (e.g., link click).
PRUint32 nsIChannel.LOAD_INITIAL_DOCUMENT_URI = 524288
Set (e.g., by the URILoader) to indicate whether or not the end consumer for this load has been determined.
PRUint32 nsIChannel.LOAD_TARGETED = 1048576
No special load flags:
PRUint32 nsIRequest.LOAD_NORMAL = 0
Don't deliver status notifications to the nsIProgressEventSink, or keep this load from completing the nsILoadGroup it may belong to.
PRUint32 nsIRequest.LOAD_BACKGROUND = 1
This flag prevents caching of any kind. It does not, however, prevent cached content from being used to satisfy this request.
PRUint32 nsIRequest.INHIBIT_CACHING = 128
This flag prevents caching on disk (or other persistent media), which may be needed to preserve privacy. For HTTPS, this flag is set auto- matically.
PRUint32 nsIRequest.INHIBIT_PERSISTENT_CACHING = 256
Force an end-to-end download of content data from the origin server. This flag is used for a shift-reload.
PRUint32 nsIRequest.LOAD_BYPASS_CACHE = 512
Load from the cache, bypassing protocol specific validation logic. This flag is used when browsing via history. It is not recommended for normal browsing as it may likely violate reasonable assumptions made by the server and confuse users.
PRUint32 nsIRequest.LOAD_FROM_CACHE = 1024
The following flags control the frequency of cached content validation when neither LOAD_BYPASS_CACHE or LOAD_FROM_CACHE are set. By default, cached content is automatically validated if necessary before reuse.

VALIDATE_ALWAYS forces validation of any cached content independent of its expiration time.

VALIDATE_NEVER disables validation of expired content.

VALIDATE_ONCE_PER_SESSION disables validation of expired content, provided it has already been validated (at least once) since the start of this session.

NOTE TO IMPLEMENTORS: These flags are intended for normal browsing, and they should therefore not apply to content that must be validated before each use. Consider, for example, a HTTP response with a "Cache-control: no-cache" header. According to RFC2616, this response must be validated before it can be taken from a cache. Breaking this requirement could result in incorrect and potentially undesirable side-effects.

PRUint32 nsIRequest.VALIDATE_ALWAYS = 2048
PRUint32 nsIRequest.VALIDATE_NEVER = 4096
PRUint32 nsIRequest.VALIDATE_ONCE_PER_SESSION = 8192

Properties

ACString nsIChannel.contentCharset

The character set of the channel's content if available and if applicable. This attribute only applies to textual data.

The value of the contentCharset attribute is a mixedcase string.

PRInt32 nsIChannel.contentLength

The length of the data associated with the channel if available. A value of -1 indicates that the content length is unknown.

Callers should prefer getting the "content-length" property as 64-bit value by QIing the channel to nsIPropertyBag2, if that interface is exposed by the channel.

nsIInputStream nsIInputStreamChannel.contentStream

Get/set the content stream

This stream contains the data that will be pushed to the channel's stream listener. If the stream is non-blocking and supports the nsIAsyncInputStream interface, then the stream will be read directly. Otherwise, the stream will be read on a background thread.

This attribute can only be changed before the channel is opened.

ACString nsIChannel.contentType

The MIME type of the channel's content if available.

NOTE: the content type can often be wrongly specified (e.g., wrong file extension, wrong MIME type, wrong document type stored on a server, etc.), and the caller most likely wants to verify with the actual data.

Setting contentType before the channel has been opened provides a hint to the channel as to what the MIME type is. The channel may ignore this hint in deciding on the actual MIME type that it will report.

Setting contentType after onStartRequest has been fired or after open() is called will override the type determined by the channel.

Setting contentType between the time that asyncOpen() is called and the time when onStartRequest is fired has undefined behavior at this time.

The value of the contentType attribute is a lowercase string. A value assigned to this attribute will be parsed and normalized as follows: 1- any parameters (delimited with a ';') will be stripped. 2- if a charset parameter is given, then its value will replace the the contentCharset attribute of the channel. 3- the stripped contentType will be lowercased. Any implementation of nsIChannel must follow these rules.

nsLoadFlags nsIRequest.loadFlags

The load flags of this request. Bits 0-15 are reserved.

When added to a load group, this request's load flags are merged with the load flags of the load group.

nsILoadGroup nsIRequest.loadGroup

The load group of this request. While pending, the request is a member of the load group. It is the responsibility of the request to implement this policy.

readonly AUTF8String nsIRequest.name

The name of the request. Often this is the URI of the request.

nsIInterfaceRequestor nsIChannel.notificationCallbacks

The notification callbacks for the channel. This is set by clients, who wish to provide a means to receive progress, status and protocol-specific notifications. If this value is NULL, the channel implementation may use the notification callbacks from its load group. The channel may also query the notification callbacks from its load group if its notification callbacks do not supply the requested interface.

Interfaces commonly requested include: nsIProgressEventSink, nsIPrompt, and nsIAuthPrompt.

When the channel is done, it must not continue holding references to this object.

NOTE: A channel implementation should take care when "caching" an interface pointer queried from its notification callbacks. If the notification callbacks are changed, then a cached interface pointer may become invalid and may therefore need to be re-queried.

nsIURI nsIChannel.originalURI

The original URI used to construct the channel. This is used in the case of a redirect or URI "resolution" (e.g. resolving a resource: URI to a file: URI) so that the original pre-redirect URI can still be obtained.

NOTE: this is distinctly different from the http Referer (referring URI), which is typically the page that contained the original URI (accessible from nsIHttpChannel).

nsISupports nsIChannel.owner

The owner, corresponding to the entity that is responsible for this channel. Used by the security manager to grant or deny privileges to mobile code loaded from this channel.

NOTE: this is a strong reference to the owner, so if the owner is also holding a strong reference to the channel, care must be taken to explicitly drop its reference to the channel.

readonly nsISupports nsIChannel.securityInfo

Transport-level security information (if any) corresponding to the channel.

readonly nsresult nsIRequest.status

The error status associated with the request.

readonly nsIURI nsIChannel.URI

The URI corresponding to the channel. Its value is immutable.

Methods

InterfaceMethod
nsIChannel void asyncOpen ( nsIStreamListener listener , nsISupports context )
nsIRequest void cancel ( nsresult status )
nsIRequest PRBool isPending ( )
nsIStreamListener void onDataAvailable ( nsIRequest request , nsISupports context , nsIInputStream inputStream , PRUint32 offset , PRUint32 count )
nsIRequestObserver void onStartRequest ( nsIRequest request , nsISupports context )
nsIRequestObserver void onStopRequest ( nsIRequest request , nsISupports context , nsresult statusCode )
nsIChannel nsIInputStream open ( )
nsIRequest void resume ( )
nsIInputStreamChannel void setURI ( nsIURI URI )
nsIRequest void suspend ( )

Reference documentation is generated from Mozilla's source.