http-on-examine-response 观察者 - 可以阻止进一步处理的响应吗?
我正在尝试实现一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该是可能的:该通知的“主题”是一个 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?