2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-19 02:01:16 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1999-06-08 01:33:30 +04:00
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* 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/
|
1999-06-08 01:33:30 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04: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-08 01:33:30 +04:00
|
|
|
*
|
1999-11-06 06:40:37 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-19 02:01:16 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
1999-11-06 06:40:37 +03:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-19 02:01:16 +04:00
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-19 02:01:16 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* 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
|
2004-04-19 02:01:16 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
1999-06-08 01:33:30 +04:00
|
|
|
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
|
|
|
|
interface nsIURI;
|
2002-05-03 11:49:43 +04:00
|
|
|
interface nsIChannel;
|
1999-06-08 01:33:30 +04:00
|
|
|
|
2002-05-03 11:49:43 +04:00
|
|
|
/**
|
|
|
|
* nsIProtocolHandler
|
|
|
|
*
|
|
|
|
* @status FROZEN
|
|
|
|
*/
|
1999-11-03 08:13:44 +03:00
|
|
|
[scriptable, uuid(15fd6940-8ea7-11d3-93ad-00104ba0fd40)]
|
1999-06-08 01:33:30 +04:00
|
|
|
interface nsIProtocolHandler : nsISupports
|
|
|
|
{
|
2002-03-06 10:48:55 +03:00
|
|
|
/**
|
2002-05-03 11:49:43 +04:00
|
|
|
* The scheme of this protocol (e.g., "file").
|
2002-03-06 10:48:55 +03:00
|
|
|
*/
|
|
|
|
readonly attribute ACString scheme;
|
1999-06-08 01:33:30 +04:00
|
|
|
|
2001-08-08 00:42:57 +04:00
|
|
|
/**
|
2002-05-03 11:49:43 +04:00
|
|
|
* The default port is the port that this protocol normally uses.
|
|
|
|
* If a port does not make sense for the protocol (e.g., "about:")
|
2002-03-06 10:48:55 +03:00
|
|
|
* then -1 will be returned.
|
2001-08-08 00:42:57 +04:00
|
|
|
*/
|
1999-10-12 05:39:37 +04:00
|
|
|
readonly attribute long defaultPort;
|
1999-06-08 01:33:30 +04:00
|
|
|
|
2002-03-06 10:48:55 +03:00
|
|
|
/**
|
2002-05-03 11:49:43 +04:00
|
|
|
* Returns the protocol specific flags (see flag definitions below).
|
2002-03-06 10:48:55 +03:00
|
|
|
*/
|
2001-09-13 06:21:05 +04:00
|
|
|
readonly attribute unsigned long protocolFlags;
|
2001-08-08 00:42:57 +04:00
|
|
|
|
1999-06-08 01:33:30 +04:00
|
|
|
/**
|
2002-03-06 10:48:55 +03:00
|
|
|
* Makes a URI object that is suitable for loading by this protocol,
|
|
|
|
* where the URI string is given as an UTF-8 string. The caller may
|
|
|
|
* provide the charset from which the URI string originated, so that
|
|
|
|
* the URI string can be translated back to that charset (if necessary)
|
|
|
|
* before communicating with, for example, the origin server of the URI
|
2002-05-03 11:49:43 +04:00
|
|
|
* string. (Many servers do not support UTF-8 IRIs at the present time,
|
2002-03-06 10:48:55 +03:00
|
|
|
* so we must be careful about tracking the native charset of the origin
|
2002-05-03 11:49:43 +04:00
|
|
|
* server.)
|
2002-03-06 10:48:55 +03:00
|
|
|
*
|
|
|
|
* @param aSpec - the URI string in UTF-8 encoding. depending
|
|
|
|
* on the protocol implementation, unicode character
|
|
|
|
* sequences may or may not be %xx escaped.
|
|
|
|
* @param aOriginCharset - the charset of the document from which this URI
|
|
|
|
* string originated. this corresponds to the
|
|
|
|
* charset that should be used when communicating
|
|
|
|
* this URI to an origin server, for example. if
|
|
|
|
* null, then UTF-8 encoding is assumed (i.e.,
|
|
|
|
* no charset transformation from aSpec).
|
|
|
|
* @param aBaseURI - if null, aSpec must specify an absolute URI.
|
2002-09-03 02:04:03 +04:00
|
|
|
* otherwise, aSpec may be resolved relative
|
|
|
|
* to aBaseURI, depending on the protocol.
|
|
|
|
* If the protocol has no concept of relative
|
|
|
|
* URI aBaseURI will simply be ignored.
|
1999-06-08 01:33:30 +04:00
|
|
|
*/
|
2002-03-06 10:48:55 +03:00
|
|
|
nsIURI newURI(in AUTF8String aSpec,
|
|
|
|
in string aOriginCharset,
|
|
|
|
in nsIURI aBaseURI);
|
1999-06-08 01:33:30 +04:00
|
|
|
|
1999-10-26 13:16:24 +04:00
|
|
|
/**
|
2002-03-06 10:48:55 +03:00
|
|
|
* Constructs a new channel from the given URI for this protocol handler.
|
1999-10-26 13:16:24 +04:00
|
|
|
*/
|
2000-03-29 07:58:50 +04:00
|
|
|
nsIChannel newChannel(in nsIURI aURI);
|
2001-06-06 04:10:09 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Allows a protocol to override blacklisted ports.
|
|
|
|
*
|
2002-05-03 11:49:43 +04:00
|
|
|
* This method will be called when there is an attempt to connect to a port
|
2001-06-06 04:10:09 +04:00
|
|
|
* that is blacklisted. For example, for most protocols, port 25 (Simple Mail
|
2002-03-06 10:48:55 +03:00
|
|
|
* Transfer) is banned. When a URI containing this "known-to-do-bad-things"
|
2001-06-06 04:10:09 +04:00
|
|
|
* port number is encountered, this function will be called to ask if the
|
2002-03-06 10:48:55 +03:00
|
|
|
* protocol handler wants to override the ban.
|
2001-06-06 04:10:09 +04:00
|
|
|
*/
|
|
|
|
boolean allowPort(in long port, in string scheme);
|
2002-05-03 11:49:43 +04:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* Constants for the protocol flags (the first is the default mask, the
|
|
|
|
* others are deviations):
|
|
|
|
*
|
|
|
|
* NOTE: Implementation must ignore any flags they do not understand.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* standard full URI with authority component and concept of relative
|
|
|
|
* URIs (http, ftp, ...)
|
|
|
|
*/
|
|
|
|
const unsigned long URI_STD = 0;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* no concept of relative URIs (about, javascript, finger, ...)
|
|
|
|
*/
|
|
|
|
const unsigned long URI_NORELATIVE = (1<<0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* no authority component (file, ...)
|
|
|
|
*/
|
|
|
|
const unsigned long URI_NOAUTH = (1<<1);
|
|
|
|
|
2006-05-02 22:54:19 +04:00
|
|
|
/**
|
|
|
|
* The URIs for this protocol have no inherent security context. That is,
|
|
|
|
* it's not possible to decide what a document loaded from one of these
|
|
|
|
* URIs should be allowed to do.
|
|
|
|
*/
|
|
|
|
const unsigned long URI_HAS_NO_SECURITY_CONTEXT = (1<<4);
|
|
|
|
|
2002-05-03 11:49:43 +04:00
|
|
|
/**
|
|
|
|
* This protocol handler can be proxied via a proxy (socks or http)
|
|
|
|
* (e.g., irc, smtp, http, etc.). If the protocol supports transparent
|
|
|
|
* proxying, the handler should implement nsIProxiedProtocolHandler.
|
|
|
|
*
|
|
|
|
* If it supports only HTTP proxying, then it need not support
|
|
|
|
* nsIProxiedProtocolHandler, but should instead set the ALLOWS_PROXY_HTTP
|
|
|
|
* flag (see below).
|
|
|
|
*
|
|
|
|
* @see nsIProxiedProtocolHandler
|
|
|
|
*/
|
|
|
|
const unsigned long ALLOWS_PROXY = (1<<2);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This protocol handler can be proxied using a http proxy (e.g., http,
|
|
|
|
* ftp, etc.). nsIIOService::newChannelFromURI will feed URIs from this
|
|
|
|
* protocol handler to the HTTP protocol handler instead. This flag is
|
|
|
|
* ignored if ALLOWS_PROXY is not set.
|
|
|
|
*/
|
|
|
|
const unsigned long ALLOWS_PROXY_HTTP = (1<<3);
|
1999-06-08 01:33:30 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
%{C++
|
2002-03-06 10:48:55 +03:00
|
|
|
/**
|
|
|
|
* Protocol handlers are registered with XPCOM under the following CONTRACTID prefix:
|
|
|
|
*/
|
2002-09-13 22:55:57 +04:00
|
|
|
#define NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "@mozilla.org/network/protocol;1?name="
|
2002-03-06 10:48:55 +03:00
|
|
|
/**
|
|
|
|
* For example, "@mozilla.org/network/protocol;1?name=http"
|
|
|
|
*/
|
1999-06-08 01:33:30 +04:00
|
|
|
%}
|