Proxies are implemented transparently to necko users. This means that callers can just create an nsIChannel
The basic interfaces for proxies are: nsIProxyInfo, nsIProtocolProxyService, and nsIProxiedProtocolHandler
nsIProxyInfo
nsIIOService
The decision whether to use a proxy is made in nsIOService::NewChannelFromURI. It first asks the nsIProtocolProxyServicensIProxyInfonsIProxiedProtocolHandler
nsIProtocolProxyService
The most important function on nsIProtocolProxyServiceresolve. It checks whether the passed-in URI should use a proxy, and returns an nsIProxyInfo
This works by examining the protocolFlags of the protocol handler for the given URI. If this protocol handler does not support proxies, resolve returns null. Alternatively, if proxies are disabled, or this host is in the list of hosts for which no proxy should be used, null is also returned.
If PAC (proxy autoconfiguration) is enabled, it is asked for the proxy string for the given URI, which determines whether to use a proxy. Note that the PROXY method is only used when the protocol handler supports HTTP proxies, as indicated by its protocol flags.
Finally, depending on the protocol, the proxy info will be created with the appropriate type, host and port.
SOCKS and nsISocketTransportService
The aforementioned methods work very well for application-level proxies. However, SOCKS is transparent to upper-level protocols, and can transport any other TCP- or UDP-based protocol.
Therefore, nsISocketTransportServicensIProxyInfo
Note that SOCKS is implemented as an nsISocketProvider, and the socket transport service will therefore use it as as the downmost socket type.
Proxies and local hosts
(Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6)Starting with Gecko 9.0 (Firefox 9.0 / Thunderbird 9.0 / SeaMonkey 2.6), proxy servers are not used when accessing hosts with no dots in their names, if manual proxy configuration is used and "<local>" is added to the "No proxy for:" text field field.
To be written
XXX missing paragraphs are about PAC, and more details about HTTP proxying, and maybe some more details about SOCKS proxies.
Original Document Information
- Author(s): Christian Biesinger
- Last Updated Date: April 8, 2005
- Copyright Information: Portions of this content are © 1998–2007 by individual mozilla.org contributors; content available under a Creative Commons license | Details.