Proxies in Necko 编辑

Proxies are implemented transparently to necko users. This means that callers can just create an nsIChannel, not needing to worry about whether the channel will use a proxy or not

The basic interfaces for proxies are: nsIProxyInfo, nsIProtocolProxyService, and nsIProxiedProtocolHandler

nsIProxyInfo is a simple helper which stores information about the type of the proxy, its host and its port.

nsIIOService

The decision whether to use a proxy is made in nsIOService::NewChannelFromURI. It first asks the nsIProtocolProxyService for an nsIProxyInfo. Depending on the type of the proxy info, it either asks the HTTP Protocol Handler or the protocol handler for the requested URI for a new channel with the nsIProxyInfo - if the channel supports nsIProxiedProtocolHandler. Otherwise, the proxy info is discarded.

nsIProtocolProxyService

The most important function on nsIProtocolProxyService is resolve. It checks whether the passed-in URI should use a proxy, and returns an nsIProxyInfo if so.

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, nsISocketTransportService supports creating socket transports using an nsIProxyInfo. This proxy info will only be used if it specifies a SOCKS proxy, through which the connection is then made.

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

Requires Gecko 9.0(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.

 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:41 次

字数:5288

最后编辑:6 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文