gecko-dev/netwerk/protocol/http/public/nsIHttpChannel.idl

142 строки
4.9 KiB
Plaintext
Исходник Обычный вид История

/* -*- 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;
interface nsISimpleEnumerator;
[scriptable, uuid(d78b53c8-d03f-4fd8-b2ee-7b36fcd150d1)]
interface nsIHttpChannel : nsIChannel
{
/**************************************************************************
* Request info...
*/
/**
* The request method is case insensitive
*/
attribute ACString requestMethod;
/**
* 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
/**
* An http channel can own a reference to the document URI
*/
attribute nsIURI documentURI;
/**
* Header strings are case insensitive
*/
ACString getRequestHeader(in ACString header);
void setRequestHeader(in ACString header, in ACString value);
void visitRequestHeaders(in nsIHttpHeaderVisitor visitor);
/**
* Get the stream (to be) uploaded by this HTTP channel.
*/
readonly attribute nsIInputStream uploadStream;
/**************************************************************************
* Response info...
*/
readonly attribute unsigned long responseStatus;
readonly attribute ACString responseStatusText;
/**
* Header strings are case insensitive
*/
ACString getResponseHeader(in ACString header);
void setResponseHeader(in ACString header, in ACString value);
void visitResponseHeaders(in nsIHttpHeaderVisitor visitor);
/**
* 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();
/**
* 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;
/**
* 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;
/**
* 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;
};
/**
* Implement this interface to visit http headers.
*/
[scriptable, uuid(0cf40717-d7c1-4a94-8c1e-d6c9734101bb)]
interface nsIHttpHeaderVisitor : nsISupports
{
/**
* @throw any exception to terminate enumeration
*/
void visitHeader(in ACString header, in ACString value);
};