Confirmed users
69
edits
m (→Channels) |
|||
| Line 90: | Line 90: | ||
If an error is returned from either <code>onStartRequest</code> or <code>onDataAvailable</code>, the channel must act as if it has been canceled with the corresponding error code. | If an error is returned from either <code>onStartRequest</code> or <code>onDataAvailable</code>, the channel must act as if it has been canceled with the corresponding error code. | ||
A channel has two URI objects associated with it. The <code>originalURI</code> of the channel is the URI that was originally passed to <code>newChannel</code> to create the channel that then had <code>asyncOpen</code> called on it. The <code>URI</code> is the URI from which the channel is reading data. These can be different in various cases involving protocol handlers that forward network access to other protocol handlers, as well as in situations in which a redirect occurs (e.g. following an HTTP 3xx response). In redirect situations, a new channel object will be created, but the originalURI will be propagated from the old channel the new channel. | A channel has two URI objects associated with it. The <code>originalURI</code> of the channel is the URI that was originally passed to <code>newChannel</code> to create the channel that then had <code>asyncOpen</code> called on it. The <code>URI</code> is the URI from which the channel is reading data. These can be different in various cases involving protocol handlers that forward network access to other protocol handlers, as well as in situations in which a redirect occurs (e.g. following an HTTP 3xx response). In redirect situations, a new channel object will be created, but the originalURI will be propagated from the old channel to the new channel. | ||
Note that the <code>nsIRequest</code> that's passed to onStartRequest must match the one passed to onDataAvailable and onStopRequest, but need not be the original channel that asyncOpen was called on. In particular, when an HTTP redirect happens the request argument to the callbacks will be the post-redirect channel. | Note that the <code>nsIRequest</code> that's passed to onStartRequest must match the one passed to onDataAvailable and onStopRequest, but need not be the original channel that asyncOpen was called on. In particular, when an HTTP redirect happens the request argument to the callbacks will be the post-redirect channel. | ||