http-on-examine-response 观察者 - 可以阻止进一步处理的响应吗?

发布于 2024-07-11 06:06:32 字数 285 浏览 10 评论 0原文

我正在尝试实现一个 Firefox 扩展,它可以过滤传入的 HTTP 响应并相应地处理它们。

我希望阻止包含特定标头的 HTTP 响应。 阅读了一些 MDC 文章后,发现观察 HTTP 响应的最常见方法是注册一个 http-on-examine-response 观察者。

我的问题是:使用这个观察者,是否可以阻止 HTTP 请求的进一步处理(作为副产品,页面将继续等待响应)? 或者我是否需要使用 XPCOM 的其他方面(如果是这样,请注意为我指明正确的方向)?

预先感谢,
迈克

I am attempting to implement a firefox extension which filters incoming HTTP responses and handles them accordingly.

I wish to block HTTP responses containing a specific header. Having read through some of the MDC articles, it appears the most common way of observing HTTP responses is by registering an http-on-examine-response observer.

My question is: Using this observer, is it possible to block the HTTP request from further processing (as a by-product, the page will continue to wait for a response)? Or do I need to use some other facet of XPCOM (if so, care to point me in the right direction)?

Thanks in advance,
Mike

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

陌伤浅笑 2024-07-18 06:06:32

应该是可能的:该通知的“主题”是一个 HTTP 通道,您可以在该通道上调用 nsIRequest::cancel()。

不过,该页面将不会继续等待响应,因为您阻止了响应。 也许您实际上一直在寻找更改 HTTP 响应的方法?

Should be possible: the "subject" of that notification is a HTTP channel, on which you can call nsIRequest::cancel().

the page will not continue to wait for a response, though, since you blocked the response. Perhaps you've been actually looking for a way to alter an HTTP response?

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