2001-05-12 01:04:09 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/*
|
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
|
|
|
* Communications. Portions created by Netscape Communications are
|
|
|
|
* Copyright (C) 2001 by Netscape Communications. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Gagan Saksena <gagan@netscape.com> (original author)
|
|
|
|
* Darin Fisher <darin@netscape.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "nsIChannel.idl"
|
|
|
|
|
|
|
|
interface nsIHttpHeaderVisitor;
|
2002-03-14 03:51:28 +03:00
|
|
|
interface nsISimpleEnumerator;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
[scriptable, uuid(d78b53c8-d03f-4fd8-b2ee-7b36fcd150d1)]
|
|
|
|
interface nsIHttpChannel : nsIChannel
|
|
|
|
{
|
|
|
|
/**************************************************************************
|
|
|
|
* Request info...
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The request method is case insensitive
|
|
|
|
*/
|
2002-03-21 01:50:33 +03:00
|
|
|
attribute ACString requestMethod;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get/set the referrer URI on the request. This is the address (URI) of
|
|
|
|
* the resource from which this channel's URI was obtained (see RFC2616
|
|
|
|
* section 14.36). The referrer type may be used to block the referrer
|
|
|
|
* from being sent in certain cases.
|
|
|
|
*/
|
|
|
|
readonly attribute nsIURI referrer;
|
|
|
|
void setReferrer(in nsIURI referrer, in unsigned long referrerType);
|
|
|
|
|
|
|
|
/* possible values for the referrerType */
|
|
|
|
const unsigned long REFERRER_NONE = 0;
|
|
|
|
const unsigned long REFERRER_LINK_CLICK = 1; // http link clicks
|
|
|
|
const unsigned long REFERRER_INLINES = 2; // images and other inlines
|
|
|
|
const unsigned long REFERRER_NON_HTTP = 3; // e.g. news or FTP clicks
|
|
|
|
|
2002-03-02 04:26:49 +03:00
|
|
|
/**
|
|
|
|
* An http channel can own a reference to the document URI
|
|
|
|
*/
|
|
|
|
attribute nsIURI documentURI;
|
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
/**
|
|
|
|
* Header strings are case insensitive
|
|
|
|
*/
|
2002-03-21 01:50:33 +03:00
|
|
|
ACString getRequestHeader(in ACString header);
|
|
|
|
void setRequestHeader(in ACString header, in ACString value);
|
|
|
|
void visitRequestHeaders(in nsIHttpHeaderVisitor visitor);
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
/**
|
2001-09-05 07:52:26 +04:00
|
|
|
* Get the stream (to be) uploaded by this HTTP channel.
|
2001-05-12 01:04:09 +04:00
|
|
|
*/
|
2001-09-05 07:52:26 +04:00
|
|
|
readonly attribute nsIInputStream uploadStream;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* Response info...
|
|
|
|
*/
|
|
|
|
|
|
|
|
readonly attribute unsigned long responseStatus;
|
2002-03-21 01:50:33 +03:00
|
|
|
readonly attribute ACString responseStatusText;
|
2001-05-12 01:04:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Header strings are case insensitive
|
|
|
|
*/
|
2002-03-21 01:50:33 +03:00
|
|
|
ACString getResponseHeader(in ACString header);
|
|
|
|
void setResponseHeader(in ACString header, in ACString value);
|
|
|
|
void visitResponseHeaders(in nsIHttpHeaderVisitor visitor);
|
2001-05-12 01:04:09 +04:00
|
|
|
|
2002-01-09 07:18:48 +03:00
|
|
|
/**
|
|
|
|
* True if the server sent a "Cache-control: no-store" response header.
|
|
|
|
*/
|
|
|
|
boolean isNoStoreResponse();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* True if the server sent the equivalent of a "Cache-control: no-cache"
|
|
|
|
* response header. Other equivalent response headers include: "Pragma:
|
|
|
|
* no-cache" and "Expires" with a date-value in the past.
|
|
|
|
*/
|
|
|
|
boolean isNoCacheResponse();
|
|
|
|
|
2002-03-14 03:51:28 +03:00
|
|
|
/**
|
|
|
|
* This attribute holds the MIME types corresponding to the content
|
|
|
|
* encodings on the channel. The enumerator returns nsISupportsString
|
|
|
|
* objects. The first one corresponds to the outermost encoding on the
|
|
|
|
* channel and then we work our way inward. "identity" is skipped and not
|
|
|
|
* represented on the list. Unknown encodings make the enumeration stop.
|
|
|
|
* If you want the actual Content-Encoding value, use
|
|
|
|
* getResponseHeader("Content-Encoding").
|
|
|
|
*
|
|
|
|
* When there is no Content-Encoding header, this property is null.
|
|
|
|
*
|
|
|
|
* Modifying the Content-Encoding header on the channel will case
|
|
|
|
* this enumerator to have undefined behavior. Don't do it.
|
|
|
|
*/
|
|
|
|
readonly attribute nsISimpleEnumerator contentEncodings;
|
|
|
|
|
2001-05-12 01:04:09 +04:00
|
|
|
/**
|
|
|
|
* This attribute controls whether or not content conversion should be
|
|
|
|
* done per the Content-Encoding response header. Its value is true
|
|
|
|
* by default.
|
|
|
|
*/
|
|
|
|
attribute boolean applyConversion;
|
2001-12-08 03:23:04 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* This attribute specifies the number of redirects this channel is allowed
|
|
|
|
* to make. If zero, the channel will fail to redirect and will generate
|
|
|
|
* a NS_ERROR_REDIRECT_LOOP failure status.
|
|
|
|
*/
|
|
|
|
attribute unsigned long redirectionLimit;
|
2001-05-12 01:04:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Implement this interface to visit http headers.
|
|
|
|
*/
|
|
|
|
[scriptable, uuid(0cf40717-d7c1-4a94-8c1e-d6c9734101bb)]
|
|
|
|
interface nsIHttpHeaderVisitor : nsISupports
|
|
|
|
{
|
2002-03-21 01:50:33 +03:00
|
|
|
/**
|
|
|
|
* @throw any exception to terminate enumeration
|
|
|
|
*/
|
|
|
|
void visitHeader(in ACString header, in ACString value);
|
2001-05-12 01:04:09 +04:00
|
|
|
};
|