nsIHttpChannelInternal 编辑

netwerk/protocol/http/nsIHttpChannelInternal.idlScriptable An internal interface for HTTP channels. Using features exposed by this interface is not recommended, as it will change in unpredictable ways. 66 Introduced Gecko 1.0 Inherits from: nsISupports Last changed in Gecko 6.0 (Firefox 6.0 / Thunderbird 6.0 / SeaMonkey 2.3)

Method overview

void getRequestVersion(out unsigned long major, out unsigned long minor);
void getResponseVersion(out unsigned long major, out unsigned long minor);
void HTTPUpgrade(in ACString aProtocolName, in nsIHttpUpgradeListener aListener);
void setCookie(in string aCookieHeader);
void setupFallbackChannel(in string aFallbackKey);

Attributes

AttributeTypeDescription
canceledbooleanReturns true if and only if the channel has been canceled. Read only.
channelIsForDownloadbooleanExternal handlers may set this to true to notify the channel that it is open on behalf of a download.
documentURInsIURIAn HTTP channel can own a reference to the document URI.
forceAllowThirdPartyCookiebooleanForce relevant cookies to be sent with this load even if normally they would not be.
localAddressAUTF8String

The local IP address to which the channel is bound, in the same format produced by PR_NetAddrToString(). This may be either an IPv4 or IPv6 address.

Note: If Network Address Translation (NAT) is in effect, this may not be the same address the remote host thinks it is talking to. This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only.
localPortPRInt32

The local port number to which the channel is bound.

This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only.
proxyInfonsIProxyInfoGet the proxy info in use by the channel. Read only. Obsolete since Gecko 1.9
remoteAddressAUTF8String

The IP address of the remote host to which this channel is bound, in the same format produced by PR_NetAddrToString().

This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only.
remotePortPRInt32

The remote port number to which the channel is bound.

This may throw an NS_ERROR_NOT_AVAILABLE exception if accessed when the channel's endpoints haven't been determined yet, or any time the nsIHttpActivityObserver.isActive attribute is false. See bug 534698 and bug 526207. Read only.

Methods

getRequestVersion()

Gets the request's major and minor version numbers.

void getRequestVersion(
  out unsigned long major,
  out unsigned long minor
);
Parameters
major
On return, contains the request's major version number.
minor
On return, contains the request's minor version number.

getResponseVersion()

Gets the response's major and minor version numbers.

void getResponseVersion(
  out unsigned long major,
  out unsigned long minor
);
Parameters
major
On return, contains the response's major version number.
minor
On return, contains the response's minor version number.

HTTPUpgrade()

Allows for the use of HTTP to bootstrap another protocol via the RFC 2616 Upgrade request header in conjunction with a 101 level response. The nsIHttpUpgradeListener will have its nsIHttpUpgradeListener.onTransportAvailable() method invoked if a matching 101 is processed. The arguments to nsIHttpUpgradeListener.onTransportAvailable() provide to the new protocol the low level transport streams that are no longer used by HTTP.

The onStartRequest and onStopRequest events are still delivered and the listener gets full control over the socket if and when nsIHttpUpgradeListener.onTransportAvailable() is delivered.

void HTTPUpgrade(
  in ACString aProtocolName,
  in nsIHttpUpgradeListener aListener
);
Parameters
aProtocolName
The value of the HTTP Upgrade request header.
aListener
The callback object used to handle a successful upgrade.

setCookie()

Helper method to set a cookie with a consumer-provided cookie header, but using the channel's other information (URI's, prompters, date headers and so on.).

void setCookie(
  in string aCookieHeader
);
Parameters
aCookieHeader
The cookie header to be parsed.

setupFallbackChannel()

Sets up this channel as an application cache fallback channel.

void setupFallbackChannel(
  in string aFallbackKey
);
Parameters
aFallbackKey
The fallback key.

See also

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

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

发布评论

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

词条统计

浏览:95 次

字数:10672

最后编辑:7年前

编辑次数:0 次

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