2001-09-28 20:14:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
1999-06-07 21:33:30 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
1999-06-07 21:33:30 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
1999-06-07 21:33:30 +00:00
|
|
|
*
|
1999-11-06 03:40:37 +00:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 03:40:37 +00:00
|
|
|
*
|
2001-09-28 20:14:13 +00:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-06-07 21:33:30 +00:00
|
|
|
|
1999-06-12 02:53:21 +00:00
|
|
|
#include "nsIRequest.idl"
|
1999-06-07 21:33:30 +00:00
|
|
|
|
|
|
|
interface nsIURI;
|
2001-04-10 06:01:08 +00:00
|
|
|
interface nsIInterfaceRequestor;
|
1999-06-07 21:33:30 +00:00
|
|
|
interface nsIInputStream;
|
|
|
|
interface nsIStreamListener;
|
1999-07-01 19:30:20 +00:00
|
|
|
|
1999-06-07 21:33:30 +00:00
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* The nsIChannel interface allows clients to construct "GET" requests for
|
|
|
|
* specific protocols, and manage them in a uniform way. Once a channel is
|
|
|
|
* created (via nsIIOService::newChannel), parameters for that request may
|
|
|
|
* be set by using the channel attributes, or by QI'ing to a subclass of
|
|
|
|
* nsIChannel for protocol-specific parameters. Then, the URI can be fetched
|
|
|
|
* by calling nsIChannel::open or nsIChannel::asyncOpen.
|
2000-03-29 03:58:50 +00:00
|
|
|
*
|
2002-03-20 22:50:33 +00:00
|
|
|
* After a request has been completed, the channel is still valid for accessing
|
|
|
|
* protocol-specific results. For example, QI'ing to nsIHttpChannel allows
|
|
|
|
* response headers to be retrieved for the corresponding http transaction.
|
|
|
|
*
|
2002-05-03 07:49:43 +00:00
|
|
|
* @status FROZEN
|
1999-06-07 21:33:30 +00:00
|
|
|
*/
|
2002-05-03 07:49:43 +00:00
|
|
|
[scriptable, uuid(c63a055a-a676-4e71-bf3c-6cfa11082018)]
|
1999-06-12 02:53:21 +00:00
|
|
|
interface nsIChannel : nsIRequest
|
1999-06-07 21:33:30 +00:00
|
|
|
{
|
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* 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.
|
2000-03-29 03:58:50 +00:00
|
|
|
*
|
2002-03-20 22:50:33 +00:00
|
|
|
* NOTE: this is distinctly different from the http Referer (referring URI),
|
|
|
|
* which is typically the page that contained the original URI (accessible
|
|
|
|
* from nsIHttpChannel).
|
1999-10-26 09:16:24 +00:00
|
|
|
*/
|
2000-03-29 03:58:50 +00:00
|
|
|
attribute nsIURI originalURI;
|
1999-06-07 21:33:30 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* The URI corresponding to the channel. Its value is immutable.
|
1999-06-07 21:33:30 +00:00
|
|
|
*/
|
2001-04-10 06:01:08 +00:00
|
|
|
readonly attribute nsIURI URI;
|
1999-06-07 21:33:30 +00:00
|
|
|
|
1999-08-29 21:58:42 +00:00
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* 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.
|
2000-03-29 03:58:50 +00:00
|
|
|
*
|
2002-03-20 22:50:33 +00:00
|
|
|
* 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.
|
1999-08-29 21:58:42 +00:00
|
|
|
*/
|
1999-10-06 08:26:01 +00:00
|
|
|
attribute nsISupports owner;
|
1999-08-29 21:58:42 +00:00
|
|
|
|
1999-11-17 08:14:52 +00:00
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* Interfaces commonly requested include: nsIProgressEventSink, nsIPrompt,
|
|
|
|
* and nsIAuthPrompt.
|
1999-11-17 08:14:52 +00:00
|
|
|
*/
|
1999-11-18 07:36:41 +00:00
|
|
|
attribute nsIInterfaceRequestor notificationCallbacks;
|
1999-07-31 06:53:12 +00:00
|
|
|
|
2001-02-21 20:38:08 +00:00
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* Transport-level security information (if any) corresponding to the channel.
|
2000-03-17 22:06:32 +00:00
|
|
|
*/
|
|
|
|
readonly attribute nsISupports securityInfo;
|
|
|
|
|
2000-03-29 03:58:50 +00:00
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* 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.),
|
2003-06-23 21:00:46 +00:00
|
|
|
* 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.
|
2003-07-08 22:04:32 +00:00
|
|
|
*
|
2003-07-08 22:43:51 +00:00
|
|
|
* 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.
|
2000-03-29 03:58:50 +00:00
|
|
|
*/
|
2002-03-20 22:50:33 +00:00
|
|
|
attribute ACString contentType;
|
2000-03-29 03:58:50 +00:00
|
|
|
|
|
|
|
/**
|
2002-03-20 22:50:33 +00:00
|
|
|
* The character set of the channel's content if available and if applicable.
|
|
|
|
* This attribute only applies to textual data.
|
2003-07-08 22:04:32 +00:00
|
|
|
*
|
|
|
|
* The value of the contentCharset attribute is a mixedcase string.
|
2002-03-20 22:50:33 +00:00
|
|
|
*/
|
|
|
|
attribute ACString contentCharset;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The length of the data associated with the channel if available. A value
|
|
|
|
* of -1 indicates that the content length is unknown.
|
2000-03-29 03:58:50 +00:00
|
|
|
*/
|
2001-02-21 20:38:08 +00:00
|
|
|
attribute long contentLength;
|
2000-03-29 03:58:50 +00:00
|
|
|
|
|
|
|
/**
|
2002-05-03 07:49:43 +00:00
|
|
|
* Synchronously open the channel.
|
2002-03-20 22:50:33 +00:00
|
|
|
*
|
|
|
|
* @return blocking input stream to the channel's data.
|
2002-05-03 07:49:43 +00:00
|
|
|
*
|
|
|
|
* NOTE: nsIChannel implementations are not required to implement this
|
|
|
|
* method. Moreover, since this method may block the calling thread, it
|
|
|
|
* should not be called on a thread that processes UI events.
|
2000-03-29 03:58:50 +00:00
|
|
|
*/
|
2001-04-10 06:01:08 +00:00
|
|
|
nsIInputStream open();
|
2000-03-29 03:58:50 +00:00
|
|
|
|
|
|
|
/**
|
2001-04-10 06:01:08 +00:00
|
|
|
* Asynchronously open this channel. Data is fed to the specified stream
|
|
|
|
* listener as it becomes available.
|
2002-03-20 22:50:33 +00:00
|
|
|
*
|
|
|
|
* @param aListener the nsIStreamListener implementation
|
|
|
|
* @param aContext an opaque parameter forwarded to aListener's methods
|
2000-03-29 03:58:50 +00:00
|
|
|
*/
|
2002-03-20 22:50:33 +00:00
|
|
|
void asyncOpen(in nsIStreamListener aListener, in nsISupports aContext);
|
2000-03-29 03:58:50 +00:00
|
|
|
|
2001-04-10 06:01:08 +00:00
|
|
|
/**************************************************************************
|
2001-04-14 02:02:19 +00:00
|
|
|
* Channel specific load flags:
|
2002-09-25 21:28:53 +00:00
|
|
|
*
|
2002-10-06 03:20:40 +00:00
|
|
|
* Bits 20-31 are reserved for future use by this interface or one of its
|
|
|
|
* derivatives (e.g., see nsICachingChannel).
|
2001-04-14 02:02:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2002-09-25 21:28:53 +00:00
|
|
|
* Set (e.g., by the docshell) to indicate whether or not the channel
|
|
|
|
* corresponds to a document URI.
|
2001-04-14 02:02:19 +00:00
|
|
|
*/
|
|
|
|
const unsigned long LOAD_DOCUMENT_URI = 1 << 16;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* If the end consumer for this load has been retargeted after discovering
|
|
|
|
* it's content, this flag will be set:
|
|
|
|
*/
|
|
|
|
const unsigned long LOAD_RETARGETED_DOCUMENT_URI = 1 << 17;
|
|
|
|
|
2002-05-03 07:49:43 +00:00
|
|
|
/**
|
|
|
|
* This flag is set to indicate that onStopRequest may be followed by
|
2001-04-14 02:02:19 +00:00
|
|
|
* another onStartRequest/onStopRequest pair. This flag is, for example,
|
|
|
|
* used by the multipart/replace stream converter.
|
2002-05-03 07:49:43 +00:00
|
|
|
*/
|
2001-04-14 02:02:19 +00:00
|
|
|
const unsigned long LOAD_REPLACE = 1 << 18;
|
2002-09-25 21:28:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set (e.g., by the docshell) to indicate whether or not the channel
|
|
|
|
* corresponds to an initial document URI load (e.g., link click).
|
|
|
|
*/
|
|
|
|
const unsigned long LOAD_INITIAL_DOCUMENT_URI = 1 << 19;
|
2002-03-06 07:48:55 +00:00
|
|
|
};
|